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
64 changes: 31 additions & 33 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,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 @@ -40,6 +41,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\",\"minimum\"]" >> "$GITHUB_OUTPUT"
else
echo "result=[\"latest\"]" >> "$GITHUB_OUTPUT"
fi
- name: Detect relevant changes
id: detect
run: |
Expand All @@ -64,28 +73,8 @@ jobs:
docs-only: ${{ steps.detect.outputs.docs_only }}
previous-sha: ${{ github.event.before }}

setup-matrix:
needs: detect-changes
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
# Determine if we should run full matrix (master, workflow_dispatch, force_run, or full-ci label)
if [[ "${{ github.ref }}" == "refs/heads/master" ]] || \
[[ "${{ github.event_name }}" == "workflow_dispatch" ]] || \
[[ "${{ inputs.force_run }}" == "true" ]] || \
[[ "${{ needs.detect-changes.outputs.has_full_ci_label }}" == "true" ]]; then
# Full matrix: test both latest and minimum supported versions
echo 'matrix={"include":[{"ruby-version":"3.4","dependency-level":"latest"},{"ruby-version":"3.2","dependency-level":"minimum"}]}' >> $GITHUB_OUTPUT
else
# PR matrix: test only latest versions for fast feedback
echo 'matrix={"include":[{"ruby-version":"3.4","dependency-level":"latest"}]}' >> $GITHUB_OUTPUT
fi

examples:
needs: [detect-changes, setup-matrix]
needs: detect-changes
# Run on master, workflow_dispatch, OR when generators needed
if: |
!(
Expand All @@ -99,28 +88,39 @@ jobs:
)
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
matrix:
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
with:
node-version: 20
# 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'
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: ${{ steps.translate-matrix.outputs.node-version != '22' && 'yarn' || '' }}
cache-dependency-path: '**/yarn.lock'
- name: Print system information
run: |
echo "Linux release: "; cat /etc/issue
Expand All @@ -137,17 +137,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
# Use yarn workspace script to publish all workspace packages to yalc
# Runs the "yalc:publish" script defined in each workspace's package.json
run: yarn yalc publish
run: cd packages/react-on-rails && yalc publish
- name: Install Ruby Gems for package
run: |
bundle lock --add-platform 'x86_64-linux'
Expand Down Expand Up @@ -176,5 +174,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
48 changes: 24 additions & 24 deletions .github/workflows/gem-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,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 @@ -42,6 +43,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\",\"minimum\"]" >> "$GITHUB_OUTPUT"
else
echo "result=[\"latest\"]" >> "$GITHUB_OUTPUT"
fi
- name: Detect relevant changes
id: detect
run: |
Expand All @@ -66,26 +75,8 @@ jobs:
docs-only: ${{ steps.detect.outputs.docs_only }}
previous-sha: ${{ github.event.before }}

setup-gem-tests-matrix:
basic-gem-tests:
needs: detect-changes
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
# Determine if we should run full matrix (master or full-ci label)
if [[ "${{ github.ref }}" == "refs/heads/master" ]] || \
[[ "${{ needs.detect-changes.outputs.has_full_ci_label }}" == "true" ]]; then
# Full matrix: test both latest and minimum supported versions
echo 'matrix={"include":[{"ruby-version":"3.4","dependency-level":"latest"},{"ruby-version":"3.2","dependency-level":"minimum"}]}' >> $GITHUB_OUTPUT
else
# PR matrix: test only latest versions for fast feedback
echo 'matrix={"include":[{"ruby-version":"3.4","dependency-level":"latest"}]}' >> $GITHUB_OUTPUT
fi

rspec-package-tests:
needs: [detect-changes, setup-gem-tests-matrix]
# Skip only if: master push AND docs-only changes
# Otherwise run if: on master OR Ruby tests needed
# This allows docs-only commits to skip heavy jobs while ensuring full CI on master for code changes
Expand All @@ -100,18 +91,27 @@ jobs:
)
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup-gem-tests-matrix.outputs.matrix) }}
matrix:
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 @@ -129,7 +129,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 @@ -146,10 +146,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