Skip to content

Commit 9921fa1

Browse files
lockfile regeneration
1 parent a9e8197 commit 9921fa1

3 files changed

Lines changed: 187 additions & 4 deletions

File tree

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
required: false
99
type: string
1010
default: ''
11+
regenerate_lockfile:
12+
description: 'Regenerate and verify lockfile'
13+
type: boolean
14+
required: false
15+
default: false
1116

1217
workflow_call:
1318
inputs:
@@ -16,6 +21,11 @@ on:
1621
required: false
1722
type: string
1823
default: ''
24+
regenerate_lockfile:
25+
description: 'Regenerate and verify lockfile'
26+
type: boolean
27+
required: false
28+
default: false
1929
outputs:
2030
workflow_success:
2131
description: 'Overall integration test workflow success status'
@@ -97,6 +107,34 @@ jobs:
97107
poetry config http-basic.codeartifact aws $CODEARTIFACT_AUTH_TOKEN
98108
echo "✅ CodeArtifact authentication configured"
99109
110+
- name: regenerate-lockfile
111+
if: github.event.inputs.regenerate_lockfile == 'true' || inputs.regenerate_lockfile == true
112+
run: |
113+
set -e
114+
echo "Backing up current poetry.lock..."
115+
cp poetry.lock poetry.lock.backup
116+
117+
echo "Regenerating poetry.lock..."
118+
poetry update --lock
119+
120+
echo "Checking for differences..."
121+
if ! diff -q poetry.lock poetry.lock.backup > /dev/null 2>&1; then
122+
echo "⚠️ poetry.lock has changed!"
123+
echo "Differences:"
124+
diff poetry.lock poetry.lock.backup || true
125+
echo "lockfile_changed=true" >> $GITHUB_ENV
126+
else
127+
echo "✅ poetry.lock is up to date"
128+
echo "lockfile_changed=false" >> $GITHUB_ENV
129+
fi
130+
131+
rm poetry.lock.backup
132+
133+
- name: warn-lockfile-changed
134+
if: (github.event.inputs.regenerate_lockfile == 'true' || inputs.regenerate_lockfile == true) && env.lockfile_changed == 'true'
135+
run: |
136+
echo "::warning::poetry.lock has changed and needs to be updated. Please run 'poetry update --lock' locally and commit the changes."
137+
100138
- name: install-project
101139
shell: bash
102140
run: |

.github/workflows/tidy3d-python-client-develop-cli.yml

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,24 @@ on:
88
required: false
99
type: string
1010
default: ''
11-
11+
regenerate_lockfile:
12+
description: 'Regenerate and verify lockfile'
13+
type: boolean
14+
required: false
15+
default: false
16+
1217
workflow_call:
1318
inputs:
1419
release_tag:
1520
description: 'Release Tag (v2.10.0, v2.10.0rc1)'
1621
required: false
1722
type: string
1823
default: ''
24+
regenerate_lockfile:
25+
description: 'Regenerate and verify lockfile'
26+
type: boolean
27+
required: false
28+
default: false
1929
outputs:
2030
workflow_success:
2131
description: 'CLI tests workflow success status'
@@ -82,6 +92,57 @@ jobs:
8292
virtualenvs-create: true
8393
virtualenvs-in-project: true
8494

