Skip to content
Closed
39 changes: 24 additions & 15 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 @@ -65,29 +74,29 @@ jobs:
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
- 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
86 changes: 49 additions & 37 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,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 @@ -41,6 +42,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 @@ -64,24 +73,28 @@ jobs:
if: |
github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run_dummy_tests == 'true'
strategy:
fail-fast: false
matrix:
ruby-version: ['3.4']
node-version: ['22']
dependency-level: ['latest']
include:
# Skip minimum dependency matrix on regular PRs (run only on master/workflow_dispatch/force_run/full-ci label)
- ruby-version: ${{ (github.ref == 'refs/heads/master' || inputs.force_run == true || needs.detect-changes.outputs.has_full_ci_label == 'true') && '3.2'}}
node-version: ${{ (github.ref == 'refs/heads/master' || inputs.force_run == true || needs.detect-changes.outputs.has_full_ci_label == 'true') && '20'}}
dependency-level: ${{ (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) }}
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
- 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
# libyaml-dev is needed for psych v5
# this gem depends on sdoc which depends on rdoc which depends on psych
Expand All @@ -90,10 +103,10 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: ${{ steps.translate-matrix.outputs.node-version }}
# Disable cache for Node 22 due to V8 bug in 22.21.0
# https://github.com/nodejs/node/issues/56010
cache: ${{ matrix.node-version != '22' && 'yarn' || '' }}
cache: yarn
cache-dependency-path: '**/yarn.lock'
- name: Print system information
run: |
Expand Down Expand Up @@ -121,7 +134,7 @@ jobs:
uses: actions/cache@v4
with:
path: spec/dummy/vendor/bundle
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
- name: Install Ruby Gems for dummy app
run: |
cd spec/dummy
Expand All @@ -139,45 +152,44 @@ jobs:
uses: actions/cache/save@v4
with:
path: spec/dummy/public/webpack
key: dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
key: dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}

dummy-app-integration-tests:
needs: [detect-changes, build-dummy-app-webpack-test-bundles]
# Run on master, workflow_dispatch, OR when tests needed on PR
if: |
github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run_dummy_tests == 'true'
strategy:
fail-fast: false
matrix:
ruby-version: ['3.4']
node-version: ['22']
dependency-level: ['latest']
include:
# Skip minimum dependency matrix on regular PRs (run only on master/workflow_dispatch/force_run/full-ci label)
- ruby-version: ${{ (github.ref == 'refs/heads/master' || inputs.force_run == true || needs.detect-changes.outputs.has_full_ci_label == 'true') && '3.2'}}
node-version: ${{ (github.ref == 'refs/heads/master' || inputs.force_run == true || needs.detect-changes.outputs.has_full_ci_label == 'true') && '20'}}
dependency-level: ${{ (github.ref == 'refs/heads/master' || inputs.force_run == true || needs.detect-changes.outputs.has_full_ci_label == 'true') && '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' || '' }}
node-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && inputs.force_run != true && needs.detect-changes.outputs.has_full_ci_label != 'true' && '20' || '' }}
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) }}
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
- 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
with:
node-version: ${{ matrix.node-version }}
node-version: ${{ steps.translate-matrix.outputs.node-version }}
# Disable cache for Node 22 due to V8 bug in 22.21.0
# https://github.com/nodejs/node/issues/56010
cache: ${{ matrix.node-version != '22' && 'yarn' || '' }}
cache: yarn
cache-dependency-path: '**/yarn.lock'
- name: Print system information
run: |
Expand All @@ -195,19 +207,19 @@ 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 }}
- name: Save dummy app ruby gems to cache
uses: actions/cache@v4
with:
path: spec/dummy/vendor/bundle
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/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: Save test Webpack bundles to cache (for build number checksum used by RSpec job)
uses: actions/cache@v4
with:
path: spec/dummy/public/webpack
key: dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
key: dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
- name: Install Node modules with Yarn
run: |
yarn install --no-progress --no-emoji ${{ matrix.dependency-level == 'latest' && '--frozen-lockfile' || '' }}
Expand Down Expand Up @@ -260,26 +272,26 @@ jobs:
- run: cd spec/dummy && bundle info shakapacker
- name: Set packer version environment variable
run: |
echo "CI_DEPENDENCY_LEVEL=ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}" >> $GITHUB_ENV
echo "CI_DEPENDENCY_LEVEL=ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}" >> $GITHUB_ENV
- name: Main CI
run: bundle exec rake run_rspec:all_dummy
- 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: dummy-app-capybara-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
name: dummy-app-capybara-${{ github.run_id }}-${{ github.job }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
path: spec/dummy/tmp/capybara
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: dummy-app-test-log-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
name: dummy-app-test-log-${{ github.run_id }}-${{ github.job }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
path: spec/dummy/log/test.log
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: dummy-app-yarn-log-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
name: dummy-app-yarn-log-${{ github.run_id }}-${{ github.job }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
path: spec/dummy/yarn-error.log
Loading
Loading