Skip to content

Commit 34a3ccb

Browse files
authored
Improve update-reproducibles workflow: auto-push for internal PRs, verify for forks (aws#8714)
* update * nit * split output * checkout nightly-builds branch for running nightly tests
1 parent d6f095f commit 34a3ccb

2 files changed

Lines changed: 43 additions & 21 deletions

File tree

.github/workflows/integration-tests.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,27 @@ jobs:
7979
- tier1-finch
8080

8181
steps:
82+
- name: Determine test type
83+
run: |
84+
echo "CONTAINER_RUNTIME=${{ matrix.test_suite == 'tier1-finch' && 'finch' || 'docker' }}" >> $GITHUB_ENV
85+
if [[ "${{ inputs.install_mode }}" == "nightly-release" ]] || \
86+
[[ "${{ github.event.action }}" == "published" && "${{ github.event.release.prerelease }}" == "true" ]]; then
87+
echo "TEST_TYPE=nightly-release" >> $GITHUB_ENV
88+
elif [[ "${{ inputs.install_mode }}" == "latest-release" ]] || \
89+
[[ "${{ github.event.action }}" == "published" && "${{ github.event.release.prerelease }}" != "true" ]]; then
90+
echo "TEST_TYPE=latest-release" >> $GITHUB_ENV
91+
elif [[ "${{ github.ref }}" == "refs/heads/master" ]]; then
92+
echo "TEST_TYPE=master" >> $GITHUB_ENV
93+
elif [[ "${{ github.event_name }}" == "schedule" ]] || [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then
94+
echo "TEST_TYPE=develop" >> $GITHUB_ENV
95+
else
96+
echo "TEST_TYPE=other" >> $GITHUB_ENV
97+
fi
98+
8299
- name: Checkout code
83100
uses: actions/checkout@v6
84101
with:
85-
ref: ${{ github.event_name == 'schedule' && 'develop' || github.ref }}
102+
ref: ${{ env.TEST_TYPE == 'nightly-release' && 'nightly-builds' || (github.event_name == 'schedule' && 'develop' || github.ref) }}
86103

87104
- name: Free up disk space
88105
run: bash tests/free_disk_space.sh
@@ -196,23 +213,6 @@ jobs:
196213
if: "!contains(fromJSON('[\"build-x86-1\", \"build-x86-2\", \"build-x86-container-1\", \"build-x86-container-2\", \"tier1-finch\"]'), matrix.test_suite)"
197214
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
198215

199-
- name: Determine test type
200-
run: |
201-
echo "CONTAINER_RUNTIME=${{ matrix.test_suite == 'tier1-finch' && 'finch' || 'docker' }}" >> $GITHUB_ENV
202-
if [[ "${{ inputs.install_mode }}" == "nightly-release" ]] || \
203-
[[ "${{ github.event.action }}" == "published" && "${{ github.event.release.prerelease }}" == "true" ]]; then
204-
echo "TEST_TYPE=nightly-release" >> $GITHUB_ENV
205-
elif [[ "${{ inputs.install_mode }}" == "latest-release" ]] || \
206-
[[ "${{ github.event.action }}" == "published" && "${{ github.event.release.prerelease }}" != "true" ]]; then
207-
echo "TEST_TYPE=latest-release" >> $GITHUB_ENV
208-
elif [[ "${{ github.ref }}" == "refs/heads/master" ]]; then
209-
echo "TEST_TYPE=master" >> $GITHUB_ENV
210-
elif [[ "${{ github.event_name }}" == "schedule" ]] || [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then
211-
echo "TEST_TYPE=develop" >> $GITHUB_ENV
212-
else
213-
echo "TEST_TYPE=other" >> $GITHUB_ENV
214-
fi
215-
216216
- name: Initialize integration test
217217
if: env.TEST_TYPE == 'develop' || env.TEST_TYPE == 'master' || env.TEST_TYPE == 'other'
218218
run: |

.github/workflows/update-reproducibles.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@ on:
1010
- requirements/reproducible-win.txt
1111

1212
jobs:
13+
# For PRs from within the aws/aws-sam-cli repo: auto-update and push
1314
update-reqs:
1415
permissions:
1516
pull-requests: write
1617
contents: write
17-
if: github.repository_owner == 'aws'
18+
if: github.repository_owner == 'aws' && github.event.pull_request.head.repo.full_name == github.repository
1819
runs-on: ubuntu-latest
1920
steps:
2021
- uses: actions/checkout@v6
2122
with:
2223
ref: ${{ github.head_ref }}
24+
token: ${{ secrets.GITHUB_TOKEN }}
2325
- uses: actions/setup-python@v6
2426
with:
2527
python-version: "3.11"
@@ -31,7 +33,27 @@ jobs:
3133
run: |
3234
git config --global user.email "action@github.com"
3335
git config --global user.name "GitHub Action"
34-
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
3536
git add requirements/reproducible-*.txt
3637
git commit -m "Update reproducible requirements" || echo "nothing to commit"
37-
git push
38+
git push
39+
40+
# For PRs from forks: verify requirements are up to date, fail with instructions if not
41+
verify-up-to-date:
42+
if: github.repository_owner == 'aws' && github.event.pull_request.head.repo.full_name != github.repository
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v6
46+
- uses: actions/setup-python@v6
47+
with:
48+
python-version: "3.11"
49+
- name: Install uv
50+
uses: astral-sh/setup-uv@v7
51+
- name: Check reproducible requirements are up to date
52+
run: make update-reproducible-reqs-uv
53+
- name: Fail if requirements are out of date
54+
run: |
55+
if ! git diff --quiet requirements/reproducible-*.txt; then
56+
echo "::error::Reproducible requirements are out of date. Please run 'make update-reproducible-reqs-uv' locally and commit the changes before raising a PR."
57+
exit 1
58+
fi
59+
echo "Reproducible requirements are up to date."

0 commit comments

Comments
 (0)