|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master, main, develop ] |
| 6 | + pull_request: |
| 7 | + branches: [ master, main, develop ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + ruby-version: ['2.7.6', '3.0.7', '3.1.7'] |
| 16 | + |
| 17 | + name: Ruby ${{ matrix.ruby-version }} |
| 18 | + |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Set up Ruby ${{ matrix.ruby-version }} |
| 23 | + uses: ruby/setup-ruby@v1 |
| 24 | + with: |
| 25 | + ruby-version: ${{ matrix.ruby-version }} |
| 26 | + bundler-cache: true # runs 'bundle install' and caches installed gems automatically |
| 27 | + |
| 28 | + - name: Install dependencies |
| 29 | + run: bundle install |
| 30 | + |
| 31 | + - name: Run tests |
| 32 | + run: bundle exec rspec --format documentation |
| 33 | + |
| 34 | + - name: Upload test results |
| 35 | + if: always() |
| 36 | + uses: actions/upload-artifact@v4 |
| 37 | + with: |
| 38 | + name: test-results-ruby-${{ matrix.ruby-version }} |
| 39 | + path: | |
| 40 | + spec/examples.txt |
| 41 | + coverage/ |
| 42 | + if-no-files-found: ignore |
| 43 | + |
| 44 | + # Optional: Test on macOS if needed |
| 45 | + test-macos: |
| 46 | + runs-on: macos-latest |
| 47 | + strategy: |
| 48 | + fail-fast: false |
| 49 | + matrix: |
| 50 | + ruby-version: ['2.7.6', '3.0.7', '3.1.7'] |
| 51 | + |
| 52 | + name: Ruby ${{ matrix.ruby-version }} (macOS) |
| 53 | + |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v4 |
| 56 | + |
| 57 | + - name: Set up Ruby ${{ matrix.ruby-version }} |
| 58 | + uses: ruby/setup-ruby@v1 |
| 59 | + with: |
| 60 | + ruby-version: ${{ matrix.ruby-version }} |
| 61 | + bundler-cache: true |
| 62 | + |
| 63 | + - name: Install dependencies |
| 64 | + run: bundle install |
| 65 | + |
| 66 | + - name: Run tests |
| 67 | + run: bundle exec rspec --format documentation |
| 68 | + |
| 69 | + # Check code quality |
| 70 | + lint: |
| 71 | + runs-on: ubuntu-latest |
| 72 | + name: RuboCop |
| 73 | + |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@v4 |
| 76 | + |
| 77 | + - name: Set up Ruby |
| 78 | + uses: ruby/setup-ruby@v1 |
| 79 | + with: |
| 80 | + ruby-version: '3.1.7' |
| 81 | + bundler-cache: true |
| 82 | + |
| 83 | + - name: Install RuboCop |
| 84 | + run: gem install rubocop |
| 85 | + |
| 86 | + - name: Run RuboCop |
| 87 | + run: rubocop --format progress |
| 88 | + continue-on-error: true # Don't fail the build on RuboCop errors for now |
0 commit comments