First Elections PR #70
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Alembic Upgrade Head | |
on: pull_request | |
jobs: | |
alembic_upgrade_head: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:15 | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd "pg_isready -U runner" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
POSTGRES_USER: runner | |
POSTGRES_DB: main | |
POSTGRES_HOST_AUTH_METHOD: trust | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Wait for PostgreSQL to be ready | |
run: | | |
until pg_isready -h localhost -p 5432 -U runner; do | |
echo "Waiting for PostgreSQL..." | |
sleep 1 | |
done | |
- name: Install dependencies | |
run: | | |
# for python3.11 (dear internet gods: we'll update to 3.13 or something in a year, i promise) | |
sudo add-apt-repository ppa:deadsnakes/ppa | |
sudo apt install python3.11 python3.11-venv | |
python3.11 -m pip install --upgrade pip | |
python3.11 -m venv venv | |
source ./venv/bin/activate | |
pip install -r requirements.txt | |
# This will fail if there are divergent heads and alembic gets confused; | |
# e.g., un-sanitarily merging main into a dev branch. | |
- name: Run alembic upgrade head | |
run: | | |
source ./venv/bin/activate | |
cd src | |
alembic upgrade head |