-
Notifications
You must be signed in to change notification settings - Fork 57
83 lines (79 loc) · 2.63 KB
/
tests.yml
File metadata and controls
83 lines (79 loc) · 2.63 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
name: build_and_test
on: [push]
jobs:
build:
name: Build necessary services
runs-on: self-hosted
steps:
- name: Check out repository code
uses: actions/checkout@v5
- name: "Setup: Copy environment variables"
run: cp .env_circleci .env
- name: "Setup: Create directories for MinIO (cannot be made by docker for some reason)"
run: |
mkdir -p var/minio/public
mkdir -p var/minio/private
- name: "Setup: Prepare the playwright environment"
run: |
cd tests
curl -LsSf https://astral.sh/uv/install.sh | sh
$HOME/.local/bin/uv sync --frozen
$HOME/.local/bin/uv run playwright install
- name: "Docker: Build containers"
run: |
docker compose up -d
- name: "Get compute worker, site worker and django logs"
run: |
mkdir dockerLogs
docker compose logs -f site_worker compute_worker django > dockerLogs/django_workers.log &
linter:
name: Flake8 linter
runs-on: self-hosted
needs: [build]
steps:
- name: "Lint: Check code style with flake8"
run: docker compose exec django flake8 src/
unit_tests:
name: Unit tests
runs-on: self-hosted
needs: [linter,build]
steps:
- name: "Tests: Run unit/integration tests (excluding e2e)"
run: docker compose exec django py.test src/ -m "not e2e"
e2e:
name: End to End tests with Playwright
runs-on: self-hosted
needs: [linter,build]
steps:
- name: "Tests: Run end-to-end (E2E) tests"
run: |
docker compose exec django python ./manage.py createsuperuser --no-input
docker compose exec django python ./manage.py collectstatic --no-input
cd tests && CI=True $HOME/.local/bin/uv run pytest test_auth.py test_account_creation.py test_competition.py test_submission.py
artifacts:
name: "Store Artifacts"
runs-on: self-hosted
needs: [linter,build,unit_tests,e2e]
steps:
- name: "Docker logs"
uses: actions/upload-artifact@v4
with:
name: "Docker logs"
path: |
dockerLogs/
- name: "Playwright results (on-failure)"
uses: actions/upload-artifact@v4
with:
name: "Playwright results (on-failure)"
path: |
tests/test-results
cleanup:
name: Cleanup
runs-on: self-hosted
if: ${{ always() }}
needs: [unit_tests,e2e,linter,artifacts]
steps:
- name: Cleanup
run: |
docker compose down --rmi all
rm -rf ${{ github.workspace }}/*