Skip to content

Commit 0a8c0b9

Browse files
ci: tidy3d-extras integration tests & docs
1 parent 6034853 commit 0a8c0b9

File tree

7 files changed

+1231
-51
lines changed

7 files changed

+1231
-51
lines changed
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: "public/tidy3d-extras/python-client-integration-tests"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_tag:
7+
description: 'Release Tag (v2.10.0, v2.10.0rc1)'
8+
required: false
9+
type: string
10+
default: ''
11+
12+
workflow_call:
13+
inputs:
14+
release_tag:
15+
description: 'Release Tag (v2.10.0, v2.10.0rc1)'
16+
required: false
17+
type: string
18+
default: ''
19+
outputs:
20+
workflow_success:
21+
description: 'Overall integration test workflow success status'
22+
value: ${{ jobs.integration-tests.result == 'success' }}
23+
24+
permissions:
25+
contents: read
26+
27+
jobs:
28+
integration-tests:
29+
name: python-${{ matrix.python-version }}-${{ matrix.platform }}-extras
30+
runs-on: ${{ matrix.platform }}
31+
permissions:
32+
contents: read
33+
concurrency:
34+
group: tidy3d-extras-integration-${{ github.event.pull_request.number || github.sha }}-${{ matrix.platform }}-${{ matrix.python-version }}
35+
cancel-in-progress: true
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
python-version: ['3.10', '3.13']
40+
platform: [windows-latest, ubuntu-latest, macos-latest]
41+
defaults:
42+
run:
43+
shell: bash
44+
env:
45+
PIP_ONLY_BINARY: gdstk
46+
MPLBACKEND: agg
47+
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release_tag || inputs.release_tag }}
48+
49+
steps:
50+
- name: checkout-head
51+
if: ${{ !env.RELEASE_TAG }}
52+
uses: actions/checkout@v4
53+
with:
54+
fetch-depth: 1
55+
submodules: false
56+
persist-credentials: false
57+
58+
- name: checkout-tag
59+
if: ${{ env.RELEASE_TAG }}
60+
uses: actions/checkout@v4
61+
with:
62+
ref: refs/tags/${{ env.RELEASE_TAG }}
63+
fetch-depth: 1
64+
submodules: false
65+
persist-credentials: false
66+
67+
- name: set-python-${{ matrix.python-version }}
68+
uses: actions/setup-python@v4
69+
with:
70+
python-version: ${{ matrix.python-version }}
71+
72+
- name: install-poetry
73+
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
74+
with:
75+
version: 2.1.1
76+
virtualenvs-create: true
77+
virtualenvs-in-project: true
78+
79+
- name: configure-aws-credentials
80+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
81+
with:
82+
aws-access-key-id: ${{ secrets.AWS_CODEARTIFACT_ACCESS_KEY }}
83+
aws-secret-access-key: ${{ secrets.AWS_CODEARTIFACT_ACCESS_SECRET }}
84+
aws-region: us-east-1
85+
86+
- name: configure-codeartifact-authentication
87+
run: |
88+
set -e
89+
echo "Getting CodeArtifact token..."
90+
CODEARTIFACT_AUTH_TOKEN=$(aws codeartifact get-authorization-token \
91+
--domain flexcompute \
92+
--domain-owner 625554095313 \
93+
--query authorizationToken \
94+
--output text)
95+
96+
echo "Configuring Poetry with CodeArtifact credentials..."
97+
poetry config http-basic.codeartifact aws $CODEARTIFACT_AUTH_TOKEN
98+
echo "✅ CodeArtifact authentication configured"
99+
100+
- name: install-project
101+
shell: bash
102+
run: |
103+
poetry --version
104+
python --version
105+
python -m venv .venv
106+
if [[ "${{ runner.os }}" == "Windows" ]]; then
107+
source .venv/Scripts/activate
108+
python --version
109+
else
110+
source .venv/bin/activate
111+
which python
112+
fi
113+
poetry env use python
114+
poetry env info
115+
poetry run pip install --upgrade pip wheel setuptools
116+
poetry run pip install gdstk --only-binary gdstk
117+
poetry install -E extras -E dev
118+
119+
- name: verify-extras-installation
120+
run: |
121+
export SIMCLOUD_APIKEY=${{ secrets.TIDY3D_API_KEY }}
122+
poetry run tidy3d configure --apikey ${{ secrets.TIDY3D_API_KEY }}
123+
poetry run python -c "import tidy3d; print(f'tidy3d version: {tidy3d.__version__}')"
124+
poetry run python -c "import tidy3d_extras; print(f'tidy3d-extras version: {tidy3d_extras.__version__}')"
125+
cd tests/
126+
poetry run pytest tidy3d_extras_license_test.py
127+
128+
- name: run-doctests
129+
run: |
130+
export SIMCLOUD_APIKEY=${{ secrets.TIDY3D_API_KEY }}
131+
poetry run tidy3d configure --apikey ${{ secrets.TIDY3D_API_KEY }}
132+
poetry run pytest -rF --tb=short tidy3d
133+
134+
- name: run-tests-coverage
135+
env:
136+
PYTHONUNBUFFERED: "1"
137+
run: |
138+
export SIMCLOUD_APIKEY=${{ secrets.TIDY3D_API_KEY }}
139+
poetry run tidy3d configure --apikey ${{ secrets.TIDY3D_API_KEY }}
140+
poetry run pytest --cov=tidy3d -rF --tb=short tests/_test_data/_test_datasets_no_vtk.py
141+
poetry run pytest --cov=tidy3d -rF --tb=short tests
142+
poetry run coverage report -m
143+
TOTAL_COVERAGE=$(poetry run coverage report --format=total)
144+
echo "total=$TOTAL_COVERAGE" >> "$GITHUB_ENV"
145+
echo "### Total coverage: ${TOTAL_COVERAGE}%"

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,18 @@ jobs:
1717
with:
1818
run-workflow: true
1919

