Skip to content

Commit ad67d52

Browse files
justin808claude
andcommitted
Standardize gem-tests workflow to use dynamic matrix configuration
Convert gem-tests.yml to use the same dynamic matrix pattern as integration-tests.yml and examples.yml for consistency. Changes: - Added setup-gem-tests-matrix job to compute matrix based on context - Updated rspec-package-tests to use fromJson(needs.setup-gem-tests-matrix.outputs.matrix) - Removed static include/exclude pattern in favor of dynamic generation - Maintains same behavior: latest on PRs, both latest+minimum on master or with full-ci label Benefits: - Consistent pattern across all three test workflows - More explicit and debuggable (matrix visible in job output) - Prevents potential issues with empty/false values in exclude - Easier to understand and maintain 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 3456dd0 commit ad67d52

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

.github/workflows/gem-tests.yml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,32 @@ jobs:
6161
script/ci-changes-detector "$BASE_REF"
6262
shell: bash
6363

64-
rspec-package-tests:
64+
setup-gem-tests-matrix:
6565
needs: detect-changes
66+
runs-on: ubuntu-22.04
67+
outputs:
68+
matrix: ${{ steps.set-matrix.outputs.matrix }}
69+
steps:
70+
- id: set-matrix
71+
run: |
72+
# Determine if we should run full matrix (master or full-ci label)
73+
if [[ "${{ github.ref }}" == "refs/heads/master" ]] || \
74+
[[ "${{ needs.detect-changes.outputs.has_full_ci_label }}" == "true" ]]; then
75+
# Full matrix: test both latest and minimum supported versions
76+
echo 'matrix={"include":[{"ruby-version":"3.4","dependency-level":"latest"},{"ruby-version":"3.2","dependency-level":"minimum"}]}' >> $GITHUB_OUTPUT
77+
else
78+
# PR matrix: test only latest versions for fast feedback
79+
echo 'matrix={"include":[{"ruby-version":"3.4","dependency-level":"latest"}]}' >> $GITHUB_OUTPUT
80+
fi
81+
82+
rspec-package-tests:
83+
needs: [detect-changes, setup-gem-tests-matrix]
6684
# Run on master OR when Ruby tests needed on PR
6785
if: |
6886
(github.ref == 'refs/heads/master' || needs.detect-changes.outputs.run_ruby_tests == 'true')
6987
strategy:
7088
fail-fast: false
71-
matrix:
72-
include:
73-
# Always run: Latest versions (fast feedback on PRs)
74-
- ruby-version: '3.4'
75-
dependency-level: 'latest'
76-
# Master and full-ci label: Minimum supported versions (full coverage)
77-
- ruby-version: '3.2'
78-
dependency-level: 'minimum'
79-
exclude:
80-
# Skip minimum dependency matrix on regular PRs (run only on master or with full-ci label)
81-
- ruby-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && needs.detect-changes.outputs.has_full_ci_label != 'true' && '3.2' || '' }}
82-
dependency-level: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && needs.detect-changes.outputs.has_full_ci_label != 'true' && 'minimum' || '' }}
89+
matrix: ${{ fromJson(needs.setup-gem-tests-matrix.outputs.matrix) }}
8390
env:
8491
BUNDLE_FROZEN: ${{ matrix.dependency-level == 'minimum' && 'false' || 'true' }}
8592
runs-on: ubuntu-22.04

0 commit comments

Comments
 (0)