95+
- name: configure-aws-credentials
96+
if: github.event.inputs.regenerate_lockfile == 'true' || inputs.regenerate_lockfile == true
97+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
98+
with:
99+
aws-access-key-id: ${{ secrets.AWS_CODEARTIFACT_ACCESS_KEY }}
100+
aws-secret-access-key: ${{ secrets.AWS_CODEARTIFACT_ACCESS_SECRET }}
101+
aws-region: us-east-1
102+
103+
- name: configure-codeartifact-authentication
104+
if: github.event.inputs.regenerate_lockfile == 'true' || inputs.regenerate_lockfile == true
105+
run: |
106+
set -e
107+
echo "Getting CodeArtifact token..."
108+
CODEARTIFACT_AUTH_TOKEN=$(aws codeartifact get-authorization-token \
109+
--domain flexcompute \
110+
--domain-owner 625554095313 \
111+
--query authorizationToken \
112+
--output text)
113+
114+
echo "Configuring Poetry with CodeArtifact credentials..."
115+
poetry config http-basic.codeartifact aws $CODEARTIFACT_AUTH_TOKEN
116+
echo "✅ CodeArtifact authentication configured"
117+
118+
- name: regenerate-lockfile
119+
if: github.event.inputs.regenerate_lockfile == 'true' || inputs.regenerate_lockfile == true
120+
run: |
121+
set -e
122+
echo "Backing up current poetry.lock..."
123+
cp poetry.lock poetry.lock.backup
124+
125+
echo "Regenerating poetry.lock..."
126+
poetry update --lock
127+
128+
echo "Checking for differences..."
129+
if ! diff -q poetry.lock poetry.lock.backup > /dev/null 2>&1; then
130+
echo "⚠️ poetry.lock has changed!"
131+
echo "Differences:"
132+
diff poetry.lock poetry.lock.backup || true
133+
echo "lockfile_changed=true" >> $GITHUB_ENV
134+
else
135+
echo "✅ poetry.lock is up to date"
136+
echo "lockfile_changed=false" >> $GITHUB_ENV
137+
fi
138+
139+
rm poetry.lock.backup
140+
141+
- name: warn-lockfile-changed
142+
if: (github.event.inputs.regenerate_lockfile == 'true' || inputs.regenerate_lockfile == true) && env.lockfile_changed == 'true'
143+
run: |
144+
echo "::warning::poetry.lock has changed and needs to be updated. Please run 'poetry update --lock' locally and commit the changes."
145+
85146
- name: Run install-dev-environment command
86147
run: |
87148
# Unsure if this is a valid command since it just guarantees things run on previous dependencies installation

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

