-
-
Notifications
You must be signed in to change notification settings - Fork 4
191 lines (187 loc) · 5.63 KB
/
testing.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: Testing
on:
push:
branches:
- main
pull_request:
jobs:
build-backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and export
uses: docker/build-push-action@v4
with:
context: ./backend
tags: backend:dev
outputs: type=docker,dest=/tmp/backend.tar
push: false
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: backend
path: /tmp/backend.tar
retention-days: 1
build-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and export
uses: docker/build-push-action@v4
with:
context: ./frontend
tags: frontend:dev
outputs: type=docker,dest=/tmp/frontend.tar
push: false
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: frontend
path: /tmp/frontend.tar
retention-days: 1
backend-linting:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install just
uses: taiki-e/install-action@just
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Get full Python version
id: full-python-version
run: echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT
- name: Install Poetry
run: |
python -m pip install pipx
pipx install poetry
- name: Configure poetry
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Cache poetry venv
uses: actions/cache@v3
id: poetry-cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
- name: Ensure cache is healthy
if: steps.poetry-cache.outputs.cache-hit == 'true'
shell: bash
run: timeout 10s poetry run pip --version || rm -rf .venv
- name: Install Dependencies
run: just install-backend
- name: mypy check
run: just mypy-ci
backend-testing:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install just
uses: taiki-e/install-action@just
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Get full Python version
id: full-python-version
run: echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT
- name: Install Poetry
run: |
python -m pip install pipx
pipx install poetry
- name: Configure poetry
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Cache poetry venv
uses: actions/cache@v3
id: poetry-cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
- name: Ensure cache is healthy
if: steps.poetry-cache.outputs.cache-hit == 'true'
shell: bash
run: timeout 10s poetry run pip --version || rm -rf .venv
- name: Install Dependencies
run: just install-backend
- name: Test with pytest
run: just backend-test-ci
frontend-linting:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install just
uses: taiki-e/install-action@just
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install Dependencies
run: just install-frontend
- name: Lint
run: just frontend-lint-ci
- name: Check
run: just frontend-check-ci
frontend-testing:
strategy:
fail-fast: false
runs-on: ubuntu-latest
needs:
- build-backend
- build-frontend
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Download backend
uses: actions/download-artifact@v3
with:
name: backend
path: /tmp
- name: Load Backend Image
run: docker load --input /tmp/backend.tar
- name: Download frontend
uses: actions/download-artifact@v3
with:
name: frontend
path: /tmp
- name: Load Frontend Image
run: docker load --input /tmp/frontend.tar
- name: List images
run: docker image ls -a
- name: Install just
uses: taiki-e/install-action@just
- name: Start Containers
run: just compose-up-ci
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install Dependencies
run: just install-frontend
- name: Playwright install
run: just playwright-install
- name: Frontend Tests
run: |
just frontend-test-ci
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: frontend/test-results
retention-days: 1