20-
submodule-tests:
21-
uses: ./.github/workflows/tidy3d-python-client-submodules-test.yml
20+
daily-release:
21+
uses: ./.github/workflows/tidy3d-python-client-release.yml
22+
permissions:
23+
contents: write
24+
pull-requests: write
25+
security-events: write
26+
id-token: write
2227
with:
23-
run-workflow: true
28+
release_tag: 'daily-0.0.0'
29+
release_type: 'draft'
30+
workflow_control: 'start-tag'
31+
client_tests: true
32+
cli_tests: true
33+
submodule_tests: false
34+
secrets: inherit # zizmor: ignore[secrets-inherit]

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

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,27 @@ on:
1414
type: boolean
1515
default: false
1616
cli_tests:
17-
description: 'Run develop-cli tests'
17+
description: 'develop-cli'
1818
type: boolean
1919
default: false
2020
submodule_tests:
21-
description: 'Run submodule tests'
21+
description: 'submodule-tests'
2222
type: boolean
2323
default: false
2424
version_match_tests:
25-
description: 'Run version consistency checks'
25+
description: 'version-consistency-checks'
26+
type: boolean
27+
default: false
28+
extras_integration_tests:
29+
description: 'integration-tidy3d-extras'
2630
type: boolean
2731
default: false
2832
release_tag:
2933
description: 'Release Tag (v2.10.0, v2.10.0rc1)'
3034
required: false
3135
type: string
3236
default: ''
33-
37+
3438
workflow_call:
3539
inputs:
3640
remote_tests:
@@ -58,6 +62,11 @@ on:
5862
type: boolean
5963
required: false
6064
default: false
65+
extras_integration_tests:
66+
description: 'Run tidy3d-extras integration tests'
67+
type: boolean
68+
required: false
69+
default: false
6170
release_tag:
6271
description: 'Release Tag (v2.10.0, v2.10.0rc1)'
6372
required: false
@@ -95,6 +104,7 @@ jobs:
95104
cli_tests: ${{ steps.determine-test-type.outputs.cli_tests }}
96105
submodule_tests: ${{ steps.determine-test-type.outputs.submodule_tests }}
97106
version_match_tests: ${{ steps.determine-test-type.outputs.version_match_tests }}
107+
extras_integration_tests: ${{ steps.determine-test-type.outputs.extras_integration_tests }}
98108
steps:
99109
- name: determine-test-type
100110
id: determine-test-type
@@ -108,6 +118,7 @@ jobs:
108118
INPUT_CLI: ${{ github.event.inputs.cli_tests || inputs.cli_tests }}
109119
INPUT_SUBMODULE: ${{ github.event.inputs.submodule_tests || inputs.submodule_tests }}
110120
INPUT_VERSION_MATCH: ${{ github.event.inputs.version_match_tests || inputs.version_match_tests }}
121+
INPUT_EXTRAS_INTEGRATION: ${{ github.event.inputs.extras_integration_tests || inputs.extras_integration_tests }}
111122
run: |
112123
echo "Event: $EVENT_NAME"
113124
echo "Draft: $DRAFT_STATE"
@@ -118,6 +129,7 @@ jobs:
118129
echo "Input cli: $INPUT_CLI"
119130
echo "Input submodule: $INPUT_SUBMODULE"
120131
echo "Input version_match: $INPUT_VERSION_MATCH"
132+
echo "Input extras_integration: $INPUT_EXTRAS_INTEGRATION"
121133
122134
remote_tests=false
123135
local_tests=false
@@ -126,6 +138,7 @@ jobs:
126138
version_match_tests=false
127139
code_quality_tests=false
128140
pr_review_tests=false
141+
extras_integration_tests=false
129142
130143
# Workflow_dispatch input override
131144
if [[ "$EVENT_NAME" == "workflow_dispatch" ]]; then
@@ -150,6 +163,10 @@ jobs:
150163
if [[ "$INPUT_VERSION_MATCH" == "true" ]]; then
151164
version_match_tests=true
152165
fi
166+
167+
if [[ "$INPUT_EXTRAS_INTEGRATION" == "true" ]]; then
168+
extras_integration_tests=true
169+
fi
153170
fi
154171
155172
# All PRs that have been triggered need local tests (remote reserved for merge queue/manual)
@@ -163,6 +180,7 @@ jobs:
163180
local_tests=true
164181
remote_tests=true
165182
code_quality_tests=true
183+
extras_integration_tests=true
166184
fi
167185
168186
echo "local_tests=$local_tests" >> $GITHUB_OUTPUT
@@ -172,13 +190,15 @@ jobs:
172190
echo "version_match_tests=$version_match_tests" >> $GITHUB_OUTPUT
173191
echo "code_quality_tests=$code_quality_tests" >> $GITHUB_OUTPUT
174192
echo "pr_review_tests=$pr_review_tests" >> $GITHUB_OUTPUT
193+
echo "extras_integration_tests=$extras_integration_tests" >> $GITHUB_OUTPUT
175194
echo "code_quality_tests=$code_quality_tests"
176195
echo "pr_review_tests=$pr_review_tests"
177196
echo "local_tests=$local_tests"
178197
echo "remote_tests=$remote_tests"
179198
echo "cli_tests=$cli_tests"
180199
echo "submodule_tests=$submodule_tests"
181200
echo "version_match_tests=$version_match_tests"
201+
echo "extras_integration_tests=$extras_integration_tests"
182202
183203
lint:
184204
needs: determine-test-scope
@@ -919,7 +939,16 @@ jobs:
919939
920940
echo ""
921941
echo "=== Submodule Checks Passed ==="
922-
942+
943+
extras-integration-tests:
944+
name: extras-integration-tests
945+
needs: determine-test-scope
946+
if: needs.determine-test-scope.outputs.extras_integration_tests == 'true'
947+
uses: ./.github/workflows/tidy3d-extras-python-client-tests-integration.yml
948+
with:
949+
release_tag: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release_tag || inputs.release_tag }}
950+
secrets: inherit # zizmor: ignore[secrets-inherit]
951+
923952
workflow-validation:
924953
name: workflow-validation
925954
if: always()
@@ -936,6 +965,7 @@ jobs:
936965
- develop-cli-tests
937966
- verify-version-consistency
938967
- test-submodules
968+
- extras-integration-tests
939969
runs-on: ubuntu-latest
940970
steps:
941971
- name: check-linting-result
@@ -1004,6 +1034,12 @@ jobs:
10041034
echo "❌ Submodule tests failed."
10051035
exit 1
10061036
1037+
- name: check-extras-integration-tests-result
1038+
if: ${{ needs.determine-test-scope.outputs.extras_integration_tests == 'true' && needs.extras-integration-tests.result != 'success' && needs.extras-integration-tests.result != 'skipped' }}
1039+
run: |
1040+
echo "❌ tidy3d-extras integration tests failed."
1041+
exit 1
1042+
10071043
- name: all-checks-passed
10081044
if: ${{ success() }}
10091045
run: echo "✅ All required jobs passed!"

