Repository navigation
234 lines (216 loc) · 6.24 KB
/
Copy pathdev.yml
File metadata and controls
234 lines (216 loc) · 6.24 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
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
name: ci-checks-dev
on:
push:
branches:
- dev
tags:
- '*'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
backend:
name: backend
runs-on: ubuntu-24.04
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: bmds
POSTGRES_PASSWORD: password
POSTGRES_DB: bmds-online-test
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
ports:
- 5432/tcp
redis:
image: redis:7-alpine
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
ports:
- 6379:6379
env:
VCPKG_HOST_TRIPLET: x64-linux
steps:
- name: Checkout bmds-ui
uses: actions/checkout@v4
- name: Checkout bmds@dev
uses: actions/checkout@v4
with:
repository: USEPA/BMDS
path: venv
ref: dev
- name: Cache vcpkg dependencies
id: cache-vcpkg-deps
uses: actions/cache@v4
with:
path: venv/vcpkg_installed
key: vcpkg-${{ runner.os }}-${{ hashFiles('venv/vcpkg.json') }}
- name: Acquire vcpkg
if: steps.cache-vcpkg-deps.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: "Microsoft/vcpkg"
path: venv/vcpkg
ref: c9c17dcea3016bc241df0422e82b8aea212dcb93
- name: Install libraries with vcpkg.json
if: steps.cache-vcpkg-deps.outputs.cache-hit != 'true'
shell: bash
run: |
cd venv
./vcpkg/bootstrap-vcpkg.sh
./vcpkg/vcpkg install --host-triplet="$VCPKG_HOST_TRIPLET" --overlay-ports=./vendor/ports
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
cache-dependency-glob: "**/pyproject.toml"
- name: Build pybmds
run: |
cd venv
uv pip install pybind11==3.0.0 --target=./pybind11
export CMAKE_PREFIX_PATH=$(pwd)/pybind11/pybind11/share/cmake
export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)
uv build --wheel
- name: Install bmds_ui
run: |
uv pip install --system venv/dist/*.whl
uv pip install --system -v -e ".[pg,dev]"
- name: loc
run: |
sudo apt-get install -y cloc
echo "# Lines of Code Report" >> $GITHUB_STEP_SUMMARY
poe -q loc >> $GITHUB_STEP_SUMMARY
- name: lint
run: |
poe lint-py
- name: test
env:
DJANGO_DB_NAME: bmds-online-test
DJANGO_DB_USER: bmds
DJANGO_DB_PW: password
DJANGO_DB_HOST: localhost
DJANGO_DB_PORT: ${{ job.services.postgres.ports[5432] }} # get randomly assigned published port
DJANGO_CACHE_LOCATION: redis://localhost:6379/0
run: |
coverage run -m pytest --record-mode=none
echo "# Python coverage report" >> $GITHUB_STEP_SUMMARY
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
coverage html -d coverage -i
- name: Upload pybmds wheel
uses: actions/upload-artifact@v4
with:
name: pybmds
path: venv/dist
retention-days: 1
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage
retention-days: 14
frontend:
name: frontend
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'yarn'
cache-dependency-path: 'frontend/yarn.lock'
- name: install
run: |
yarn --cwd ./frontend install --frozen-lockfile
- name: lint
run: |
yarn --cwd ./frontend run lint
- name: test
run: |
npm --prefix ./frontend run test
- name: build for integration tests
run: |
npm --prefix ./frontend run build
- name: Upload JS build
uses: actions/upload-artifact@v4
with:
name: js
path: bmds_ui/static/bundles/
retention-days: 1
integration:
name: integration
needs: [backend, frontend]
runs-on: ubuntu-24.04
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: bmds
POSTGRES_PASSWORD: password
POSTGRES_DB: bmds-online-test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
env:
DJANGO_DB_HOST: localhost
DJANGO_DB_NAME: bmds-online-test
DJANGO_DB_PW: password
DJANGO_DB_USER: bmds
INTEGRATION_TESTS: 1
LIVESERVER_HOST: localhost
LIVESERVER_PORT: 8000
NO_VITE_DEV: 1
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
cache-dependency-glob: "**/pyproject.toml"
- name: Download JS build
uses: actions/download-artifact@v4
with:
name: js
path: bmds_ui/static/bundles/
- name: Download pybmds wheel
uses: actions/download-artifact@v4
with:
name: pybmds
path: venv/dist
- name: Install bmds_ui
run: |
uv pip install --system venv/dist/*.whl
uv pip install --system -v -e ".[pg,dev]"
playwright install --with-deps chromium
# https://github.community/t/how-to-retry-a-failed-step-in-github-actions-workflow/125880
- name: run integration tests
id: test
continue-on-error: true
run: |
py.test -sv tests/integration/
- name: run integration tests (retry)
if: steps.test.outcome=='failure'
id: retry
continue-on-error: true
run: |
py.test -sv tests/integration/
- name: set status
if: always()
run: |
if ${{ steps.test.outcome=='success' || steps.retry.outcome=='success' }}; then
echo success!
else
exit 1
fi
- name: build wheel
run: |
manage.py set_git_commit
uv build --wheel
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheel
path: dist/*.whl