-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: auto update reproducible requirements when there is a dependency change #5677
Changes from all commits
687654e
09b2c79
4c401ee
f33fe98
6b31812
5fb7727
2c3fa96
582ea7c
3739d32
e01438a
34dd507
163dea7
8758a1a
cfc8ba7
f4209a9
0539b0b
3b3018c
e0913cf
55576bd
3944819
3e7fc24
be85569
eba9651
3e2cec0
9c80d5d
4e618f7
fae3f56
d3aea9e
54c5dbb
e2dce8b
dea8b6d
5f5616c
28f4c98
671a46b
d3f240e
d82360c
538e2c5
74d059a
32b350a
8ebed17
f70f8c3
5f4ac01
db0593c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,12 +71,6 @@ jobs: | |
with: | ||
repository: aws/aws-sam-cli | ||
path: aws-sam-cli | ||
|
||
- uses: actions/setup-python@v4 # used for make update-reproducible-reqs below | ||
with: | ||
python-version: | | ||
3.8 | ||
3.11 | ||
|
||
- name: Update aws-sam-translator & commit | ||
run: | | ||
|
@@ -90,7 +84,7 @@ jobs: | |
SAM_T_PRE_VERSION=$(grep "aws-sam-translator=" requirements/base.txt) | ||
echo "SAM-T pre version is $SAM_T_PRE_VERSION" | ||
git reset --hard develop | ||
sed -i "s/$SAM_T_PRE_VERSION/aws-sam-translator==$SAM_T_CUR_VERSION/g" requirements/base.txt; make update-reproducible-reqs | ||
sed -i "s/$SAM_T_PRE_VERSION/aws-sam-translator==$SAM_T_CUR_VERSION/g" requirements/base.txt | ||
cp -r ../serverless-application-model/tests/translator/input ./tests/functional/commands/validate/lib/models | ||
git status | ||
git diff --quiet && exit 0 # exit if there is no change | ||
|
@@ -129,12 +123,6 @@ jobs: | |
repository: aws/aws-sam-cli | ||
path: aws-sam-cli | ||
|
||
- uses: actions/setup-python@v4 # used for make update-reproducible-reqs below | ||
with: | ||
python-version: | | ||
3.8 | ||
3.11 | ||
|
||
- name: Upgrade aws_lambda_builders & commit | ||
run: | | ||
git config --global user.email "[email protected]" | ||
|
@@ -147,7 +135,7 @@ jobs: | |
BUILDERS_PRE_VERSION=$(grep "aws_lambda_builders=" requirements/base.txt) | ||
echo "Lambda Builders pre version is $BUILDERS_PRE_VERSION" | ||
git reset --hard develop | ||
sed -i "s/$BUILDERS_PRE_VERSION/aws_lambda_builders==$BUILDERS_CUR_VERSION/g" requirements/base.txt; make update-reproducible-reqs | ||
sed -i "s/$BUILDERS_PRE_VERSION/aws_lambda_builders==$BUILDERS_CUR_VERSION/g" requirements/base.txt | ||
git status | ||
git diff --quiet && exit 0 # exit if there is no change | ||
echo "is_new_lambda_builders=1" >> $GITHUB_ENV # set env variable for next step run decision | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Update reproducible requirements | ||
on: | ||
pull_request: | ||
branches: [develop] | ||
paths: | ||
- requirements/base.txt # run this GHA only if requirements file is changed | ||
Comment on lines
+3
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just to make sure, we do not need this GHA to be executed in case of the dependencies got updated, or their dependencies got updated. Dependabot should handle that, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted to keep our existing flow where we update these reproducibles when we update our requirements (for example when we bump SAMT version). If we run this for every PR there is a chance that we will have updates every day or so (for minor version updates), which might make harder for those PRs getting merged, and I will leave those updates to dependabot as it is been currently handled. |
||
|
||
jobs: | ||
update-reqs: | ||
permissions: | ||
pull-requests: write | ||
contents: write | ||
if: github.repository_owner == 'aws' | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
python: 3.11 | ||
target: update-reproducible-linux-reqs | ||
- os: macos-latest | ||
python: 3.8 | ||
target: update-reproducible-mac-reqs | ||
- os: windows-latest | ||
python: 3.8 | ||
target: update-reproducible-win-reqs | ||
max-parallel: 1 | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
- run: make ${{ matrix.target }} | ||
- name: Push changes | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Action" | ||
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | ||
git commit -am "Update reproducibles: ${{ matrix.target }}" || echo "nothing to commit" | ||
Comment on lines
+40
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a general comment, butI think I had the same conversation with a team member about auto generating a JSON schema file, and whether or not this should be a message instead to manually run the generation rules, or something that Github Actions will do for us in the same PR. The wrench that is thrown here is that Windows repro generation would in theory need to happen on a Windows machine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason we put these updates into GHA is purely needing a Windows machine to update reproducibles. If these were not OS specific (like we can generate one and use it for every installer), then I would keep the existing flow where we will have a Makefile target which can be run on any OS so that contributors can run it after they update any dependency that we have. |
||
git push |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we going to update the PR itself, or update the develop branch, then we need to merge the PR branch from the develop branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will update the PR itself (see this commit for example in this PR: 32b350a)
But this GHA will only run if
requirements/base.txt
is updated (see line 6)