Skip to content
74 changes: 74 additions & 0 deletions .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Lint JS and Ruby

on:
push:
branches:
- 'master'
paths:
- '.github/workflows/**'
pull_request:
paths:
- '.github/workflows/**'
workflow_dispatch:

jobs:
actionlint:
env:
BUNDLE_FROZEN: true
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
# No need for history in lint job
fetch-depth: 1
persist-credentials: false
# We only download and run Actionlint if there is any difference in GitHub Action workflows
# https://github.com/rhysd/actionlint/blob/main/docs/usage.md#on-github-actions
- name: Check GitHub Action changes
id: check-workflows
run: |
BASE_SHA="${{ github.event.pull_request.base.sha || github.event.before }}"
if [ -n "$BASE_SHA" ]; then
git fetch origin "$BASE_SHA" 2>/dev/null || true
fi

# For PRs, diff against base; for pushes, use before commit
if [ -n "${{ github.event.pull_request.base.sha }}" ]; then
DIFF_BASE="${{ github.event.pull_request.base.sha }}"
else
DIFF_BASE="${{ github.event.before }}"
fi

# Handle initial commits where before SHA is all zeros
if [[ "$DIFF_BASE" =~ ^0+$ ]]; then
DIFF_BASE="origin/master"
fi

if git diff --name-only "$DIFF_BASE" ${{ github.sha }} 2>/dev/null | grep -q '^.github/workflows'; then
echo "changed=true" >> "$GITHUB_OUTPUT"
response=$(curl -sf https://api.github.com/repos/rhysd/actionlint/releases/latest)
if [ $? -eq 0 ]; then
actionlint_version=$(echo "$response" | jq -r .tag_name)
if [ -z "$actionlint_version" ]; then
echo "Failed to parse Actionlint version"
exit 1
fi
echo "actionlint_version=\"$actionlint_version\"" >> "$GITHUB_OUTPUT"
fi
fi
- name: Setup Actionlint
if: steps.check-workflows.outputs.changed == 'true'
uses: actions/cache@v4
id: cache-actionlint
with:
path: ./actionlint
key: ${{ runner.os }}-actionlint-${{ steps.check-workflows.outputs.actionlint_version }}
- name: Download Actionlint
if: steps.check-workflows.outputs.changed == 'true' && steps.cache-actionlint.outputs.cache-hit != 'true'
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
- name: Lint GitHub Actions
if: steps.check-workflows.outputs.changed == 'true'
run: |
echo "::add-matcher::.github/actionlint-matcher.json"
SHELLCHECK_OPTS="-S warning" ./actionlint -color
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Generator tests
name: Generator tests # TODO needs to be duplicated for RoR Pro

on:
push:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,21 @@ on:
paths-ignore:
- '**.md'
- 'docs/**'
- 'packages/react-on-rails/src/**'
- 'node_package/src/**'
- 'packages/**'
- 'react_on_rails_pro/**'
pull_request:
paths-ignore:
- '**.md'
- 'docs/**'
- 'packages/react-on-rails/src/**'
- 'node_package/src/**'
- 'packages/**'
- 'react_on_rails_pro/**'
workflow_dispatch:
inputs:
force_run:
description: 'Force run all jobs (bypass detect-changes)'
required: false
type: boolean
default: false

jobs:
detect-changes:
Expand All @@ -40,8 +46,8 @@ jobs:
- name: Detect relevant changes
id: detect
run: |
# If full-ci label is present, run everything
if [ "${{ steps.check-label.outputs.result }}" = "true" ]; then
# If force_run is true OR full-ci label is present, run everything
if [ "${{ inputs.force_run }}" = "true" ] || [ "${{ steps.check-label.outputs.result }}" = "true" ]; then
echo "run_lint=true" >> "$GITHUB_OUTPUT"
echo "run_js_tests=true" >> "$GITHUB_OUTPUT"
echo "run_ruby_tests=true" >> "$GITHUB_OUTPUT"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Main test
name: Integration Tests

on:
push:
Expand All @@ -7,10 +7,12 @@ on:
paths-ignore:
- '**.md'
- 'docs/**'
- 'react_on_rails_pro/**'
pull_request:
paths-ignore:
- '**.md'
- 'docs/**'
- 'react_on_rails_pro/**'
workflow_dispatch:
inputs:
force_run:
Expand Down Expand Up @@ -50,11 +52,10 @@ jobs:
echo "run_dummy_tests=true" >> "$GITHUB_OUTPUT"
echo "run_generators=true" >> "$GITHUB_OUTPUT"
echo "docs_only=false" >> "$GITHUB_OUTPUT"
exit 0
fi

BASE_REF="${{ github.event.pull_request.base.sha || github.event.before || 'origin/master' }}"
else
BASE_REF="${{ github.event.pull_request.base.sha || github.event.before || 'origin/master' }}"
script/ci-changes-detector "$BASE_REF"
fi
shell: bash

build-dummy-app-webpack-test-bundles:
Expand All @@ -64,20 +65,14 @@ jobs:
github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run_dummy_tests == 'true'
strategy:
matrix:
ruby-version: ['3.4']
node-version: ['22']
dependency-level: ['latest']
include:
# Always run: Latest versions (fast feedback on PRs)
- ruby-version: '3.4'
node-version: '22'
dependency-level: 'latest'
# Master and workflow_dispatch: Minimum supported versions (full coverage)
- ruby-version: '3.2'
node-version: '20'
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' || '' }}
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' || '' }}
- 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'}}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -152,17 +147,15 @@ 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:
# Always run: Latest versions (fast feedback on PRs)
- ruby-version: '3.4'
node-version: '22'
dependency-level: 'latest'
# Master and workflow_dispatch: Minimum supported versions (full coverage)
- ruby-version: '3.2'
node-version: '20'
dependency-level: 'minimum'
# 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' || '' }}
Expand Down
49 changes: 11 additions & 38 deletions .github/workflows/lint-js-and-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,19 @@ on:
paths-ignore:
- '**.md'
- 'docs/**'
- 'react_on_rails_pro/**'
pull_request:
paths-ignore:
- '**.md'
- 'docs/**'
- 'react_on_rails_pro/**'
workflow_dispatch:
inputs:
force_run:
description: 'Force run all jobs (bypass detect-changes)'
required: false
type: boolean
default: false

jobs:
detect-changes:
Expand All @@ -35,8 +43,8 @@ jobs:
- name: Detect relevant changes
id: detect
run: |
# If full-ci label is present, run everything
if [ "${{ steps.check-label.outputs.result }}" = "true" ]; then
# If force_run is true OR full-ci label is present, run everything
if [ "${{ inputs.force_run }}" = "true" ] || [ "${{ steps.check-label.outputs.result }}" = "true" ]; then
echo "run_lint=true" >> "$GITHUB_OUTPUT"
echo "run_js_tests=true" >> "$GITHUB_OUTPUT"
echo "run_ruby_tests=true" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -71,10 +79,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 22
# TODO: Re-enable cache when Node.js 22 V8 bug is fixed
# Disable cache for Node 22 due to V8 bug in 22.21.0
# Track: https://github.com/nodejs/node/issues/56010
cache: ''
cache: yarn
cache-dependency-path: '**/yarn.lock'
- name: Print system information
run: |
Expand Down Expand Up @@ -144,35 +149,3 @@ jobs:
run: yarn run publint --strict packages/react-on-rails/react-on-rails.tgz
# We only download and run Actionlint if there is any difference in GitHub Action workflows
# https://github.com/rhysd/actionlint/blob/main/docs/usage.md#on-github-actions
- name: Check GitHub Action changes
id: check-workflows
run: |
git fetch origin ${{ github.event.pull_request.base.sha }}
if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -q '^.github/workflows'; then
echo "changed=true" >> "$GITHUB_OUTPUT"
response=$(curl -sf https://api.github.com/repos/rhysd/actionlint/releases/latest)
if [ $? -eq 0 ]; then
actionlint_version=$(echo "$response" | jq -r .tag_name)
if [ -z "$actionlint_version" ]; then
echo "Failed to parse Actionlint version"
exit 1
fi
echo "actionlint_version=\"$actionlint_version\"" >> "$GITHUB_OUTPUT"
fi
fi
- name: Setup Actionlint
if: steps.check-workflows.outputs.changed == 'true'
uses: actions/cache@v4
id: cache-actionlint
with:
path: ./actionlint
key: ${{ runner.os }}-actionlint-${{ steps.check-workflows.outputs.actionlint_version }}
- name: Download Actionlint
if: steps.check-workflows.outputs.changed == 'true' && steps.cache-actionlint.outputs.cache-hit != 'true'
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
- name: Lint GitHub Actions
if: steps.check-workflows.outputs.changed == 'true'
run: |
echo "::add-matcher::.github/actionlint-matcher.json"
SHELLCHECK_OPTS="-S warning" ./actionlint -color
shell: bash
12 changes: 10 additions & 2 deletions .github/workflows/package-js-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,21 @@ on:
- 'docs/**'
- 'lib/**'
- 'spec/react_on_rails/**'
- 'react_on_rails_pro/**'
pull_request:
paths-ignore:
- '**.md'
- 'docs/**'
- 'lib/**'
- 'spec/react_on_rails/**'
- 'react_on_rails_pro/**'
workflow_dispatch:
inputs:
force_run:
description: 'Force run all jobs (bypass detect-changes)'
required: false
type: boolean
default: false

jobs:
detect-changes:
Expand All @@ -40,8 +48,8 @@ jobs:
- name: Detect relevant changes
id: detect
run: |
# If full-ci label is present, run everything
if [ "${{ steps.check-label.outputs.result }}" = "true" ]; then
# If force_run is true OR full-ci label is present, run everything
if [ "${{ inputs.force_run }}" = "true" ] || [ "${{ steps.check-label.outputs.result }}" = "true" ]; then
echo "run_lint=true" >> "$GITHUB_OUTPUT"
echo "run_js_tests=true" >> "$GITHUB_OUTPUT"
echo "run_ruby_tests=true" >> "$GITHUB_OUTPUT"
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Playwright E2E Tests
on:
push:
branches: [master]
paths-ignore:
- '**.md'
- 'docs/**'
workflow_dispatch:

jobs:
Expand Down
27 changes: 15 additions & 12 deletions .github/workflows/pro-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,19 @@ on:
push:
branches:
- 'master'
paths-ignore:
- '**.md'
- 'docs/**'
- 'lib/**'
- 'spec/**'
- 'packages/react_on_rails/**'
pull_request:
paths-ignore:
- '**.md'
- 'docs/**'
- 'lib/**'
- 'spec/**'
- 'packages/react_on_rails/**'
workflow_dispatch:
inputs:
force_run:
Expand Down Expand Up @@ -71,10 +83,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 22
# TODO: Re-enable cache when Node.js 22 V8 bug is fixed
# Disable cache for Node 22 due to V8 bug in 22.21.0
# Track: https://github.com/nodejs/node/issues/56010
cache: ''
cache: yarn
cache-dependency-path: 'react_on_rails_pro/**/yarn.lock'

- name: Print system information
Expand Down Expand Up @@ -161,10 +170,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 22
# TODO: Re-enable cache when Node.js 22 V8 bug is fixed
# Disable cache for Node 22 due to V8 bug in 22.21.0
# Track: https://github.com/nodejs/node/issues/56010
cache: ''
cache: yarn
cache-dependency-path: 'react_on_rails_pro/**/yarn.lock'

- name: Print system information
Expand Down Expand Up @@ -352,10 +358,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 22
# TODO: Re-enable cache when Node.js 22 V8 bug is fixed
# Disable cache for Node 22 due to V8 bug in 22.21.0
# Track: https://github.com/nodejs/node/issues/56010
cache: ''
cache: yarn
cache-dependency-path: 'react_on_rails_pro/**/yarn.lock'

- name: Print system information
Expand Down
Loading
Loading