Browse Source
👷 Run tests from Python environment (with `uv`), not from Docker container (#1361)
pull/13907/head
Sebastián Ramírez
11 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
40 additions and
10 deletions
-
.github/workflows/smokeshow.yml
-
.github/workflows/test-backend.yml
-
.github/workflows/test-docker-compose.yml
|
@ -2,7 +2,7 @@ name: Smokeshow |
|
|
|
|
|
|
|
|
on: |
|
|
on: |
|
|
workflow_run: |
|
|
workflow_run: |
|
|
workflows: [Test] |
|
|
workflows: [Test Backend] |
|
|
types: [completed] |
|
|
types: [completed] |
|
|
|
|
|
|
|
|
jobs: |
|
|
jobs: |
|
|
|
@ -1,4 +1,4 @@ |
|
|
name: Test |
|
|
name: Test Backend |
|
|
|
|
|
|
|
|
on: |
|
|
on: |
|
|
push: |
|
|
push: |
|
@ -11,7 +11,7 @@ on: |
|
|
|
|
|
|
|
|
jobs: |
|
|
jobs: |
|
|
|
|
|
|
|
|
test: |
|
|
test-backend: |
|
|
runs-on: ubuntu-latest |
|
|
runs-on: ubuntu-latest |
|
|
steps: |
|
|
steps: |
|
|
- name: Checkout |
|
|
- name: Checkout |
|
@ -21,14 +21,18 @@ jobs: |
|
|
uses: actions/setup-python@v5 |
|
|
uses: actions/setup-python@v5 |
|
|
with: |
|
|
with: |
|
|
python-version: '3.10' |
|
|
python-version: '3.10' |
|
|
|
|
|
- name: Install uv |
|
|
- run: docker compose build |
|
|
uses: astral-sh/setup-uv@v2 |
|
|
|
|
|
with: |
|
|
|
|
|
version: "0.4.15" |
|
|
- run: docker compose down -v --remove-orphans |
|
|
- run: docker compose down -v --remove-orphans |
|
|
- run: docker compose up -d |
|
|
- run: docker compose up -d db mailcatcher |
|
|
- name: Lint |
|
|
- name: Migrate DB |
|
|
run: docker compose exec -T backend bash scripts/lint.sh |
|
|
run: uv run bash scripts/prestart.sh |
|
|
|
|
|
working-directory: backend |
|
|
- name: Run tests |
|
|
- name: Run tests |
|
|
run: docker compose exec -T backend bash scripts/tests-start.sh "Coverage for ${{ github.sha }}" |
|
|
run: uv run bash scripts/tests-start.sh "Coverage for ${{ github.sha }}" |
|
|
|
|
|
working-directory: backend |
|
|
- run: docker compose down -v --remove-orphans |
|
|
- run: docker compose down -v --remove-orphans |
|
|
- name: Store coverage files |
|
|
- name: Store coverage files |
|
|
uses: actions/upload-artifact@v4 |
|
|
uses: actions/upload-artifact@v4 |
|
@ -41,7 +45,7 @@ jobs: |
|
|
alls-green: # This job does nothing and is only used for the branch protection |
|
|
alls-green: # This job does nothing and is only used for the branch protection |
|
|
if: always() |
|
|
if: always() |
|
|
needs: |
|
|
needs: |
|
|
- test |
|
|
- test-backend |
|
|
runs-on: ubuntu-latest |
|
|
runs-on: ubuntu-latest |
|
|
steps: |
|
|
steps: |
|
|
- name: Decide whether the needed jobs succeeded or failed |
|
|
- name: Decide whether the needed jobs succeeded or failed |
|
@ -0,0 +1,26 @@ |
|
|
|
|
|
name: Test Docker Compose |
|
|
|
|
|
|
|
|
|
|
|
on: |
|
|
|
|
|
push: |
|
|
|
|
|
branches: |
|
|
|
|
|
- master |
|
|
|
|
|
pull_request: |
|
|
|
|
|
types: |
|
|
|
|
|
- opened |
|
|
|
|
|
- synchronize |
|
|
|
|
|
|
|
|
|
|
|
jobs: |
|
|
|
|
|
|
|
|
|
|
|
test-docker-compose: |
|
|
|
|
|
runs-on: ubuntu-latest |
|
|
|
|
|
steps: |
|
|
|
|
|
- name: Checkout |
|
|
|
|
|
uses: actions/checkout@v4 |
|
|
|
|
|
- run: docker compose build |
|
|
|
|
|
- run: docker compose down -v --remove-orphans |
|
|
|
|
|
- run: docker compose up -d --wait |
|
|
|
|
|
- name: Test backend is up |
|
|
|
|
|
run: curl http://localhost:8000/api/v1/utils/health-check |
|
|
|
|
|
- name: Test frontend is up |
|
|
|
|
|
run: curl http://localhost:5173 |
|
|
|
|
|
- run: docker compose down -v --remove-orphans |