Lines changed: 87 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ on:
2929
description: 'Run tidy3d-extras integration tests'
3030
type: boolean
3131
default: false
32+
regenerate_lockfile:
33+
description: 'Regenerate and verify lockfile'
34+
type: boolean
35+
required: false
3236
release_tag:
3337
description: 'Release Tag (v2.10.0, v2.10.0rc1)'
3438
required: false
@@ -67,6 +71,10 @@ on:
6771
type: boolean
6872
required: false
6973
default: false
74+
regenerate_lockfile:
75+
description: 'Regenerate and verify lockfile'
76+
type: boolean
77+
required: false
7078
release_tag:
7179
description: 'Release Tag (v2.10.0, v2.10.0rc1)'
7280
required: false
@@ -105,6 +113,7 @@ jobs:
105113
submodule_tests: ${{ steps.determine-test-type.outputs.submodule_tests }}
106114
version_match_tests: ${{ steps.determine-test-type.outputs.version_match_tests }}
107115
extras_integration_tests: ${{ steps.determine-test-type.outputs.extras_integration_tests }}
116+
regenerate_lockfile: ${{ steps.determine-test-type.outputs.regenerate_lockfile }}
108117
steps:
109118
- name: determine-test-type
110119
id: determine-test-type
@@ -119,6 +128,7 @@ jobs:
119128
INPUT_SUBMODULE: ${{ github.event.inputs.submodule_tests || inputs.submodule_tests }}
120129
INPUT_VERSION_MATCH: ${{ github.event.inputs.version_match_tests || inputs.version_match_tests }}
121130
INPUT_EXTRAS_INTEGRATION: ${{ github.event.inputs.extras_integration_tests || inputs.extras_integration_tests }}
131+
INPUT_REGENERATE_LOCKFILE: ${{ github.event.inputs.regenerate_lockfile || inputs.regenerate_lockfile }}
122132
run: |
123133
echo "Event: $EVENT_NAME"
124134
echo "Draft: $DRAFT_STATE"
@@ -130,6 +140,7 @@ jobs:
130140
echo "Input submodule: $INPUT_SUBMODULE"
131141
echo "Input version_match: $INPUT_VERSION_MATCH"
132142
echo "Input extras_integration: $INPUT_EXTRAS_INTEGRATION"
143+
echo "Input regenerate_lockfile: $INPUT_REGENERATE_LOCKFILE"
133144
134145
remote_tests=false
135146
local_tests=false
@@ -139,6 +150,7 @@ jobs:
139150
code_quality_tests=false
140151
pr_review_tests=false
141152
extras_integration_tests=false
153+
regenerate_lockfile=false
142154
143155
# Workflow_dispatch input override
144156
if [[ "$EVENT_NAME" == "workflow_dispatch" ]]; then
@@ -151,36 +163,52 @@ jobs:
151163
if [[ "$INPUT_LOCAL" == "true" ]]; then
152164
local_tests=true
153165
fi
154-
166+
155167
if [[ "$INPUT_CLI" == "true" ]]; then
156168
cli_tests=true
157169
fi
158-
170+
159171
if [[ "$INPUT_SUBMODULE" == "true" ]]; then
160172
submodule_tests=true
161173
fi
162-
174+
163175
if [[ "$INPUT_VERSION_MATCH" == "true" ]]; then
164176
version_match_tests=true
165177
fi
166178
167179
if [[ "$INPUT_EXTRAS_INTEGRATION" == "true" ]]; then
168180
extras_integration_tests=true
169181
fi
182+
183+
if [[ "$INPUT_REGENERATE_LOCKFILE" == "true" ]]; then
184+
regenerate_lockfile=true
185+
fi
170186
fi
171187
172188
# All PRs that have been triggered need local tests (remote reserved for merge queue/manual)
173189
if [[ "$EVENT_NAME" == "pull_request" ]]; then
174190
local_tests=true
175191
code_quality_tests=true
176192
pr_review_tests=true
193+
# Set regenerate_lockfile to true if not explicitly provided
194+
if [[ -z "$INPUT_REGENERATE_LOCKFILE" || "$INPUT_REGENERATE_LOCKFILE" == "" ]]; then
195+
regenerate_lockfile=true
196+
elif [[ "$INPUT_REGENERATE_LOCKFILE" == "true" ]]; then
197+
regenerate_lockfile=true
198+
fi
177199
fi
178200
179201
if [[ "$EVENT_NAME" == "merge_group" ]]; then
180202
local_tests=true
181203
remote_tests=true
182204
code_quality_tests=true
183205
extras_integration_tests=true
206+
# Set regenerate_lockfile to true if not explicitly provided
207+
if [[ -z "$INPUT_REGENERATE_LOCKFILE" || "$INPUT_REGENERATE_LOCKFILE" == "" ]]; then
208+
regenerate_lockfile=true
209+
elif [[ "$INPUT_REGENERATE_LOCKFILE" == "true" ]]; then
210+
regenerate_lockfile=true
211+
fi
184212
fi
185213
186214
echo "local_tests=$local_tests" >> $GITHUB_OUTPUT
@@ -191,6 +219,7 @@ jobs:
191219
echo "code_quality_tests=$code_quality_tests" >> $GITHUB_OUTPUT
192220
echo "pr_review_tests=$pr_review_tests" >> $GITHUB_OUTPUT
193221
echo "extras_integration_tests=$extras_integration_tests" >> $GITHUB_OUTPUT
222+
echo "regenerate_lockfile=$regenerate_lockfile" >> $GITHUB_OUTPUT
194223
echo "code_quality_tests=$code_quality_tests"
195224
echo "pr_review_tests=$pr_review_tests"
196225
echo "local_tests=$local_tests"
@@ -199,6 +228,7 @@ jobs:
199228
echo "submodule_tests=$submodule_tests"
200229
echo "version_match_tests=$version_match_tests"
201230
echo "extras_integration_tests=$extras_integration_tests"
231+
echo "regenerate_lockfile=$regenerate_lockfile"
202232
203233
lint:
204234
needs: determine-test-scope
@@ -723,6 +753,57 @@ jobs:
723753
with:
724754
python-version: ${{ matrix.python-version }}
725755

