Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 25 additions & 16 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
run_dummy_tests: ${{ steps.detect.outputs.run_dummy_tests }}
run_generators: ${{ steps.detect.outputs.run_generators }}
has_full_ci_label: ${{ steps.check-label.outputs.result }}
matrix_array: ${{ steps.determine-matrix.outputs.result }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -39,6 +40,14 @@ jobs:
- name: Check for full-ci label
id: check-label
uses: ./.github/actions/check-full-ci-label
- name: Determine matrix strategy
id: determine-matrix
run: |
if [ "${{ inputs.force_run }}" = "true" ] || [ "${{ steps.check-label.outputs.result }}" = "true" ] || [ "${{ github.ref }}" = "refs/heads/master" ]; then
echo "result=[\"latest\"]" >> "$GITHUB_OUTPUT"
else
echo "result=[\"latest\",\"minimum\"]" >> "$GITHUB_OUTPUT"
fi
- name: Detect relevant changes
id: detect
run: |
Expand All @@ -57,37 +66,37 @@ jobs:
script/ci-changes-detector "$BASE_REF"
shell: bash

examples:
build-examples-and-test-generators:
needs: detect-changes
# Run on master, workflow_dispatch, OR when generators needed
if: |
github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run_generators == 'true'
strategy:
fail-fast: false
matrix:
include:
# Always run: Latest versions (fast feedback on PRs)
- ruby-version: '3.4'
dependency-level: 'latest'
# Master and workflow_dispatch: Minimum supported versions (full coverage)
- ruby-version: '3.2'
dependency-level: 'minimum'
exclude:
# Skip minimum dependency matrix on regular PRs (run only on master/workflow_dispatch/force_run/full-ci label)
- ruby-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && inputs.force_run != true && needs.detect-changes.outputs.has_full_ci_label != 'true' && '3.2' || '' }}
dependency-level: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && inputs.force_run != true && needs.detect-changes.outputs.has_full_ci_label != 'true' && 'minimum' || '' }}
dependency-level: ${{ fromJson(needs.detect-changes.outputs.matrix_array) }}
env:
SKIP_YARN_COREPACK_CHECK: 0
BUNDLE_FROZEN: ${{ matrix.dependency-level == 'minimum' && 'false' || 'true' }}
runs-on: ubuntu-22.04
steps:
- name: Translate matrix for Ruby and Node versions
id: translate-matrix
run: |
if [ "${{ matrix.dependency-level }}" == "latest" ]; then
echo "ruby-version=3.4" >> "$GITHUB_OUTPUT"
echo "node-version=22" >> "$GITHUB_OUTPUT"
else
echo "ruby-version=3.2" >> "$GITHUB_OUTPUT"
echo "node-version=20" >> "$GITHUB_OUTPUT"
fi
Comment on lines +83 to +92
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Inconsistency: Translate matrix step computes node-version but it's ignored on line 95.

The "Translate matrix for Ruby and Node versions" step (lines 74–83) outputs both ruby-version and node-version based on the dependency-level. Ruby version is correctly consumed at line 90 (ruby-version: ${{ steps.translate-matrix.outputs.ruby-version }}), but Node setup at line 95 hardcodes node-version: 20 instead of using the translated output.

This is problematic because:

  • For dependency-level == 'latest', the step sets node-version=22 (line 79), but line 95 forces Node 20
  • For dependency-level == 'minimum', the step sets node-version=20 (line 82), which accidentally matches the hardcoded value
  • This makes the node-version translation output dead code and reduces maintainability

Apply this diff to use the translated node-version:

      - name: Setup Node
        uses: actions/setup-node@v4
        with:
-         node-version: 20
+         node-version: ${{ steps.translate-matrix.outputs.node-version }}
          # TODO: Re-enable yarn caching once Node.js V8 cache crash is fixed
          # Tracking: https://github.com/actions/setup-node/issues/1028
          # cache: yarn
          # cache-dependency-path: '**/yarn.lock'

Also applies to: 95-95

🤖 Prompt for AI Agents
.github/workflows/examples.yml lines 74-95: the translate-matrix step writes
both ruby-version and node-version outputs but the Node setup at line 95 is
hardcoded to 20; change the Node setup to consume the generated output by
replacing the hardcoded node-version: 20 with node-version: ${{
steps.translate-matrix.outputs.node-version }} so the workflow respects the
dependency-level translation (ensure spacing/indentation matches the surrounding
YAML).

- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
ruby-version: ${{ steps.translate-matrix.outputs.ruby-version }}
bundler: 2.5.9
- name: Setup Node
uses: actions/setup-node@v4
Expand All @@ -113,15 +122,15 @@ jobs:
uses: actions/cache@v4
with:
path: vendor/bundle
key: package-app-gem-cache-${{ hashFiles('Gemfile.lock') }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
key: package-app-gem-cache-${{ hashFiles('Gemfile.lock') }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
- id: get-sha
run: echo "sha=\"$(git rev-parse HEAD)\"" >> "$GITHUB_OUTPUT"
- name: Install Node modules with Yarn for renderer package
run: |
yarn install --no-progress --no-emoji ${{ matrix.dependency-level == 'latest' && '--frozen-lockfile' || '' }}
sudo yarn global add yalc
- name: yalc publish for react-on-rails
run: yalc publish
run: yarn yalc publish
- name: Install Ruby Gems for package
run: |
bundle lock --add-platform 'x86_64-linux'
Expand Down Expand Up @@ -150,5 +159,5 @@ jobs:
- name: Store test results
uses: actions/upload-artifact@v4
with:
name: main-rspec-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
name: main-rspec-${{ github.run_id }}-${{ github.job }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
path: ~/rspec
39 changes: 23 additions & 16 deletions .github/workflows/gem-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
run_dummy_tests: ${{ steps.detect.outputs.run_dummy_tests }}
run_generators: ${{ steps.detect.outputs.run_generators }}
has_full_ci_label: ${{ steps.check-label.outputs.result }}
matrix_array: ${{ steps.determine-matrix.outputs.result }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -43,6 +44,14 @@ jobs:
- name: Check for full-ci label
id: check-label
uses: ./.github/actions/check-full-ci-label
- name: Determine matrix strategy
id: determine-matrix
run: |
if [ "${{ inputs.force_run }}" = "true" ] || [ "${{ steps.check-label.outputs.result }}" = "true" ] || [ "${{ github.ref }}" = "refs/heads/master" ]; then
echo "result=[\"latest\"]" >> "$GITHUB_OUTPUT"
else
echo "result=[\"latest\",\"minimum\"]" >> "$GITHUB_OUTPUT"
fi
- name: Detect relevant changes
id: detect
run: |
Expand All @@ -61,36 +70,34 @@ jobs:
script/ci-changes-detector "$BASE_REF"
shell: bash

rspec-package-tests:
basic-gem-tests:
needs: detect-changes
# Run on master OR when Ruby tests needed on PR
if: |
(github.ref == 'refs/heads/master' || needs.detect-changes.outputs.run_ruby_tests == 'true')
strategy:
fail-fast: false
matrix:
include:
# Always run: Latest versions (fast feedback on PRs)
- ruby-version: '3.4'
dependency-level: 'latest'
# Master and full-ci label: Minimum supported versions (full coverage)
- ruby-version: '3.2'
dependency-level: 'minimum'
exclude:
# Skip minimum dependency matrix on regular PRs (run only on master or with full-ci label)
- ruby-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && needs.detect-changes.outputs.has_full_ci_label != 'true' && '3.2' || '' }}
dependency-level: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && needs.detect-changes.outputs.has_full_ci_label != 'true' && 'minimum' || '' }}
dependency-level: ${{ fromJson(needs.detect-changes.outputs.matrix_array) }}
env:
BUNDLE_FROZEN: ${{ matrix.dependency-level == 'minimum' && 'false' || 'true' }}
runs-on: ubuntu-22.04
steps:
- name: Translate matrix for Ruby and Node versions
id: translate-matrix
run: |
if [ "${{ matrix.dependency-level }}" == "latest" ]; then
echo "ruby-version=3.4" >> "$GITHUB_OUTPUT"
else
echo "ruby-version=3.2" >> "$GITHUB_OUTPUT"
fi
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
ruby-version: ${{ steps.translate-matrix.outputs.ruby-version }}
bundler: 2.5.9
- name: Print system information
run: |
Expand All @@ -108,7 +115,7 @@ jobs:
uses: actions/cache@v4
with:
path: vendor/bundle
key: package-app-gem-cache-${{ hashFiles('Gemfile.lock') }}-${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
key: package-app-gem-cache-${{ hashFiles('Gemfile.lock') }}-${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
- name: Install Ruby Gems for package
run: bundle check --path=vendor/bundle || bundle _2.5.9_ install --path=vendor/bundle --jobs=4 --retry=3
- name: Git Stuff
Expand All @@ -125,10 +132,10 @@ jobs:
- name: Store test results
uses: actions/upload-artifact@v4
with:
name: main-rspec-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
name: main-rspec-${{ github.run_id }}-${{ github.job }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
path: ~/rspec
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: main-test-log-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
name: main-test-log-${{ github.run_id }}-${{ github.job }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
path: log/test.log
Loading
Loading