- Notifications
You must be signed in to change notification settings - Fork70
Fix release checksums.txt artifact generation#446
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
rvermeulen merged 9 commits intogithub:mainfromrvermeulen:rvermeulen/fix-release-checksums-generationNov 23, 2023
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
9 commits Select commitHold shift + click to select a range
38ed8ca Apply sha256 on the root directory of the layout
rvermeulen2914177 Trim whitespace
rvermeulena95ada7 Address incorrect return type
rvermeulen4348f8e Rename update release assets script
rvermeulen552a7b6 Add test for update release assets script
rvermeulen12ef22d Rewrite the checksums.txt file to keep the base names
rvermeulen949b0a2 Refrain from using inplace substitution
rvermeulen5393ac1 Disable skipping of tests
rvermeulen43ade57 Adjust sed command for Action runner
rvermeulenFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
19 changes: 19 additions & 0 deletions.github/workflows/tooling-unit-tests.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions.github/workflows/update-release.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletionscripts/release/release-layout.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletionscripts/release/requirements.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| semantic-version==2.10.0 | ||
| PyGithub==1.59.1 | ||
| PyYAML==6.0.1 | ||
| GitPython==3.1.36 | ||
| pytest==7.4.3 |
19 changes: 19 additions & 0 deletionsscripts/release/test-data/release-layout.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| version: 0.1.0 | ||
| layout: | ||
| hello-world.txt: | ||
| - shell: | | ||
| echo "hello world!" > hello-world.txt | ||
| hello-world.zip: | ||
| - shell: | | ||
| echo "hello!" > hello.txt | ||
| echo "world!" > world.txt | ||
| # reset the creation and modification times to a fixed value | ||
| touch -a -m -t 197001010000.00 hello.txt world.txt | ||
| checksums.txt: | ||
| - shell: | | ||
| shasum -a 256 ${{ layout.root }}/* > checksums.txt | ||
| # Remove the layout root from the checksums.txt | ||
| # We don't use inplace because of BSD vs GNU shenanigans | ||
| sed -e "s|${{ layout.root }}/||g" checksums.txt > checksums-rewritten.txt | ||
| mv checksums-rewritten.txt checksums.txt |
60 changes: 38 additions & 22 deletionsscripts/release/update-release-assets.py → scripts/release/update_release_assets.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletionsscripts/release/update_release_assets_test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| from pathlib import Path | ||
| from tempfile import TemporaryDirectory | ||
| import yaml | ||
| from update_release_assets import ReleaseLayout | ||
| SCRIPT_PATH = Path(__file__) | ||
| TEST_DIR = SCRIPT_PATH.parent / 'test-data' | ||
| def test_release_layout(): | ||
| spec = TEST_DIR / 'release-layout.yml' | ||
| release_layout = ReleaseLayout(spec) | ||
| with TemporaryDirectory() as tmp_dir: | ||
| tmp_path = Path(tmp_dir) | ||
| release_layout.make(tmp_path, []) | ||
| for artifact in yaml.safe_load(spec.read_text())['layout'].keys(): | ||
| artifact_path = tmp_path / artifact | ||
| assert artifact_path.is_file() | ||
| if artifact == "hello-world.txt": | ||
| content = artifact_path.read_text() | ||
| assert content == "hello world!\n" | ||
| if artifact == "checksums.txt": | ||
| content = artifact_path.read_text() | ||
| # The hash of the hello-world.txt is deterministic, so we can assert it here. | ||
| assert "ecf701f727d9e2d77c4aa49ac6fbbcc997278aca010bddeeb961c10cf54d435a hello-world.txt" in content | ||
| # The has of the hello-world.zip is not deterministic, so we can't assert its hash. | ||
| assert "hello-world.zip" in content | ||
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.