Repository navigation
ci: check for new Ruby releases hourly without a checkout #79
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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,90 @@ | ||
| #!/usr/bin/env bash | ||
| # Exercises the `check` job of .github/workflows/autobump.yml against fixtures. | ||
| # | ||
| # The job's script is extracted from the workflow, so this tests the code that | ||
| # runs in CI. `git ls-remote` and `curl` are stubbed with fixture files; `yq` | ||
| # is the real one (preinstalled on GitHub runners). The stub also emits a peeled | ||
| # (^{}) entry for every tag, as ls-remote does for annotated tags. | ||
| set -euo pipefail | ||
|
|
||
| root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) | ||
| work=$(mktemp -d) | ||
| trap 'rm -rf "$work"' EXIT | ||
|
|
||
| ruby -ryaml -e ' | ||
| steps = YAML.load_file(ARGV.fetch(0)).fetch("jobs").fetch("check").fetch("steps") | ||
| puts steps.find { |s| s["id"] == "compare" }.fetch("run") | ||
| ' "$root/.github/workflows/autobump.yml" > "$work/check.sh" | ||
|
|
||
| mkdir "$work/bin" | ||
| cat > "$work/bin/git" <<'STUB' | ||
| #!/usr/bin/env bash | ||
| [ "$1" = ls-remote ] || { echo "unexpected git $*" >&2; exit 1; } | ||
| while read -r tag; do | ||
| printf '0000000000000000000000000000000000000000\trefs/tags/%s\n' "$tag" | ||
| printf '1111111111111111111111111111111111111111\trefs/tags/%s^{}\n' "$tag" | ||
| done < "$FIXTURE_TAGS" | ||
| STUB | ||
| cat > "$work/bin/curl" <<'STUB' | ||
| #!/usr/bin/env bash | ||
| cat "$FIXTURE_RECIPES" | ||
| STUB | ||
| chmod +x "$work/bin/git" "$work/bin/curl" | ||
|
|
||
| failures=0 | ||
|
|
||
| # run_check NAME EXPECTED "TAGS (space separated)" "RECIPE VERSIONS (space separated)" | ||
| run_check() { | ||
| local name=$1 expected=$2 tags=$3 recipes=$4 | ||
| # shellcheck disable=SC2086 | ||
| printf '%s\n' $tags > "$work/tags" | ||
| { | ||
| echo "schema: 1" | ||
| echo "rubies:" | ||
| for v in $recipes; do echo " $v:"; echo " series: x"; done | ||
| } > "$work/recipes.yml" | ||
| : > "$work/output" | ||
| FIXTURE_TAGS="$work/tags" FIXTURE_RECIPES="$work/recipes.yml" GITHUB_OUTPUT="$work/output" \ | ||
| PATH="$work/bin:$PATH" RECIPES_URL=unused \ | ||
| bash -eo pipefail "$work/check.sh" > "$work/log" 2>&1 || { cat "$work/log"; echo "FAIL $name: script errored"; failures=$((failures + 1)); return; } | ||
| local got | ||
| got=$(sed -n 's/^needs_bump=//p' "$work/output") | ||
| if [ "$got" = "$expected" ]; then | ||
| echo "ok $name" | ||
| else | ||
| cat "$work/log" | ||
| echo "FAIL $name: expected needs_bump=$expected, got '$got'" | ||
| failures=$((failures + 1)) | ||
| fi | ||
| } | ||
|
|
||
| old="v1_9_3_551 v2_7_8 v3_1_6 v3_2_0_rc1 v3_3_0_preview1" | ||
| both="v3_2_11 v3_3_13 v3_4_12 v4.0.9" | ||
|
|
||
| run_check "recipes are current" false \ | ||
| "$old $both" "3.2.11 3.3.13 3.4.12 4.0.9" | ||
| run_check "new stable, underscore tag" true \ | ||
| "$old $both v3_4_13" "3.2.11 3.3.13 3.4.12 4.0.9" | ||
| run_check "new stable, dotted tag" true \ | ||
| "$old $both v4.0.10" "3.2.11 3.3.13 3.4.12 4.0.9" | ||
| run_check "only the newest stable per series is required" false \ | ||
| "$old $both" "3.2.11 3.3.13 3.4.12 4.0.9" | ||
| run_check "older patch missing, newest present" false \ | ||
| "v3_4_11 v3_4_12" "3.4.12" | ||
| run_check "series older than 3.2 are ignored" false \ | ||
| "$old v3_1_7 $both" "3.2.11 3.3.13 3.4.12 4.0.9" | ||
| run_check "new prerelease, underscore tag" true \ | ||
| "$both v4_2_0_preview1" "3.2.11 3.3.13 3.4.12 4.0.9" | ||
| run_check "new prerelease, dotted tag" true \ | ||
| "$both v4.2.0-preview1" "3.2.11 3.3.13 3.4.12 4.0.9" | ||
| run_check "new rc, underscore tag" true \ | ||
| "$both v4_2_0_rc1" "3.2.11 3.3.13 3.4.12 4.0.9" | ||
| run_check "recorded prerelease" false \ | ||
| "$both v4_2_0_preview1 v4.3.0-preview2" "3.2.11 3.3.13 3.4.12 4.0.9 4.2.0-preview1 4.3.0-preview2" | ||
| run_check "prerelease in a series that has a stable release" false \ | ||
| "$both v3_4_0_rc1 v3_4_0_preview1 v4.0.0-preview3" "3.2.11 3.3.13 3.4.12 4.0.9" | ||
|
|
||
| if [ "$failures" -ne 0 ]; then | ||
| echo "$failures check(s) failed" | ||
| exit 1 | ||
| fi |
Oops, something went wrong.
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.
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.
Bundled gems check runs weekly only
Medium Severity
The
bundled-gemsjob is now tied to the Monday-only cron47 4 * * 1, so gem pin updates can sit for up to a week. The previous workflow ran that bump twice a day, and this change was meant to keep that cadence while moving gems into their own job.Reviewed by Cursor Bugbot for commit 84cd04d. Configure here.