CI #1756
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 0 * * *' # Daily “At 00:00” UTC | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| id-token: write # This is required for requesting the JWT | |
| contents: read # This is required for actions/checkout | |
| env: | |
| OFFSETS_DB_DATABASE_URL: postgres://postgres_user:postgres_password@localhost:5432/postgres_db | |
| OFFSETS_DB_STAGING: true | |
| OFFSETS_DB_API_KEY: cowsay | |
| AWS_DEFAULT_REGION: us-west-2 | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| # https://docs.github.com/en/actions/using-containerized-services/creating-postgresql-service-containers | |
| # See also https://remarkablemark.org/blog/2021/03/14/setup-postgresql-in-github-actions/ | |
| # and https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml | |
| services: | |
| postgres: | |
| image: postgres | |
| env: | |
| POSTGRES_DB: postgres_db | |
| POSTGRES_PASSWORD: postgres_password | |
| POSTGRES_PORT: 5432 | |
| POSTGRES_USER: postgres_user | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: configure aws credentials | |
| uses: aws-actions/configure-aws-credentials@v5 | |
| with: | |
| role-to-assume: arn:aws:iam::631969445205:role/github-action-role | |
| role-session-name: offsets-db-ci-role-session | |
| aws-region: ${{ env.AWS_DEFAULT_REGION }} | |
| - name: Set up pixi | |
| uses: prefix-dev/setup-pixi@v0.9.3 | |
| with: | |
| pixi-version: v0.59.0 | |
| cache: true | |
| locked: true | |
| - name: Database migration | |
| run: | | |
| pixi run migrate | |
| - name: Run tests | |
| run: | | |
| pixi run test | |
| - name: Upload code coverage to Codecov | |
| uses: codecov/codecov-action@v5.5.2 | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| env_vars: OS,PYTHON | |
| name: codecov-umbrella | |
| fail_ci_if_error: false |