756+
- name: configure-aws-credentials
757+
if: needs.determine-test-scope.outputs.regenerate_lockfile == 'true'
758+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
759+
with:
760+
aws-access-key-id: ${{ secrets.AWS_CODEARTIFACT_ACCESS_KEY }}
761+
aws-secret-access-key: ${{ secrets.AWS_CODEARTIFACT_ACCESS_SECRET }}
762+
aws-region: us-east-1
763+
764+
- name: configure-codeartifact-authentication
765+
if: needs.determine-test-scope.outputs.regenerate_lockfile == 'true'
766+
run: |
767+
set -e
768+
echo "Getting CodeArtifact token..."
769+
CODEARTIFACT_AUTH_TOKEN=$(aws codeartifact get-authorization-token \
770+
--domain flexcompute \
771+
--domain-owner 625554095313 \
772+
--query authorizationToken \
773+
--output text)
774+
775+
echo "Configuring Poetry with CodeArtifact credentials..."
776+
poetry config http-basic.codeartifact aws $CODEARTIFACT_AUTH_TOKEN
777+
echo "✅ CodeArtifact authentication configured"
778+
779+
- name: regenerate-lockfile
780+
if: needs.determine-test-scope.outputs.regenerate_lockfile == 'true'
781+
run: |
782+
set -e
783+
echo "Backing up current poetry.lock..."
784+
cp poetry.lock poetry.lock.backup
785+
786+
echo "Regenerating poetry.lock..."
787+
poetry update --lock
788+
789+
echo "Checking for differences..."
790+
if ! diff -q poetry.lock poetry.lock.backup > /dev/null 2>&1; then
791+
echo "⚠️ poetry.lock has changed!"
792+
echo "Differences:"
793+
diff poetry.lock poetry.lock.backup || true
794+
echo "lockfile_changed=true" >> $GITHUB_ENV
795+
else
796+
echo "✅ poetry.lock is up to date"
797+
echo "lockfile_changed=false" >> $GITHUB_ENV
798+
fi
799+
800+
rm poetry.lock.backup
801+
802+
- name: warn-lockfile-changed
803+
if: needs.determine-test-scope.outputs.regenerate_lockfile == 'true' && env.lockfile_changed == 'true'
804+
run: |
805+
echo "::warning::poetry.lock has changed and needs to be updated. Please run 'poetry update --lock' locally and commit the changes."
806+
726807
- name: install-project
727808
shell: bash
728809
run: |
@@ -779,6 +860,8 @@ jobs:
779860
uses: ./.github/workflows/tidy3d-python-client-develop-cli.yml
780861
with:
781862
release_tag: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release_tag || inputs.release_tag }}
863+
regenerate_lockfile: ${{ needs.determine-test-scope.outputs.regenerate_lockfile == 'true' }}
864+
secrets: inherit # zizmor: ignore[secrets-inherit]
782865

783866
verify-version-consistency:
784867
name: verify-version-consistency
@@ -947,6 +1030,7 @@ jobs:
9471030
uses: ./.github/workflows/tidy3d-extras-python-client-integration-tests.yml
9481031
with:
9491032
release_tag: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release_tag || inputs.release_tag }}
1033+
regenerate_lockfile: ${{ needs.determine-test-scope.outputs.regenerate_lockfile == 'true' }}
9501034
secrets: inherit # zizmor: ignore[secrets-inherit]
9511035

9521036
workflow-validation:

0 commit comments

Comments
 (0)