|
4 | 4 | push: |
5 | 5 | branches: |
6 | 6 | - 'master' |
| 7 | + paths-ignore: |
| 8 | + - '**.md' |
| 9 | + - 'docs/**' |
7 | 10 | pull_request: |
| 11 | + paths-ignore: |
| 12 | + - '**.md' |
| 13 | + - 'docs/**' |
8 | 14 |
|
9 | 15 | jobs: |
| 16 | + detect-changes: |
| 17 | + runs-on: ubuntu-22.04 |
| 18 | + outputs: |
| 19 | + docs_only: ${{ steps.detect.outputs.docs_only }} |
| 20 | + run_lint: ${{ steps.detect.outputs.run_lint }} |
| 21 | + run_js_tests: ${{ steps.detect.outputs.run_js_tests }} |
| 22 | + run_ruby_tests: ${{ steps.detect.outputs.run_ruby_tests }} |
| 23 | + run_dummy_tests: ${{ steps.detect.outputs.run_dummy_tests }} |
| 24 | + run_generators: ${{ steps.detect.outputs.run_generators }} |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + # Fetch enough history for change detection (50 commits is usually sufficient for PRs) |
| 29 | + fetch-depth: 50 |
| 30 | + persist-credentials: false |
| 31 | + - name: Detect relevant changes |
| 32 | + id: detect |
| 33 | + run: | |
| 34 | + BASE_REF="${{ github.event.pull_request.base.sha || github.event.before || 'origin/master' }}" |
| 35 | + script/ci-changes-detector "$BASE_REF" |
| 36 | + shell: bash |
| 37 | + |
10 | 38 | examples: |
| 39 | + needs: detect-changes |
| 40 | + if: github.ref == 'refs/heads/master' || needs.detect-changes.outputs.run_generators == 'true' |
11 | 41 | strategy: |
12 | 42 | fail-fast: false |
13 | 43 | matrix: |
14 | | - ruby-version: ['3.2', '3.4'] |
15 | | - dependency-level: ['minimum', 'latest'] |
16 | 44 | include: |
17 | | - - ruby-version: '3.2' |
18 | | - dependency-level: 'minimum' |
| 45 | + # Always run: Latest versions (fast feedback on PRs) |
19 | 46 | - ruby-version: '3.4' |
20 | 47 | dependency-level: 'latest' |
21 | | - exclude: |
| 48 | + # Master only: Minimum supported versions (full coverage) |
22 | 49 | - ruby-version: '3.2' |
23 | | - dependency-level: 'latest' |
24 | | - - ruby-version: '3.4' |
25 | 50 | dependency-level: 'minimum' |
26 | 51 | env: |
27 | 52 | SKIP_YARN_COREPACK_CHECK: 0 |
|
31 | 56 | - uses: actions/checkout@v4 |
32 | 57 | with: |
33 | 58 | persist-credentials: false |
34 | | - - name: Get changed files |
35 | | - id: changed-files |
36 | | - run: | |
37 | | - BASE_SHA=${{ github.event.pull_request.base.sha || github.event.before }} |
38 | | - git fetch origin $BASE_SHA |
39 | | - CHANGED_FILES=$(git diff --name-only $BASE_SHA ${{ github.sha }} -- \ |
40 | | - lib/generators/ \ |
41 | | - rakelib/example_type.rb \ |
42 | | - rakelib/example_config.yml \ |
43 | | - rakelib/examples.rake \ |
44 | | - rakelib/run_rspec.rake) |
45 | | - if [ -n "$CHANGED_FILES" ]; then |
46 | | - ANY_CHANGED=true |
47 | | - else |
48 | | - ANY_CHANGED=false |
49 | | - fi |
50 | | - echo "any_changed=$ANY_CHANGED" >> "$GITHUB_OUTPUT" |
51 | 59 | - name: Setup Ruby |
52 | 60 | uses: ruby/setup-ruby@v1 |
53 | 61 | with: |
@@ -108,7 +116,6 @@ jobs: |
108 | 116 | run: | |
109 | 117 | echo "CI_DEPENDENCY_LEVEL=${{ matrix.dependency-level }}" >> $GITHUB_ENV |
110 | 118 | - name: Main CI |
111 | | - if: steps.changed-files.outputs.any_changed == 'true' |
112 | 119 | run: bundle exec rake run_rspec:shakapacker_examples |
113 | 120 | - name: Store test results |
114 | 121 | uses: actions/upload-artifact@v4 |
|
0 commit comments