|
1 | | -name: Test |
| 1 | +name: CI |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | branches: [main] |
6 | 6 | pull_request: |
7 | 7 | branches: [main] |
| 8 | + workflow_dispatch: |
8 | 9 |
|
9 | 10 | jobs: |
| 11 | + lint: |
| 12 | + name: Lint |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v3 |
| 16 | + |
| 17 | + - name: Setup Ruby |
| 18 | + uses: ruby/setup-ruby@v1 |
| 19 | + with: |
| 20 | + ruby-version: "3.4" |
| 21 | + bundler-cache: true |
| 22 | + |
| 23 | + - name: Install dependencies |
| 24 | + run: | |
| 25 | + # Make sure bundler is using the correct Ruby version |
| 26 | + ruby -v |
| 27 | + bundle install |
| 28 | + npm install prettier |
| 29 | +
|
| 30 | + - name: Rubocop |
| 31 | + run: bin/rubocop |
| 32 | + |
| 33 | + - name: Sorbet Typecheck |
| 34 | + run: bin/typecheck |
| 35 | + |
| 36 | + - name: Spellcheck |
| 37 | + run: bin/spellcheck |
| 38 | + |
| 39 | + - name: Prettier (Format Check) |
| 40 | + run: npx prettier --check "**/*.{js,json,md}" |
| 41 | + |
10 | 42 | test: |
| 43 | + name: "Tests: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }}" |
| 44 | + needs: [lint] |
11 | 45 | runs-on: ubuntu-latest |
12 | 46 | strategy: |
13 | 47 | fail-fast: false |
14 | 48 | matrix: |
15 | | - ruby: ["3.0", "3.1", "3.2", "3.3", "3.4"] |
| 49 | + ruby: ["2.7", "3.0", "3.2", "3.4"] |
16 | 50 | rails: ["7.0", "7.1", "8.0"] |
17 | 51 | exclude: |
| 52 | + # Rails 8.0 requires Ruby 3.1+ |
| 53 | + - ruby: "2.7" |
| 54 | + rails: "8.0" |
18 | 55 | - ruby: "3.0" |
19 | 56 | rails: "8.0" |
20 | 57 |
|
21 | 58 | env: |
22 | 59 | RAILS_VERSION: ${{ matrix.rails }} |
| 60 | + RUBY_VERSION: ${{ matrix.ruby }} |
23 | 61 |
|
24 | 62 | steps: |
25 | 63 | - uses: actions/checkout@v3 |
26 | 64 |
|
27 | | - - name: Set up Ruby |
| 65 | + - name: Setup Ruby ${{ matrix.ruby }} |
28 | 66 | uses: ruby/setup-ruby@v1 |
29 | 67 | with: |
30 | 68 | ruby-version: ${{ matrix.ruby }} |
31 | 69 | bundler-cache: true |
32 | 70 |
|
| 71 | + # Create a .ruby-version file with the matrix Ruby version |
| 72 | + - name: Set Ruby version |
| 73 | + run: echo "${{ matrix.ruby }}" > .ruby-version |
| 74 | + |
33 | 75 | - name: Install dependencies |
34 | 76 | run: | |
| 77 | + # Make sure bundler is using the correct Ruby version |
| 78 | + ruby -v |
| 79 | + # Configure bundler |
35 | 80 | bundle config set --local without 'development' |
| 81 | + # Install dependencies with the specific Rails version |
36 | 82 | bundle install |
37 | 83 |
|
38 | 84 | - name: Run tests |
39 | | - run: bundle exec rake test |
| 85 | + run: bin/test |
| 86 | + |
| 87 | + # Optional: Save coverage data as an artifact |
| 88 | + - name: Upload coverage reports |
| 89 | + uses: actions/upload-artifact@v3 |
| 90 | + if: success() |
| 91 | + with: |
| 92 | + name: coverage-ruby${{ matrix.ruby }}-rails${{ matrix.rails }} |
| 93 | + path: coverage/ |
| 94 | + retention-days: 5 |
0 commit comments