Skip to content

[pre-commit.ci] pre-commit autoupdate #1432

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #1432

Workflow file for this run

name: Testing
on:
push:
branches:
- main
pull_request:
jobs:
build-backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and export
uses: docker/build-push-action@v5
with:
context: ./backend
target: prod
tags: backend:dev
outputs: type=docker,dest=/tmp/backend.tar
push: false
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: backend
path: /tmp/backend.tar
retention-days: 1
backend-linting:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install just
uses: taiki-e/install-action@just
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Get full Python version
id: full-python-version
run: echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT
- name: Install Poetry
run: |
python -m pip install pipx
pipx install poetry
- name: Configure poetry
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Cache poetry venv
uses: actions/cache@v3
id: poetry-cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
- name: Ensure cache is healthy
if: steps.poetry-cache.outputs.cache-hit == 'true'
shell: bash
run: timeout 10s poetry run pip --version || rm -rf .venv
- name: Install Dependencies
run: just install-backend
- name: mypy check
run: just mypy-ci
backend-testing:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install just
uses: taiki-e/install-action@just
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Get full Python version
id: full-python-version
run: echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT
- name: Install Poetry
run: |
python -m pip install pipx
pipx install poetry
- name: Configure poetry
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Cache poetry venv
uses: actions/cache@v3
id: poetry-cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
- name: Ensure cache is healthy
if: steps.poetry-cache.outputs.cache-hit == 'true'
shell: bash
run: timeout 10s poetry run pip --version || rm -rf .venv
- name: Install Dependencies
run: just install-backend
- name: Test with pytest
run: just backend-test-ci
frontend-linting:
strategy:
fail-fast: false
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install just
uses: taiki-e/install-action@just
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "npm"
cache-dependency-path: ./frontend/package-lock.json
- name: Install Dependencies
run: just install-frontend
- name: Lint
run: just frontend-lint-ci
- name: Check
run: just frontend-check-ci
frontend-testing:
strategy:
fail-fast: false
runs-on: ubuntu-latest
needs: build-backend
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Download backend
uses: actions/download-artifact@v3
with:
name: backend
path: /tmp
- name: Load Backend Image
run: docker load --input /tmp/backend.tar
- name: Install just
uses: taiki-e/install-action@just
- name: Start Containers
run: just api-ci
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "npm"
cache-dependency-path: ./frontend/package-lock.json
- name: Install Dependencies
run: just install-frontend
- name: Playwright install
run: just playwright-install
- name: Frontend Tests
env:
VITE_API_PATH: "http://127.0.0.1:8000/api/v1"
run: |
just frontend-test-ci
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: frontend/test-results
retention-days: 1