Try to fix pipeline dependency installation #37
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: pipeline | |
| on: push | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:14.5 | |
| env: | |
| POSTGRES_USER: postgresql | |
| POSTGRES_PASSWORD: postgresql | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: install dependencies | |
| run: | | |
| make negotiator/install | |
| pushd web-components | |
| npm install | |
| npx playwright install-deps chromium | |
| npx playwright install chromium | |
| popd | |
| - name: create test database | |
| env: | |
| PGPASSWORD: postgresql | |
| DATABASE_URL: 'postgresql://localhost:5432/negotiator_test?user=negotiator&password=negotiator' | |
| run: | | |
| psql --host localhost --username postgresql < databases/drop_and_create_databases.sql | |
| make migrate migrate-test | |
| - name: run tests | |
| run: | | |
| make web-components/build | |
| make test | |
| test-dev-container: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run tests | |
| uses: devcontainers/ci@v0.3 | |
| with: | |
| push: never | |
| runCmd: | | |
| make negotiator/test | |
| google-cloud-build: | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| permissions: | |
| contents: "read" | |
| id-token: "write" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: "install dependencies" | |
| run: | | |
| make install | |
| uv pip compile pyproject.toml -o requirements.txt | |
| - uses: google-github-actions/auth@v2 | |
| with: | |
| workload_identity_provider: "${{ secrets.GOOGLE_FEDERATION_WORKLOAD_IDENTITY_PROVIDER }}" | |
| service_account: "${{ secrets.GOOGLE_FEDERATION_SERVICE_ACCOUNT }}" | |
| - uses: google-github-actions/setup-gcloud@v2 | |
| - name: "build" | |
| run: |- | |
| make web-components/build | |
| gcloud auth configure-docker us-central1-docker.pkg.dev | |
| docker build -t us-central1-docker.pkg.dev/${{ secrets.GOOGLE_PROJECT_ID }}/negotiator-review/negotiator:${{ github.sha }} . | |
| docker push us-central1-docker.pkg.dev/${{ secrets.GOOGLE_PROJECT_ID }}/negotiator-review/negotiator:${{ github.sha }} | |
| google-cloud-sql: | |
| runs-on: ubuntu-latest | |
| needs: [google-cloud-build] | |
| permissions: | |
| contents: "read" | |
| id-token: "write" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: install python dependencies | |
| run: | | |
| uv sync | |
| - uses: google-github-actions/auth@v2 | |
| with: | |
| workload_identity_provider: "${{ secrets.GOOGLE_FEDERATION_WORKLOAD_IDENTITY_PROVIDER }}" | |
| service_account: "${{ secrets.GOOGLE_FEDERATION_SERVICE_ACCOUNT }}" | |
| - uses: google-github-actions/setup-gcloud@v2 | |
| - name: cloud-sql-proxy | |
| run: | | |
| curl https://storage.googleapis.com/cloud-sql-connectors/cloud-sql-proxy/v2.0.0-preview.0/cloud-sql-proxy.linux.amd64 --output cloud-sql-proxy | |
| chmod +x cloud-sql-proxy | |
| sudo mv cloud-sql-proxy /usr/bin/cloud-sql-proxy | |
| - name: migrate | |
| env: | |
| DATABASE_URL: ${{ secrets.REVIEW_MIGRATE_URL }} | |
| run: | | |
| cloud-sql-proxy --port 6000 ${{ secrets.GOOGLE_PROJECT_ID }}:us-central1:negotiator-review & | |
| sleep 6 | |
| make migrate | |
| google-cloud-run: | |
| runs-on: ubuntu-latest | |
| needs: [google-cloud-sql] | |
| permissions: | |
| contents: "read" | |
| id-token: "write" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: google-github-actions/auth@v2 | |
| with: | |
| workload_identity_provider: "${{ secrets.GOOGLE_FEDERATION_WORKLOAD_IDENTITY_PROVIDER }}" | |
| service_account: "${{ secrets.GOOGLE_FEDERATION_SERVICE_ACCOUNT }}" | |
| - uses: google-github-actions/setup-gcloud@v2 | |
| - name: deploy | |
| run: |- | |
| gcloud run deploy negotiator-review \ | |
| --image us-central1-docker.pkg.dev/${{ secrets.GOOGLE_PROJECT_ID }}/negotiator-review/negotiator:${{ github.sha }} \ | |
| --region us-central1 \ | |
| --platform managed |