-
Notifications
You must be signed in to change notification settings - Fork 12
94 lines (77 loc) · 2.24 KB
/
unit-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
name: Lint and Unit Tests
on:
workflow_call:
inputs:
os:
description: OS
required: false
default: ubuntu-latest
type: string
git-ref:
description: Git branch or ref
required: false
default: ""
type: string
jobs:
python-unit-test:
name: Python Unit Tests
runs-on: ${{ inputs.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
repository: ${{ github.repository }}
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.12
- name: Install Poetry
uses: snok/[email protected]
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install dependencies
run: poetry install
- name: Run linter
run: poetry run ruff format --check
- name: Run linter
run: poetry run ruff check
- name: Set up Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose
- name: Start Docker Compose services
run: docker compose -f docker-compose.dev.yml up -d
- name: Run unit tests
run: poetry run pytest tests/
- name: Stop Docker Compose services
run: docker compose -f docker-compose.dev.yml down
web-unit-test:
name: Web Unit Tests
runs-on: ${{ inputs.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
repository: ${{ github.repository }}
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 18
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 9
- name: Install dependencies
run: cd web && pnpm install
- name: Run linter
run: cd web && pnpm lint
- name: Run prettier check
run: cd web && pnpm prettier:check
- name: Run build
run: cd web && pnpm build
# TODO: activate when tests are available
# - name: Run unit tests
# run: cd web && pnpm test