Skip to content

Commit 31c8bbf

Browse files
authored
👷 Run tests from Python environment (with uv), not from Docker container (fastapi#1361)
1 parent e6b698d commit 31c8bbf

File tree

3 files changed

+40
-10
lines changed

3 files changed

+40
-10
lines changed

‎.github/workflows/smokeshow.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Smokeshow
22

33
on:
44
workflow_run:
5-
workflows: [Test]
5+
workflows: [Test Backend]
66
types: [completed]
77

88
jobs:

‎.github/workflows/test.yml renamed to ‎.github/workflows/test-backend.yml

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test
1+
name: Test Backend
22

33
on:
44
push:
@@ -11,7 +11,7 @@ on:
1111

1212
jobs:
1313

14-
test:
14+
test-backend:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout
@@ -21,14 +21,18 @@ jobs:
2121
uses: actions/setup-python@v5
2222
with:
2323
python-version: '3.10'
24-
25-
- run: docker compose build
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v2
26+
with:
27+
version: "0.4.15"
2628
- run: docker compose down -v --remove-orphans
27-
- run: docker compose up -d
28-
- name: Lint
29-
run: docker compose exec -T backend bash scripts/lint.sh
29+
- run: docker compose up -d db mailcatcher
30+
- name: Migrate DB
31+
run: uv run bash scripts/prestart.sh
32+
working-directory: backend
3033
- name: Run tests
31-
run: docker compose exec -T backend bash scripts/tests-start.sh "Coverage for ${{ github.sha }}"
34+
run: uv run bash scripts/tests-start.sh "Coverage for ${{ github.sha }}"
35+
working-directory: backend
3236
- run: docker compose down -v --remove-orphans
3337
- name: Store coverage files
3438
uses: actions/upload-artifact@v4
@@ -41,7 +45,7 @@ jobs:
4145
alls-green: # This job does nothing and is only used for the branch protection
4246
if: always()
4347
needs:
44-
- test
48+
- test-backend
4549
runs-on: ubuntu-latest
4650
steps:
4751
- name: Decide whether the needed jobs succeeded or failed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Test Docker Compose
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types:
9+
- opened
10+
- synchronize
11+
12+
jobs:
13+
14+
test-docker-compose:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
- run: docker compose build
20+
- run: docker compose down -v --remove-orphans
21+
- run: docker compose up -d --wait
22+
- name: Test backend is up
23+
run: curl http://localhost:8000/api/v1/utils/health-check
24+
- name: Test frontend is up
25+
run: curl http://localhost:5173
26+
- run: docker compose down -v --remove-orphans

0 commit comments

Comments
 (0)