Skip to content

Commit e6b2b38

Browse files
new flow working?
1 parent 3594f0c commit e6b2b38

File tree

7 files changed

+920
-815
lines changed

7 files changed

+920
-815
lines changed

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

Lines changed: 3 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ on:
1717
description: 'Deploy to production PyPI'
1818
type: boolean
1919
default: false
20-
21-
deploy_aws:
22-
description: 'Deploy to AWS CodeArtifact'
23-
type: boolean
24-
default: false
2520

2621
workflow_call:
2722
inputs:
@@ -35,16 +30,10 @@ on:
3530
deploy_pypi:
3631
type: boolean
3732
default: false
38-
deploy_aws:
39-
type: boolean
40-
default: false
4133

4234
permissions:
4335
contents: read
4436

45-
env:
46-
AWS_REGION: "us-east-1"
47-
4837
jobs:
4938
validate-inputs:
5039
name: validate-deployment-inputs
@@ -53,12 +42,10 @@ jobs:
5342
release_tag: ${{ env.RELEASE_TAG }}
5443
deploy_testpypi: ${{ env.DEPLOY_TESTPYPI }}
5544
deploy_pypi: ${{ env.DEPLOY_PYPI }}
56-
deploy_aws: ${{ env.DEPLOY_AWS }}
5745
env:
5846
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release_tag || inputs.release_tag }}
5947
DEPLOY_TESTPYPI: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_testpypi || inputs.deploy_testpypi }}
6048
DEPLOY_PYPI: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_pypi || inputs.deploy_pypi }}
61-
DEPLOY_AWS: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_aws || inputs.deploy_aws }}
6249
steps:
6350
- name: validate-inputs
6451
run: |
@@ -67,11 +54,10 @@ jobs:
6754
echo "Release tag: $RELEASE_TAG"
6855
echo "Deploy to TestPyPI: $DEPLOY_TESTPYPI"
6956
echo "Deploy to PyPI: $DEPLOY_PYPI"
70-
echo "Deploy to AWS CodeArtifact: $DEPLOY_AWS"
7157
echo ""
7258
7359
# Validate at least one target is selected
74-
if [[ "$DEPLOY_TESTPYPI" != "true" && "$DEPLOY_PYPI" != "true" && "$DEPLOY_AWS" != "true" ]]; then
60+
if [[ "$DEPLOY_TESTPYPI" != "true" && "$DEPLOY_PYPI" != "true" ]]; then
7561
echo "Error: At least one deployment target must be selected"
7662
exit 1
7763
fi
@@ -203,80 +189,11 @@ jobs:
203189
# dist/*
204190
# echo ""
205191
# echo "Successfully published to PyPI"
206-
# echo " View at: https://pypi.org/project/tidy3d/"
207-
208-
deploy-aws-codeartifact:
209-
name: deploy-to-aws-codeartifact
210-
needs: [validate-inputs, build-package]
211-
if: |
212-
always() &&
213-
needs.validate-inputs.outputs.deploy_aws == 'true' &&
214-
needs.build-package.result == 'success'
215-
runs-on: ubuntu-latest
216-
steps:
217-
- name: download-artifacts
218-
uses: actions/download-artifact@v4
219-
with:
220-
name: dist-${{ needs.validate-inputs.outputs.release_tag }}
221-
path: dist/
222-
223-
- name: setup-python
224-
uses: actions/setup-python@v5
225-
with:
226-
python-version: '3.10'
227-
228-
- name: install-twine
229-
run: |
230-
python -m pip install --upgrade pip
231-
python -m pip install twine
232-
233-
- name: configure-aws-credentials
234-
uses: aws-actions/configure-aws-credentials@v4
235-
with:
236-
aws-region: ${{ env.AWS_REGION }}
237-
aws-access-key-id: ${{ secrets.AWS_CODEARTIFACT_ACCESS_KEY }}
238-
aws-secret-access-key: ${{ secrets.AWS_CODEARTIFACT_ACCESS_SECRET }}
239-
240-
- name: configure-codeartifact-package
241-
run: |
242-
echo "Configuring CodeArtifact package settings..."
243-
aws codeartifact put-package-origin-configuration \
244-
--domain flexcompute \
245-
--repository pypi-releases \
246-
--format pypi \
247-
--package tidy3d \
248-
--restrictions '{"publish":"ALLOW", "upstream":"BLOCK"}'
249-
250-
- name: get-codeartifact-token
251-
run: |
252-
echo "Getting CodeArtifact authorization token..."
253-
CODEARTIFACT_AUTH_TOKEN=$(aws codeartifact get-authorization-token \
254-
--domain flexcompute \
255-
--domain-owner 625554095313 \
256-
--region us-east-1 \
257-
--query authorizationToken \
258-
--output text)
259-
echo "CODEARTIFACT_AUTH_TOKEN=${CODEARTIFACT_AUTH_TOKEN}" >> $GITHUB_ENV
260-
261-
262-
- name: publish-to-codeartifact
263-
env:
264-
TWINE_PASSWORD: ${{ env.CODEARTIFACT_AUTH_TOKEN }}
265-
run: |
266-
echo "Publishing to AWS CodeArtifact..."
267-
# zizmor: ignore[use-trusted-publishing]
268-
python -m twine upload \
269-
--repository-url https://flexcompute-625554095313.d.codeartifact.us-east-1.amazonaws.com/pypi/pypi-releases/ \
270-
--verbose \
271-
-u aws \
272-
-p "$TWINE_PASSWORD" \
273-
dist/*
274-
echo ""
275-
echo "Successfully published to AWS CodeArtifact"
192+
# echo " View at: https://pypi.org/project/tidy3d/"
276193

277194
deployment-summary:
278195
name: deployment-summary
279-
needs: [validate-inputs, build-package, deploy-testpypi, deploy-pypi, deploy-aws-codeartifact]
196+
needs: [validate-inputs, build-package, deploy-testpypi, deploy-pypi]
280197
if: always()
281198
runs-on: ubuntu-latest
282199
steps:
@@ -286,18 +203,15 @@ jobs:
286203
BUILD_RESULT: ${{ needs.build-package.result }}
287204
TESTPYPI_RESULT: ${{ needs.deploy-testpypi.result }}
288205
PYPI_RESULT: ${{ needs.deploy-pypi.result }}
289-
AWS_RESULT: ${{ needs.deploy-aws-codeartifact.result }}
290206
DEPLOY_TESTPYPI: ${{ needs.validate-inputs.outputs.deploy_testpypi }}
291207
DEPLOY_PYPI: ${{ needs.validate-inputs.outputs.deploy_pypi }}
292-
DEPLOY_AWS: ${{ needs.validate-inputs.outputs.deploy_aws }}
293208
run: |
294209
echo "=== Deployment Summary ==="
295210
echo "Release Tag: ${RELEASE_TAG}"
296211
echo ""
297212
echo "Build Package: ${BUILD_RESULT}"
298213
echo "TestPyPI: ${TESTPYPI_RESULT}"
299214
echo "PyPI: ${PYPI_RESULT}"
300-
echo "AWS CodeArtifact: ${AWS_RESULT}"
301215
echo ""
302216
303217
# Check for failures
@@ -316,10 +230,6 @@ jobs:
316230
echo "PyPI deployment failed"
317231
failed=true
318232
fi
319-
if [[ "${DEPLOY_AWS}" == "true" && "${AWS_RESULT}" == "failure" ]]; then
320-
echo "AWS CodeArtifact deployment failed"
321-
failed=true
322-
fi
323233
324234
if [[ "$failed" == "true" ]]; then
325235
exit 1
Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
name: "public/tidy3d/python-client-release-tests"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_match_tests:
7+
description: 'Run version consistency checks'
8+
type: boolean
9+
default: true
10+
submodule_tests:
11+
description: 'Run submodule tests'
12+
type: boolean
13+
default: true
14+
release_tag:
15+
description: 'Release Tag to validate (e.g., v2.10.0, v2.10.0rc1)'
16+
required: false
17+
type: string
18+
default: ''
19+
20+
workflow_call:
21+
inputs:
22+
version_match_tests:
23+
description: 'Run version consistency checks'
24+
type: boolean
25+
default: true
26+
submodule_tests:
27+
description: 'Run submodule tests'
28+
type: boolean
29+
default: true
30+
release_tag:
31+
description: 'Release Tag to validate (e.g., v2.10.0, v2.10.0rc1)'
32+
required: false
33+
type: string
34+
default: ''
35+
outputs:
36+
workflow_success:
37+
description: 'Whether all release tests passed'
38+
value: ${{ jobs.workflow-validation.result == 'success' }}
39+
40+
permissions:
41+
contents: read
42+
43+
jobs:
44+
verify-version-consistency:
45+
name: verify-version-consistency
46+
runs-on: ubuntu-latest
47+
if: ${{ github.event.inputs.version_match_tests || inputs.version_match_tests }}
48+
steps:
49+
- name: checkout-code
50+
uses: actions/checkout@v4
51+
with:
52+
ref: ${{ inputs.release_tag || github.ref }}
53+
persist-credentials: false
54+
55+
- name: check-version-consistency
56+
env:
57+
RELEASE_TAG: ${{ inputs.release_tag }}
58+
run: |
59+
set -e
60+
echo "=== Verifying Version Consistency ==="
61+
echo ""
62+
63+
# Extract version from pyproject.toml
64+
PYPROJECT_VERSION=$(grep '^version = ' pyproject.toml | head -n 1 | sed 's/version = "\(.*\)"/\1/')
65+
echo "pyproject.toml version: $PYPROJECT_VERSION"
66+
67+
# Extract version from tidy3d/version.py
68+
VERSION_PY=$(grep '__version__ = ' tidy3d/version.py | sed 's/__version__ = "\(.*\)"/\1/')
69+
echo "tidy3d/version.py version: $VERSION_PY"
70+
echo ""
71+
72+
# Compare versions
73+
if [[ "$PYPROJECT_VERSION" != "$VERSION_PY" ]]; then
74+
echo "❌ ERROR: Version mismatch detected!"
75+
echo " pyproject.toml: $PYPROJECT_VERSION"
76+
echo " tidy3d/version.py: $VERSION_PY"
77+
echo ""
78+
echo "These versions must match before release."
79+
echo "Please update both files to the same version."
80+
exit 1
81+
fi
82+
83+
echo "✅ Version consistency check passed: $PYPROJECT_VERSION"
84+
echo ""
85+
86+
# If release tag provided, validate it matches the version
87+
if [[ -n "$RELEASE_TAG" ]]; then
88+
echo "=== Validating Release Tag ==="
89+
echo "Release tag: $RELEASE_TAG"
90+
91+
# Strip 'v' prefix from tag if present
92+
TAG_VERSION="${RELEASE_TAG#v}"
93+
echo "Tag version (without 'v'): $TAG_VERSION"
94+
95+
if [[ "$TAG_VERSION" != "$PYPROJECT_VERSION" ]]; then
96+
echo "❌ ERROR: Release tag does not match package version!"
97+
echo " Release tag: $RELEASE_TAG (version: $TAG_VERSION)"
98+
echo " Package version: $PYPROJECT_VERSION"
99+
echo ""
100+
echo "The release tag should be 'v$PYPROJECT_VERSION'"
101+
exit 1
102+
fi
103+
104+
echo "✅ Release tag matches package version"
105+
fi
106+
107+
echo ""
108+
echo "=== Version Checks Passed ==="
109+
110+
test-submodules:
111+
name: test-submodules
112+
runs-on: ubuntu-latest
113+
if: ${{ github.event.inputs.submodule_tests || inputs.submodule_tests }}
114+
env:
115+
RELEASE_TAG: ${{ inputs.release_tag }}
116+
steps:
117+
- name: checkout-head
118+
if: ${{ !env.RELEASE_TAG }}
119+
uses: actions/checkout@v4
120+
with:
121+
submodules: 'recursive'
122+
fetch-depth: 0
123+
persist-credentials: true
124+
125+
- name: checkout-tag
126+
if: ${{ env.RELEASE_TAG }}
127+
uses: actions/checkout@v4
128+
with:
129+
ref: ${{ env.RELEASE_TAG }}
130+
submodules: 'recursive'
131+
fetch-depth: 0
132+
persist-credentials: true
133+
134+
- name: initialize-submodules
135+
run: |
136+
git submodule update --init --recursive
137+
138+
- name: check-submodules-for-multiple-branches
139+
shell: bash
140+
run: |
141+
BRANCHES=("develop" $LATEST_BRANCH) # Add your branches here
142+
143+
for BRANCH in "${BRANCHES[@]}"; do
144+
echo "Analyzing branch: $BRANCH"
145+
146+
# Fetch all branches and tags
147+
git fetch --all --verbose
148+
149+
# Checkout the branch
150+
git checkout $BRANCH
151+
152+
NOTEBOOKS_PATH=docs/notebooks
153+
FAQ_PATH=docs/faq
154+
155+
# Checking Notebooks submodule
156+
echo "Checking $NOTEBOOKS_PATH for updates..."
157+
cd $NOTEBOOKS_PATH
158+
NOTEBOOKS_CURRENT_COMMIT=$(git rev-parse HEAD)
159+
echo $(git fetch --all --verbose)
160+
echo $(git remote get-url origin)
161+
if git show-ref --verify refs/remotes/origin/$BRANCH; then
162+
echo "Branch $BRANCH exists."
163+
else
164+
echo "::error::Branch $BRANCH does not exist on remote."
165+
exit 1
166+
fi
167+
NOTEBOOKS_LATEST_COMMIT=$(git rev-parse refs/remotes/origin/${BRANCH})
168+
echo "NOTEBOOKS_LATEST_COMMIT: $NOTEBOOKS_LATEST_COMMIT"
169+
echo "NOTEBOOKS_CURRENT_COMMIT: $NOTEBOOKS_CURRENT_COMMIT"
170+
171+
cd ../..
172+
if [ "$NOTEBOOKS_LATEST_COMMIT" != "$NOTEBOOKS_CURRENT_COMMIT" ]; then
173+
echo "::error::Submodule $NOTEBOOKS_PATH is not up to date with the $BRANCH branch. Please update it."
174+
exit 1
175+
else
176+
echo "Submodule $NOTEBOOKS_PATH is up to date with the $BRANCH branch."
177+
fi
178+
179+
# Checking FAQs only on the develop branch
180+
if [[ "$BRANCH" == "develop" ]]; then
181+
echo "Checking $FAQ_PATH for updates..."
182+
cd $FAQ_PATH
183+
FAQ_CURRENT_COMMIT=$(git rev-parse HEAD)
184+
echo $(git fetch --all --verbose)
185+
echo $(git remote get-url origin)
186+
FAQ_LATEST_COMMIT=$(git rev-parse refs/remotes/origin/develop)
187+
echo "FAQ_LATEST_COMMIT: $FAQ_LATEST_COMMIT"
188+
echo "FAQ_CURRENT_COMMIT: $FAQ_CURRENT_COMMIT"
189+
cd ../..
190+
if [ "$FAQ_LATEST_COMMIT" != "$FAQ_CURRENT_COMMIT" ]; then
191+
echo "::error::Submodule $FAQ_PATH is not up to date. Please update it."
192+
exit 1
193+
else
194+
echo "Submodule $FAQ_PATH is up to date."
195+
fi
196+
fi
197+
done
198+
199+
echo ""
200+
echo "=== Submodule Checks Passed ==="
201+
202+
workflow-validation:
203+
name: workflow-validation
204+
runs-on: ubuntu-latest
205+
if: always()
206+
needs:
207+
- verify-version-consistency
208+
- test-submodules
209+
steps:
210+
- name: check-version-consistency-result
211+
if: ${{ (github.event.inputs.version_match_tests || inputs.version_match_tests) && needs.verify-version-consistency.result != 'success' && needs.verify-version-consistency.result != 'skipped' }}
212+
run: |
213+
echo "❌ Version consistency check failed."
214+
exit 1
215+
216+
- name: check-submodule-tests-result
217+
if: ${{ (github.event.inputs.submodule_tests || inputs.submodule_tests) && needs.test-submodules.result != 'success' && needs.test-submodules.result != 'skipped' }}
218+
run: |
219+
echo "❌ Submodule tests failed."
220+
exit 1
221+
222+
- name: all-checks-passed
223+
if: ${{ success() }}
224+
run: echo "✅ All release tests passed!"

0 commit comments

Comments
 (0)