.github/workflows/tidy3d-python-client-update-lockfile.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
required: true
99
type: boolean
1010
default: true
11+
source_branch:
12+
description: 'Source branch to checkout and update lockfile for'
13+
required: false
14+
type: string
15+
default: 'develop'
1116

1217
workflow_call:
1318
inputs:
@@ -16,6 +21,11 @@ on:
1621
required: true
1722
type: boolean
1823
default: true
24+
source_branch:
25+
description: 'Source branch to checkout and update lockfile for'
26+
required: false
27+
type: string
28+
default: 'develop'
1929

2030
permissions:
2131
contents: read
@@ -31,6 +41,7 @@ jobs:
3141
- name: Checkout repository
3242
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
3343
with:
44+
ref: ${{ github.event.inputs.source_branch || inputs.source_branch || 'develop' }}
3445
fetch-depth: 1
3546
submodules: false
3647
persist-credentials: false
@@ -76,12 +87,14 @@ jobs:
7687
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e #v7.0.8
7788
with:
7889
token: ${{ secrets.GITHUB_TOKEN }}
79-
commit-message: "chore(deps): :robot: Daily update `poetry.lock`"
80-
title: "chore(deps): :robot: Daily update `poetry.lock`"
90+
commit-message: "chore(deps): :robot: Update `poetry.lock` for ${{ github.event.inputs.source_branch || inputs.source_branch || 'develop' }}"
91+
title: "chore(deps): :robot: Update `poetry.lock` for ${{ github.event.inputs.source_branch || inputs.source_branch || 'develop' }}"
8192
body: |
8293
This pull request was automatically generated by a GitHub Action.
8394
8495
It updates the `poetry.lock` file to reflect changes in the pip state, and whether the package is broken by external dependency changes.
85-
branch: "daily-chore/update-poetry-lock"
86-
base: "develop"
96+
97+
Source branch: ${{ github.event.inputs.source_branch || inputs.source_branch || 'develop' }}
98+
branch: "chore/update-poetry-lock-${{ github.event.inputs.source_branch || inputs.source_branch || 'develop' }}"
99+
base: "${{ github.event.inputs.source_branch || inputs.source_branch || 'develop' }}"
87100
delete-branch: true

dev.Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ RUN apt-get update && \
88
git \
99
pandoc \
1010
xsel \
11+
groff \
12+
mandoc \
1113
xclip
1214

1315
RUN apt-get update && apt-get install -y zip unzip curl \
@@ -20,6 +22,7 @@ RUN apt-get update && apt-get install -y zip unzip curl \
2022
ENV POETRY_HOME=/opt/poetry
2123
RUN curl -sSL https://install.python-poetry.org | python3 -
2224
ENV PATH="/root/.local/bin:${POETRY_HOME}/bin:${PATH}"
25+
RUN poetry self add poetry-codeartifact-login
2326

2427
RUN apt-get update && DEBIAN_FRONTEND="noninteractive" TZ="America/New_York" apt-get install -y curl \
2528
&& curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz \

0 commit comments

Comments
 (0)