Skip to content

Backend state migration #3231

Backend state migration

Backend state migration #3231

Workflow file for this run

name: CI tests
on:
pull_request:
branches: [dev, main, 331-staging]
jobs:
event_file:
name: Event File
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Event File
path: ${{ github.event_path }}
backend_lint:
name: Backend Pylint
runs-on: ubuntu-latest
steps:
- name: Checking out repository
uses: actions/checkout@v4
- name: Install deps
uses: ./.github/actions/setup-ci-backend
- name: Install pylint
run: pip install pylint
- name: Analysing the code with pylint
run: pylint $(git ls-files '*.py')
backend_typecheck:
name: Backend Mypy
runs-on: ubuntu-latest
steps:
- name: Checking out repository
uses: actions/checkout@v4
- name: Install deps
uses: ./.github/actions/setup-ci-backend
- name: Run mypy checks
run: python -m mypy .
working-directory: ./backend
backend_tests:
name: Backend Unit Tests
runs-on: ubuntu-latest
permissions: # required for artifacts
checks: write
pull-requests: write
steps:
- name: Checking out repository
uses: actions/checkout@v4
- name: Install deps
uses: ./.github/actions/setup-ci-backend
- name: Setup environment
uses: ./.github/actions/setup-ci-env
- name: Run the backend container
run: docker compose up --wait --wait-timeout 90 ci-backend
- name: Log the backend container output
run: docker compose logs ci-backend
if: always()
- name: Test algorithm with pytest
run: |
pip install pytest-cov
python -m pytest --junitxml=junit/be-test-results.xml --cov=. --cov-report=xml --cov-report=html
working-directory: ./backend
- uses: actions/upload-artifact@v3 # upload test results
if: always()
with:
name: be-test-results
path: backend/junit/be-test-results.xml # Path to test results
frontend_lint:
name: Frontend Eslint
runs-on: ubuntu-latest
steps:
- name: Checking out repository
uses: actions/checkout@v4
- name: Install deps
uses: ./.github/actions/setup-ci-frontend
- name: Run eslint on frontend
run: ls && npm run lint
working-directory: ./frontend
frontend_typecheck:
name: Frontend Typechecks
runs-on: ubuntu-latest
steps:
- name: Checking out repository
uses: actions/checkout@v4
- name: Install deps
uses: ./.github/actions/setup-ci-frontend
- name: Typecheck the frontend
run: npm run types
working-directory: ./frontend
frontend_tests:
name: Frontend Unit Tests
runs-on: ubuntu-latest
if: false
steps:
- name: Checking out repository
uses: actions/checkout@v4
- name: Install deps
uses: ./.github/actions/setup-ci-frontend
- name: Run the unit tests on frontend
run: npm run test
working-directory: ./frontend
- uses: actions/upload-artifact@v3
if: always()
with:
name: fe-test-results
path: frontend/junit/fe-test-results.xml
docker_build:
name: Build docker containers
runs-on: ubuntu-latest
needs: [backend_lint, backend_typecheck, backend_tests, frontend_lint, frontend_typecheck] # TODO: add test jobs when they get unskipped
steps:
- name: Checking out repository
uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup-ci-env
- name: Check the backend successfully builds
run: docker compose build backend-prod
- name: Check the frontend successfully builds
run: docker compose build frontend-prod
- name: Check that we can successfully start the containers
run: docker compose up --wait --wait-timeout 90 backend-prod frontend-prod
- name: Log the output of the containers
run: docker compose logs backend-prod frontend-prod
if: always()