24
24
25
25
jobs :
26
26
determine-test-scope :
27
- runs-on : [ inhouse ]
27
+ runs-on : [ deploynode ]
28
28
if : |
29
29
github.event.pull_request.draft == false ||
30
30
github.ref == 'refs/heads/develop' ||
@@ -115,7 +115,8 @@ jobs:
115
115
needs : determine-test-scope
116
116
if : ( needs.determine-test-scope.outputs.local_tests == 'true' ) || ( needs.determine-test-scope.outputs.remote_tests == 'true' )
117
117
name : Run linting
118
- runs-on : [ inhouse ]
118
+ runs-on : [ deploynode ]
119
+ container : ghcr.io/astral-sh/uv:debian
119
120
steps :
120
121
- uses : actions/checkout@v4
121
122
with :
@@ -132,8 +133,9 @@ jobs:
132
133
# Run on open PRs OR when manually triggered with local_tests=true
133
134
needs : determine-test-scope
134
135
if : needs.determine-test-scope.outputs.local_tests == 'true'
135
- name : Python ${{ matrix.python-version }} - self-hosted-runner
136
- runs-on : [ inhouse ]
136
+ name : Python ${{ matrix.python-version }} - self-hosted-runner
137
+ runs-on : [ deploynode ]
138
+ container : ghcr.io/astral-sh/uv:debian
137
139
strategy :
138
140
matrix :
139
141
python-version : ['3.9', '3.13']
@@ -147,83 +149,95 @@ jobs:
147
149
steps :
148
150
- uses : actions/checkout@v4
149
151
with :
150
- fetch-depth : 1
151
-
152
- - name : Set up Python ${{ matrix.python-version }}
153
- uses : actions/setup-python@v4
154
- with :
155
- python-version : ${{ matrix.python-version }}
152
+ fetch-depth : 0
156
153
157
154
- name : Install project
155
+ env :
156
+ PYTHON_VERSION : ${{ matrix.python-version }}
158
157
run : |
159
- python -m venv ${GITHUB_WORKSPACE}/.venv
158
+ if [ -f /.dockerenv ]; then
159
+ echo "Running inside a Docker container (detected via /.dockerenv)"
160
+ else
161
+ echo "Not running inside a Docker container (/.dockerenv not found)"
162
+ fi
163
+ uv venv -p $PYTHON_VERSION ${GITHUB_WORKSPACE}/.venv
160
164
source ${GITHUB_WORKSPACE}/.venv/bin/activate
161
- python --version
162
165
which python
163
- which pip
164
- pip list
165
- pip install --upgrade pip wheel setuptools
166
- pip install gdstk --only-binary gdstk
167
- pip install -e ".[dev]"
166
+ which uv
167
+ python --version
168
+ uv pip list
169
+ uv pip install gdstk --only-binary gdstk
170
+ uv pip install -e ".[dev]"
171
+
172
+ echo "Testing vtk is correctly installed."
173
+ python -c "import vtk"
168
174
169
175
- name : Run tests with coverage
170
176
env :
171
177
PYTHONUNBUFFERED : " 1"
172
178
run : |
173
179
source ${GITHUB_WORKSPACE}/.venv/bin/activate
174
- pytest --cov=tidy3d -rF --tb=short tests/_test_data/_test_datasets_no_vtk.py
180
+ # pytest --cov=tidy3d -rF --tb=short tests/_test_data/_test_datasets_no_vtk.py
175
181
pytest --cov=tidy3d -rF --tb=short tests
176
182
coverage report -m
177
- coverage xml -o coverage.xml
183
+ coverage xml -o ${GITHUB_WORKSPACE}/ coverage.xml
178
184
TOTAL_COVERAGE=$(coverage report --format=total)
179
185
echo "total=$TOTAL_COVERAGE" >> "$GITHUB_ENV"
180
186
echo "### Total coverage: ${TOTAL_COVERAGE}%"
181
187
182
- - name : Produce the coverage report
183
- uses : insightsengineering/coverage-action@v2
184
- with :
185
- path : ./coverage.xml
186
- threshold : 90.0
187
- fail : false
188
- publish : true
189
- diff : true
190
- diff-branch : develop
191
- diff-storage : _xml_coverage_reports
192
- coverage-summary-title : " Code Coverage Summary"
193
- togglable-report : true
194
-
195
- - name : Changed files
196
- id : diff
197
- uses : step-security/changed-files@v46
198
- with :
199
- files : ' **/*.py'
188
+ - name : verify-coverage-report-location
189
+ run : |
190
+ ls $GITHUB_WORKSPACE
200
191
201
- - name : Slice report down to changed files
202
- if : ${{ steps.diff.outputs.all_changed_files != '' }}
203
- env :
204
- CHANGED : ${{ steps.diff.outputs.all_changed_files }}
192
+ - name : Produce the diff coverage report
193
+ if : matrix.python-version == '3.13'
205
194
run : |
206
- echo $CHANGED
207
195
source ${GITHUB_WORKSPACE}/.venv/bin/activate
208
- include=$(printf '%s\n' $CHANGED | sed 's|^|**/|' | paste -sd, -)
209
- coverage xml -i -o changed.xml --include="$include"
196
+ git config --global --add safe.directory ${GITHUB_WORKSPACE}
197
+ diff-cover ${GITHUB_WORKSPACE}/coverage.xml \
198
+ --compare-branch origin/${{ github.event.pull_request.base.ref }} \
199
+ --format markdown:diff-coverage.md
210
200
211
- - name : Produce the changed files coverage report
212
- uses : insightsengineering/coverage-action@v2
213
- if : ${{ steps.diff.outputs.all_changed_files != '' }}
201
+ - uses : actions/github-script@v7
202
+ if : matrix.python-version == '3.13'
214
203
with :
215
- path : ./changed.xml
216
- threshold : 90.0
217
- publish : true
218
- fail : false
219
- coverage-summary-title : " Changed Files Coverage"
204
+ result-encoding : string
205
+ script : |
206
+ const fs = require('fs');
207
+ const marker = '<!-- diff-cover-report -->';
208
+ const body = fs.readFileSync('diff-coverage.md','utf8');
209
+ const report = `${marker}\n${body}`;
210
+ const {data:comments}=await github.rest.issues.listComments({
211
+ owner:context.repo.owner,
212
+ repo:context.repo.repo,
213
+ issue_number:context.issue.number,
214
+ });
215
+ const existing = comments.find(c=>c.body.startsWith(marker));
216
+ if(existing) {
217
+ await github.rest.issues.updateComment({
218
+ owner:context.repo.owner,
219
+ repo:context.repo.repo,
220
+ comment_id:existing.id,
221
+ body:report,
222
+ });
223
+ } else {
224
+ await github.rest.issues.createComment({
225
+ owner:context.repo.owner,
226
+ repo:context.repo.repo,
227
+ issue_number:context.issue.number,
228
+ body:report,
229
+ });
230
+ }
220
231
221
232
remote-tests :
222
233
# Run tests on a push event OR a workflow dispatch with remote_tests
223
234
needs : determine-test-scope
224
235
if : needs.determine-test-scope.outputs.remote_tests == 'true'
225
236
name : Python ${{ matrix.python-version }} - ${{ matrix.platform }}
226
237
runs-on : ${{ matrix.platform }}
238
+ permissions :
239
+ contents : read
240
+ pull-requests : write
227
241
strategy :
228
242
matrix :
229
243
python-version : ['3.9', '3.10', '3.11', '3.12', '3.13']
@@ -234,7 +248,7 @@ jobs:
234
248
env : # Set environment variables for the whole job
235
249
PIP_ONLY_BINARY : gdstk
236
250
MPLBACKEND : agg
237
-
251
+
238
252
concurrency :
239
253
group : ${{ github.workflow }}-${{ github.event.pull_request.number }}-${{ matrix.platform }}-${{ matrix.python-version }}-remote
240
254
cancel-in-progress : true
@@ -299,7 +313,7 @@ jobs:
299
313
name : pr-requirements-pass
300
314
if : ( needs.determine-test-scope.outputs.local_tests == 'true' ) || ( needs.determine-test-scope.outputs.remote_tests == 'true' )
301
315
needs : [local-tests, remote-tests, lint]
302
- runs-on : [ inhouse ]
316
+ runs-on : [ deploynode ]
303
317
steps :
304
318
- name : check-passing-remote-tests
305
319
run : |
0 commit comments