Skip to content

Commit cf9dfc1

Browse files
committed
ci: split unit and integration tests
Closes #1402
1 parent 0c11d7a commit cf9dfc1

File tree

2 files changed

+42
-20
lines changed

2 files changed

+42
-20
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Shared setup backend
2+
runs:
3+
using: "composite"
4+
steps:
5+
- name: Set up Python
6+
uses: actions/setup-python@v4
7+
with:
8+
python-version: '3.12'
9+
10+
- name: Install Poetry
11+
run: |
12+
python -m pip install --upgrade pip
13+
pip install poetry
14+
shell: bash
15+
16+
- name: Install dependencies
17+
working-directory: ./backend
18+
run: poetry install
19+
shell: bash

.github/workflows/ci.yaml

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -104,27 +104,15 @@ jobs:
104104
run: pnpm build
105105
working-directory: ./dashboard
106106

107-
build-django:
107+
lint-and-unit-test-django:
108108
if: github.event.pull_request.draft != true
109109
runs-on: ubuntu-latest
110110
timeout-minutes: 10
111111
steps:
112-
- name: Checkout code
113-
uses: actions/checkout@v4
114-
115-
- name: Set up Python
116-
uses: actions/setup-python@v4
117-
with:
118-
python-version: '3.12'
119-
120-
- name: Install Poetry
121-
run: |
122-
python -m pip install --upgrade pip
123-
pip install poetry
112+
- uses: actions/checkout@v4
124113

125-
- name: Install dependencies
126-
run: poetry install
127-
working-directory: ./backend
114+
- name: Setup Backend
115+
uses: ./.github/actions/setup-backend
128116

129117
- name: Lint
130118
run: poetry run flake8
@@ -134,6 +122,20 @@ jobs:
134122
run: poetry run black --check .
135123
working-directory: ./backend
136124

125+
- name: Run unit tests
126+
run: poetry run pytest -m unit
127+
working-directory: ./backend
128+
129+
integration-test-django:
130+
if: github.event.pull_request.draft != true
131+
runs-on: ubuntu-latest
132+
timeout-minutes: 10
133+
steps:
134+
- uses: actions/checkout@v4
135+
136+
- name: Setup Backend
137+
uses: ./.github/actions/setup-backend
138+
137139
- name: Configure credentials variables
138140
run: |
139141
echo -n "${{ secrets.PG_JSON }}" | base64 --decode > application_default_credentials.json
@@ -160,11 +162,11 @@ jobs:
160162
break
161163
fi
162164
echo "Waiting for backend to be ready... $i"
163-
sleep 10
165+
sleep 5
164166
done
165167
166-
- name: Run tests
167-
run: poetry run pytest --run-all
168+
- name: Run integration tests
169+
run: poetry run pytest -m "not unit" --run-all
168170
working-directory: ./backend
169171

170172
- name: Clean containers
@@ -176,7 +178,8 @@ jobs:
176178
needs:
177179
- lint-js
178180
- build-front
179-
- build-django
181+
- lint-and-unit-test-django
182+
- integration-test-django
180183
steps:
181184
- name: Configure staging host authenticity
182185
run: |

0 commit comments

Comments
 (0)