Skip to content

Commit c43259a

Browse files
authored
Merge pull request #5 from guigolab/feature/test-integration
Feature/test integration
2 parents 1b9e47c + d0c07b2 commit c43259a

98 files changed

Lines changed: 7550 additions & 457 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-all.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: Build and Push
22

33
on:
4-
push:
5-
branches: [main]
4+
workflow_call:
65
workflow_dispatch:
76

87
jobs:

.github/workflows/front-test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Front unit tests
2+
3+
on:
4+
pull_request:
5+
workflow_call:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
defaults:
11+
run:
12+
working-directory: front
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: "22"
22+
cache: npm
23+
cache-dependency-path: front/package-lock.json
24+
25+
- name: Install dependencies
26+
run: npm ci --legacy-peer-deps
27+
28+
- name: Run unit tests
29+
run: npm test
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Main pipeline (test then build)
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
jobs:
9+
front-tests:
10+
uses: ./.github/workflows/front-test.yml
11+
12+
server-tests:
13+
uses: ./.github/workflows/server-test.yml
14+
15+
build-and-push:
16+
needs: [front-tests, server-tests]
17+
uses: ./.github/workflows/build-all.yml
18+
secrets: inherit

.github/workflows/server-test.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Server tests
2+
3+
on:
4+
pull_request:
5+
workflow_call:
6+
inputs:
7+
run_integration:
8+
description: "Also run pytest -m integration"
9+
type: boolean
10+
default: false
11+
workflow_dispatch:
12+
inputs:
13+
run_integration:
14+
description: "Also run pytest -m integration"
15+
type: boolean
16+
default: false
17+
schedule:
18+
# Weekly Monday 06:00 UTC — integration suite (mongomock, no Docker services)
19+
- cron: "0 6 * * 1"
20+
21+
jobs:
22+
unit:
23+
runs-on: ubuntu-latest
24+
defaults:
25+
run:
26+
working-directory: server
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Setup Python
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: "3.10"
36+
cache: pip
37+
cache-dependency-path: server/requirements-dev.txt
38+
39+
- name: Install dependencies
40+
run: pip install -r requirements-dev.txt
41+
42+
- name: Run unit tests with coverage
43+
run: |
44+
coverage run -m pytest -m unit -q
45+
coverage report -m
46+
47+
integration:
48+
# schedule: always run integration weekly.
49+
# workflow_dispatch / workflow_call: only when run_integration is true.
50+
if: >
51+
github.event_name == 'schedule' ||
52+
((github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.run_integration)
53+
runs-on: ubuntu-latest
54+
defaults:
55+
run:
56+
working-directory: server
57+
58+
steps:
59+
- name: Checkout
60+
uses: actions/checkout@v4
61+
62+
- name: Setup Python
63+
uses: actions/setup-python@v5
64+
with:
65+
python-version: "3.10"
66+
cache: pip
67+
cache-dependency-path: server/requirements-dev.txt
68+
69+
- name: Install dependencies
70+
run: pip install -r requirements-dev.txt
71+
72+
- name: Run integration tests
73+
run: pytest -m integration -q

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ __pycache__
22
*.db
33
.DS_Store
44
venv
5+
.venv
56
files/
67
.env
78
docker-compose-dev.yml
@@ -19,4 +20,7 @@ annotrieve_missing_from_tracker.tsv
1920
broken_source_urls.jsonl
2021
TODO.txt
2122
.pytest_cache/
23+
.coverage
24+
htmlcov/
25+
coverage.xml
2226
graphify-out/

0 commit comments

Comments
 (0)