CI #1634
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 ] | |
| tags: [ '*' ] | |
| schedule: | |
| - cron: '0 4 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| env: | |
| IMAGE_PROJECT: dft-schemes-common | |
| IMAGE_LOCATION: europe-west1 | |
| IMAGE_REPOSITORY_ID: docker | |
| IMAGE_NAME: schemes | |
| jobs: | |
| build: | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| version: ${{ steps.meta.outputs.version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.13' | |
| - name: Setup Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Setup Terraform | |
| uses: hashicorp/setup-terraform@v4 | |
| with: | |
| terraform_version: '~1.15.0' | |
| - name: Create virtual environment | |
| run: python3 -m venv --upgrade-deps .venv | |
| - name: Build web assets | |
| run: npm clean-install && npm run build | |
| - name: Install dependencies | |
| run: .venv/bin/pip install .[dev] | |
| - name: Check formatting | |
| run: make format-check | |
| - name: Lint | |
| run: make lint | |
| - name: Install browsers | |
| run: .venv/bin/playwright install --with-deps chromium | |
| - name: Test | |
| run: make test | |
| - name: Upload screenshots on test failures | |
| uses: actions/upload-artifact@v7 | |
| if: failure() | |
| with: | |
| name: screenshots | |
| path: test-results | |
| - id: auth | |
| name: Authenticate with Google Cloud | |
| uses: google-github-actions/auth@v3 | |
| with: | |
| token_format: access_token | |
| credentials_json: '${{ secrets.GCP_CREDENTIALS_PUSH }}' | |
| - name: Login to Docker repository | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ${{ env.IMAGE_LOCATION }}-docker.pkg.dev | |
| username: oauth2accesstoken | |
| password: ${{ steps.auth.outputs.access_token }} | |
| - id: meta | |
| name: Extract metadata | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ env.IMAGE_LOCATION }}-docker.pkg.dev/${{ env.IMAGE_PROJECT }}/${{ env.IMAGE_REPOSITORY_ID }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=ref,event=branch,enable={{is_not_default_branch}} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| - name: Build and push image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| push: true | |
| deploy: | |
| needs: build | |
| uses: ./.github/workflows/deploy.yml | |
| with: | |
| environment: Dev | |
| tag: ${{ needs.build.outputs.version }} | |
| secrets: | |
| GCP_CREDENTIALS_DEPLOY: ${{ secrets.GCP_CREDENTIALS_DEPLOY }} |