-
Notifications
You must be signed in to change notification settings - Fork 48
124 lines (100 loc) · 2.91 KB
/
test.yml
File metadata and controls
124 lines (100 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
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/mongodb-github-action@1.11.0
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