Skip to content

Commit ebe6a7e

Browse files
ci: pr-requirements-tests only on PR events (#2656)
* ci: pr-requirements-tests only on PR events * more standard naming * what's wrong on schema develop check * a * Why doesn't it see develop branch * pr * why not diffing * Remove precommit
1 parent d43cb39 commit ebe6a7e

File tree

2 files changed

+19
-25
lines changed

2 files changed

+19
-25
lines changed

.github/workflows/tidy3d-python-client-tests.yml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ jobs:
150150
with:
151151
path: 'pr'
152152

153-
- name: checkou-develop-branch
153+
- name: checkout-develop-branch
154154
uses: actions/checkout@v4
155155
with:
156-
ref: 'develop'
156+
ref: develop
157157
path: 'develop'
158158

159159
- name: install-depedencies
@@ -187,7 +187,8 @@ jobs:
187187
# Use git diff to compare the two directories and get a list of changes
188188
# The command exits with 0 if no changes, 1 if changes are found.
189189
# We use '|| true' to prevent the workflow from stopping here on failure.
190-
diff_output=$(git diff --no-index --name-status ./develop/tidy3d/schemas ./pr/tidy3d/schemas || true)
190+
cd $GITHUB_WORKSPACE/develop
191+
diff_output=$(git diff --no-index --name-status $GITHUB_WORKSPACE/develop/schemas $GITHUB_WORKSPACE/pr/schemas || true)
191192
192193
# Check if there are any changes
193194
if [ -z "$diff_output" ]; then
@@ -234,7 +235,7 @@ jobs:
234235
# Run on open PRs OR when manually triggered with local_tests=true
235236
needs: determine-test-scope
236237
if: needs.determine-test-scope.outputs.local_tests == 'true'
237-
name: Python ${{ matrix.python-version }} - self-hosted-runner
238+
name: python-${{ matrix.python-version }}-self-hosted-runner
238239
runs-on: [ slurm-runner, 4xcpu ]
239240
container:
240241
image: ghcr.io/astral-sh/uv:debian
@@ -258,7 +259,7 @@ jobs:
258259
fetch-depth: 0 # Required 0 for diff report.
259260
submodules: false
260261

261-
- name: Install project
262+
- name: install-project
262263
env:
263264
PYTHON_VERSION: ${{ matrix.python-version }}
264265
run: |
@@ -279,7 +280,7 @@ jobs:
279280
echo "Testing vtk is correctly installed."
280281
python -c "import vtk"
281282
282-
- name: Run tests with coverage
283+
- name: run-tests-coverage
283284
env:
284285
PYTHONUNBUFFERED: "1"
285286
run: |
@@ -292,7 +293,7 @@ jobs:
292293
echo "total=$TOTAL_COVERAGE" >> "$GITHUB_ENV"
293294
echo "### Total coverage: ${TOTAL_COVERAGE}%"
294295
295-
- name: Produce the diff coverage report
296+
- name: diff-coverage-report
296297
if: >-
297298
matrix.python-version == '3.13' &&
298299
github.event_name == 'pull_request' &&
@@ -343,7 +344,7 @@ jobs:
343344
# Run tests on a push event OR a workflow dispatch with remote_tests
344345
needs: determine-test-scope
345346
if: needs.determine-test-scope.outputs.remote_tests == 'true'
346-
name: Python ${{ matrix.python-version }} - ${{ matrix.platform }}
347+
name: python-${{ matrix.python-version }}-${{ matrix.platform }}
347348
runs-on: ${{ matrix.platform }}
348349
permissions:
349350
contents: read
@@ -369,19 +370,19 @@ jobs:
369370
fetch-depth: 1
370371
submodules: false
371372

372-
- name: Install Poetry
373+
- name: install-poetry
373374
uses: snok/install-poetry@v1
374375
with:
375376
version: 2.1.1
376377
virtualenvs-create: true
377378
virtualenvs-in-project: true
378379

379-
- name: Set up Python ${{ matrix.python-version }}
380+
- name: set-python-${{ matrix.python-version }}
380381
uses: actions/setup-python@v4
381382
with:
382383
python-version: ${{ matrix.python-version }}
383384

384-
- name: Install project
385+
- name: install-project
385386
run: |
386387
poetry --version
387388
poetry env use python
@@ -390,11 +391,11 @@ jobs:
390391
poetry run pip install gdstk --only-binary gdstk
391392
poetry install -E dev
392393
393-
- name: Run doctests
394+
- name: run-doctests
394395
run: |
395396
poetry run pytest -rF --tb=short tidy3d
396397
397-
- name: Run tests with coverage
398+
- name: run-tests-coverage
398399
env:
399400
PYTHONUNBUFFERED: "1"
400401
run: |
@@ -405,7 +406,7 @@ jobs:
405406
echo "total=$TOTAL_COVERAGE" >> "$GITHUB_ENV"
406407
echo "### Total coverage: ${TOTAL_COVERAGE}%"
407408
408-
- name: "Create badge"
409+
- name: create-badge
409410
if: ${{ github.ref == 'refs/heads/develop' }}
410411
# https://gist.githubusercontent.com/nedbat/8c6980f77988a327348f9b02bbaf67f5
411412
uses: schneegans/[email protected]
@@ -423,10 +424,11 @@ jobs:
423424
pr-requirements-pass:
424425
name: pr-requirements-pass
425426
if: |
426-
always() &&
427-
( needs.determine-test-scope.outputs.pr_approval_state == 'true' ) &&
427+
always() &&
428+
((github.event_name == 'pull_request') || (github.event_name == 'pull_request_review')) &&
429+
(( needs.determine-test-scope.outputs.pr_approval_state == 'true' ) &&
428430
( needs.determine-test-scope.outputs.local_tests == 'true' ) ||
429-
( needs.determine-test-scope.outputs.remote_tests == 'true' )
431+
( needs.determine-test-scope.outputs.remote_tests == 'true' ))
430432
needs: [local-tests, remote-tests, lint, verify-schema-change]
431433
runs-on: ubuntu-latest
432434
steps:

.pre-commit-config.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,3 @@ repos:
66
args: [ --fix ]
77
- id: ruff-format
88

9-
- repo: local
10-
hooks:
11-
- id: regenerate-schema
12-
name: regenerate-schema
13-
entry: python scripts/regenerate_schema.py
14-
language: system
15-
files: ^tidy3d/.*\.py$ # Run only when Python files in the core 'tidy3d' directory are modified.
16-
stages: [pre-commit] # Explicitly run during the commit stage.

0 commit comments

Comments
 (0)