-
Notifications
You must be signed in to change notification settings - Fork 3
102 lines (96 loc) · 2.96 KB
/
test.yml
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: "Test"
on:
pull_request:
merge_group:
push:
branches:
- master
jobs:
test-controller:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v27
with:
extra_nix_config: |
system-features = kvm
extra-trusted-public-keys = cache.thymis.io-1:pEeKkNXiK17TLKls0KM8cEp0NGy08gc5chAmCyuQo8M=
extra-substituters = https://cache.thymis.io
- name: Configure poetry
run: |
nix develop --command poetry config virtualenvs.in-project true
- name: Cache the virtualenv
uses: actions/cache@v4
with:
path: ./controller/.venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: |
nix develop --command poetry install
working-directory: controller
- name: Run tests
run: |
nix develop --command poetry run python -m pytest -sxv
working-directory: controller
test-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v27
with:
extra_nix_config: |
system-features = kvm
extra-trusted-public-keys = cache.thymis.io-1:pEeKkNXiK17TLKls0KM8cEp0NGy08gc5chAmCyuQo8M=
extra-substituters = https://cache.thymis.io
- uses: DeterminateSystems/magic-nix-cache-action@v2
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: |
npm ci
working-directory: frontend
- name: Build application
run: |
nix build .#thymis-controller
- name: Install Playwright Browser
run: |
npx playwright install --with-deps
working-directory: frontend
- name: Run tests
run: |
npm run test
env:
THYMIS_REPO_PATH: ${{ runner.temp }}/thymis/repository
THYMIS_DATABASE_URL: sqlite:///${{ runner.temp }}/thymis/thymis.sqlite
THYMIS_AUTH_BASIC_PASSWORD_FILE: ${{ runner.temp }}/thymis/auth-basic-password
working-directory: frontend
test-pre-commit:
strategy:
matrix:
python-version: ["3.12"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install pre-commit
run: |
python -m pip install pre-commit
- name: Install node dependencies
run: |
npm ci
working-directory: frontend
- name: Run pre-commit
run: |
pre-commit run --all-files
test:
runs-on: ubuntu-latest
needs: [test-controller, test-frontend, test-pre-commit]
steps:
- run: echo "Build successful"