Format #734
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: CI | |
on: | |
push: | |
branches: [ main ] | |
tags: [ '*' ] | |
schedule: | |
- cron: '0 4 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Create virtual environment | |
run: python3 -m venv --upgrade-deps .venv | |
- name: Build web assets | |
run: npm 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@v4 | |
if: failure() | |
with: | |
name: screenshots | |
path: test-results | |
- id: auth | |
name: Authenticate with Google Cloud | |
uses: google-github-actions/auth@v2 | |
with: | |
token_format: access_token | |
credentials_json: '${{ secrets.GCP_CREDENTIALS_PUSH }}' | |
- name: Login to Docker repository | |
uses: docker/login-action@v3 | |
with: | |
registry: europe-west1-docker.pkg.dev | |
username: oauth2accesstoken | |
password: ${{ steps.auth.outputs.access_token }} | |
- id: meta | |
name: Extract metadata | |
uses: docker/metadata-action@v5 | |
with: | |
images: europe-west1-docker.pkg.dev/dft-schemes-common/docker/schemes | |
tags: | | |
type=semver,pattern={{version}} | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Build and push image | |
uses: docker/build-push-action@v6 | |
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: 'latest' | |
secrets: | |
GCP_CREDENTIALS_DEPLOY: ${{ secrets.GCP_CREDENTIALS_DEPLOY }} |