feat: Migrate package manager to uv #577
Workflow file for this run
This file contains hidden or 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: Database | |
| on: | |
| pull_request: | |
| jobs: | |
| csv: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Lint | |
| run: | | |
| set -e | |
| curl -sSL https://github.com/Clever/csvlint/releases/download/v0.3.0/csvlint-v0.3.0-linux-amd64.tar.gz | tar xz --strip-components=1 | |
| for filename in data/v2/csv/*.csv; do | |
| echo "$filename" | |
| ./csvlint -lazyquotes "$filename" # TODO: remove lazyquotes when https://github.com/Clever/csvlint/issues/45 will be addressed | |
| done | |
| openapi: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.11.19" | |
| enable-cache: true | |
| - name: Generate OpenAPI schema | |
| run: | | |
| make install-base | |
| make openapi-generate | |
| sqlite: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.11.19" | |
| enable-cache: true | |
| - name: Start pokeapi | |
| run: | | |
| make install-base | |
| make migrate | |
| make build-db | |
| nohup make serve & | |
| sleep 3 | |
| - name: Dump DB | |
| run: stat db.sqlite3 | |
| - name: Test data | |
| run: | | |
| name=$(curl -fsSL http://localhost:8000/api/v2/pokemon/1/ | jq -r '.name') | |
| echo "Returned name: $name" | |
| test "$name" = "bulbasaur" | |
| postgres: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: pokeapi | |
| POSTGRES_PASSWORD: pokeapi | |
| POSTGRES_DB: pokeapi | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.11.19" | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: make install-base | |
| - name: Run migrations & build database | |
| run: | | |
| make setup | |
| make build-db | |
| - name: Build | |
| run: | | |
| docker compose -f docker-compose.yml -f docker-compose-dev.yml up -d | |
| make docker-migrate | |
| make docker-build-db | |
| - name: Dump DB | |
| run: pg_dump -h localhost -U pokeapi -Fc -N 'hdb_*' pokeapi > pokeapi.dump | |
| env: | |
| PGPASSWORD: pokeapi | |
| - name: Drop and recreate database | |
| run: | | |
| psql -h localhost -U pokeapi -d postgres -c "DROP DATABASE pokeapi;" | |
| psql -h localhost -U pokeapi -d postgres -c "CREATE DATABASE pokeapi;" | |
| env: | |
| PGPASSWORD: pokeapi | |
| - name: Import database | |
| run: pg_restore -h localhost -U pokeapi -d pokeapi pokeapi.dump | |
| env: | |
| PGPASSWORD: pokeapi | |
| - name: Start pokeapi | |
| run: | | |
| nohup make serve & | |
| sleep 3 | |
| - name: Test data | |
| run: | | |
| name=$(curl -fsSL http://localhost:8000/api/v2/pokemon/1/ | jq -r '.name') | |
| echo "Returned name: $name" | |
| test "$name" = "bulbasaur" |