18 update dependencies (#19) #61
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: Test | |
on: | |
# Trigger the workflow on push or pull request, | |
# but only for the main branch | |
push: | |
branches: | |
- main | |
# Replace pull_request with pull_request_target if you | |
# plan to use this action with forks, see the Limitations section | |
pull_request: | |
branches: | |
- main | |
env: # environment variables (available in any part of the action) | |
NODE_VERSION: 22 | |
PYTHON_VERSION: 3.12 | |
MONGODB_VERSION: 8.0 | |
jobs: | |
run-js-linters: | |
name: Run JS linters | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./frontend | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: "npm" | |
cache-dependency-path: frontend/package-lock.json | |
- name: Install Node.js dependencies | |
run: npm ci | |
- name: Run eslint | |
run: npm run lint | |
run-python-linters: | |
name: Run Python linters | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./backend | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
- name: Run black | |
run: uv run --group dev black --check --config ./pyproject.toml . | |
- name: Run mypy | |
run: uv run --group dev mypy --config-file=pyproject.toml | |
- name: Run ruff | |
run: uv run --group dev ruff check | |
test-backend: | |
name: Run backend unit tests | |
runs-on: ubuntu-latest | |
needs: run-python-linters | |
defaults: | |
run: | |
working-directory: ./backend | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
- name: Start MongoDB | |
uses: supercharge/[email protected] | |
with: | |
mongodb-version: ${{ env.MONGODB_VERSION }} | |
- name: Test with pytest | |
run: uv run --group dev pytest --cov=app tests --cov-report html | |
# upload-artifact action does not take into account working-directory default | |
# see https://github.com/actions/upload-artifact/issues/232 | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage-report | |
path: backend/htmlcov | |
test-frontend: | |
name: Run frontend unit tests | |
runs-on: ubuntu-latest | |
needs: run-js-linters | |
defaults: | |
run: | |
working-directory: ./frontend | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install Node.js dependencies | |
run: npm ci | |
- name: Run tests | |
run: npm run test |