Skip to content

Commit bb0748c

Browse files
justin808claudeclaude[bot]
authored
fix: merge setup-gem-tests-matrix job into detect-changes (#3135)
## Summary - Moves the `setup-gem-tests-matrix` job's 3-line matrix setup logic into the `detect-changes` job as an additional step - Eliminates one runner queue hop, saving 2-10 minutes per CI run - `rspec-package-tests` now depends only on `detect-changes` instead of both jobs Closes #3130 ## Test plan - [ ] Verify CI runs successfully on this PR (the gem-tests workflow should trigger) - [ ] Confirm `rspec-package-tests` picks up the matrix from `detect-changes` correctly 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > CI workflow logic and job dependencies were changed, which could inadvertently skip or misconfigure test runs if the new outputs/matrix generation is incorrect. Actionlint version resolution now depends on authenticated API access plus a pinned fallback, which is low-risk but could affect caching/download behavior. > > **Overview** > Improves `actionlint` workflow robustness by switching the release lookup to an authenticated GitHub API call and adding a pinned fallback (`v1.7.7`) when the API call or tag parsing fails, keeping cache keys and downloads stable. > > Streamlines `gem-tests` by generating the RSpec matrix inside `detect-changes` (exported as a job output) and removing the separate `setup-gem-tests-matrix` job; `rspec-package-tests` now depends only on `detect-changes` and consumes `needs.detect-changes.outputs.matrix`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 231b17f. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Improved workflow reliability for tool version lookup by consolidating request/response handling, using authenticated requests, and falling back to a pinned version on failure. * Streamlined CI test orchestration by generating and exporting test matrices within a single job, removing intermediate jobs and simplifying downstream job dependencies. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
1 parent 4eb8364 commit bb0748c

2 files changed

Lines changed: 26 additions & 24 deletions

File tree

.github/workflows/actionlint.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,21 @@ jobs:
4949
5050
if git diff --name-only "$DIFF_BASE" ${{ github.sha }} 2>/dev/null | grep -q '^.github/workflows'; then
5151
echo "changed=true" >> "$GITHUB_OUTPUT"
52-
response=$(curl -sf https://api.github.com/repos/rhysd/actionlint/releases/latest)
53-
if [ $? -eq 0 ]; then
52+
# Pinned fallback used when the GitHub API call fails (rate limit / outage)
53+
# so the cache key stays stable and the download step still has a version to pin to.
54+
echo "::warning::GitHub API unavailable; falling back to pinned actionlint $fallback_version. Consider updating this pin."
55+
fallback_version="v1.7.7"
56+
if response=$(curl -sf -H "Authorization: token ${{ github.token }}" https://api.github.com/repos/rhysd/actionlint/releases/latest); then
5457
actionlint_version=$(echo "$response" | jq -r .tag_name)
55-
if [ -z "$actionlint_version" ]; then
56-
echo "Failed to parse Actionlint version"
57-
exit 1
58+
if [ -z "$actionlint_version" ] || [ "$actionlint_version" = "null" ]; then
59+
echo "Failed to parse Actionlint version; using pinned fallback $fallback_version"
60+
actionlint_version="$fallback_version"
5861
fi
59-
echo "actionlint_version=\"$actionlint_version\"" >> "$GITHUB_OUTPUT"
62+
else
63+
echo "curl to GitHub API failed; using pinned fallback $fallback_version"
64+
actionlint_version="$fallback_version"
6065
fi
66+
echo "actionlint_version=$actionlint_version" >> "$GITHUB_OUTPUT"
6167
fi
6268
- name: Setup Actionlint
6369
if: steps.check-workflows.outputs.changed == 'true'

.github/workflows/gem-tests.yml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444
run_dummy_tests: ${{ steps.detect.outputs.run_dummy_tests }}
4545
run_generators: ${{ steps.detect.outputs.run_generators }}
4646
has_full_ci_label: ${{ steps.check-label.outputs.result }}
47+
matrix: ${{ steps.set-matrix.outputs.matrix }}
4748
steps:
4849
- uses: actions/checkout@v4
4950
with:
@@ -70,36 +71,31 @@ jobs:
7071
BASE_REF="${{ github.event.pull_request.base.sha || github.event.before || 'origin/main' }}"
7172
script/ci-changes-detector "$BASE_REF"
7273
shell: bash
73-
- name: Guard docs-only main pushes
74-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
75-
uses: ./.github/actions/ensure-main-docs-safety
76-
with:
77-
docs-only: ${{ steps.detect.outputs.docs_only }}
78-
previous-sha: ${{ github.event.before }}
79-
80-
setup-gem-tests-matrix:
81-
needs: detect-changes
82-
runs-on: ubuntu-22.04
83-
outputs:
84-
matrix: ${{ steps.set-matrix.outputs.matrix }}
85-
steps:
86-
- id: set-matrix
74+
- name: Set gem tests matrix
75+
id: set-matrix
8776
run: |
8877
# Determine if we should run full matrix (main or full-ci label)
8978
# Each Ruby version / dependency level is split into two shards:
9079
# generators – spec/react_on_rails/generators (heavy filesystem I/O)
9180
# unit – everything else under spec/react_on_rails
9281
if [[ "${{ github.ref }}" == "refs/heads/main" ]] || \
93-
[[ "${{ needs.detect-changes.outputs.has_full_ci_label }}" == "true" ]]; then
82+
[[ "${{ steps.check-label.outputs.result }}" == "true" ]] || \
83+
[[ "${{ inputs.force_run }}" == "true" ]]; then
9484
# Full matrix: test both latest and minimum supported versions × 2 shards
9585
echo 'matrix={"include":[{"ruby-version":"3.4","dependency-level":"latest","shard":"generators"},{"ruby-version":"3.4","dependency-level":"latest","shard":"unit"},{"ruby-version":"3.2","dependency-level":"minimum","shard":"generators"},{"ruby-version":"3.2","dependency-level":"minimum","shard":"unit"}]}' >> $GITHUB_OUTPUT
9686
else
9787
# PR matrix: test only latest versions for fast feedback × 2 shards
98-
echo 'matrix={"include":[{"ruby-version":"3.4","dependency-level":"latest","shard":"generators"},{"ruby-version":"3.4","dependency-level":"latest","shard":"unit"}]}' >> $GITHUB_OUTPUT
88+
echo 'matrix={"include":[{"ruby-version":"3.4","dependency-level":"latest","shard":"generators"},{"ruby-version":"3.4","dependency-level":"latest","shard":"unit"}]}' >> "$GITHUB_OUTPUT"
9989
fi
90+
- name: Guard docs-only main pushes
91+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
92+
uses: ./.github/actions/ensure-main-docs-safety
93+
with:
94+
docs-only: ${{ steps.detect.outputs.docs_only }}
95+
previous-sha: ${{ github.event.before }}
10096

10197
rspec-package-tests:
102-
needs: [detect-changes, setup-gem-tests-matrix]
98+
needs: detect-changes
10399
# Skip only if: main push AND docs-only changes
104100
# Otherwise run if: on main OR Ruby tests needed
105101
# This allows docs-only commits to skip heavy jobs while ensuring full CI on main for code changes
@@ -114,7 +110,7 @@ jobs:
114110
)
115111
strategy:
116112
fail-fast: false
117-
matrix: ${{ fromJson(needs.setup-gem-tests-matrix.outputs.matrix) }}
113+
matrix: ${{ fromJson(needs.detect-changes.outputs.matrix) }}
118114
env:
119115
BUNDLE_FROZEN: ${{ matrix.dependency-level == 'minimum' && 'false' || 'true' }}
120116
runs-on: ubuntu-22.04

0 commit comments

Comments
 (0)