|
| 1 | +name: Test |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: [main] |
| 7 | + pull_request: |
| 8 | + branches: [main] |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: test-${{ github.ref }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + test_strategy: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + ruby: ['3.2', '3.3', '3.4', '4.0'] |
| 24 | + omniauth_oauth2: ['1.8.0'] |
| 25 | + |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v5 |
| 28 | + |
| 29 | + - name: Set up Ruby |
| 30 | + uses: ruby/setup-ruby@v1 |
| 31 | + with: |
| 32 | + ruby-version: ${{ matrix.ruby }} |
| 33 | + bundler-cache: false |
| 34 | + |
| 35 | + - name: Set matrix environment |
| 36 | + run: echo "OMNIAUTH_OAUTH2=${{ matrix.omniauth_oauth2 }}" >> "$GITHUB_ENV" |
| 37 | + |
| 38 | + - name: Install dependencies |
| 39 | + run: | |
| 40 | + bundle config set frozen false |
| 41 | + bundle install --jobs 4 --retry 2 |
| 42 | +
|
| 43 | + - name: Lint |
| 44 | + run: bundle exec rake lint |
| 45 | + |
| 46 | + - name: Strategy tests |
| 47 | + run: bundle exec rake test_unit |
| 48 | + |
| 49 | + - name: Strategy warnings check |
| 50 | + run: | |
| 51 | + bundle exec ruby -w -Itest test/omniauth_spotify_test.rb 2> warnings.log |
| 52 | + if grep -q "warning:" warnings.log; then |
| 53 | + cat warnings.log |
| 54 | + exit 1 |
| 55 | + fi |
| 56 | +
|
| 57 | + test_rails_integration: |
| 58 | + runs-on: ubuntu-latest |
| 59 | + strategy: |
| 60 | + fail-fast: false |
| 61 | + matrix: |
| 62 | + ruby: ['3.2', '3.3', '3.4', '4.0'] |
| 63 | + rails: ['~> 7.1.0', '~> 7.2.0', '~> 8.0.0', '~> 8.1.0'] |
| 64 | + omniauth_oauth2: ['1.8.0'] |
| 65 | + |
| 66 | + steps: |
| 67 | + - uses: actions/checkout@v5 |
| 68 | + |
| 69 | + - name: Set up Ruby |
| 70 | + uses: ruby/setup-ruby@v1 |
| 71 | + with: |
| 72 | + ruby-version: ${{ matrix.ruby }} |
| 73 | + bundler-cache: false |
| 74 | + |
| 75 | + - name: Set matrix environment |
| 76 | + run: | |
| 77 | + echo "RAILS_VERSION=${{ matrix.rails }}" >> "$GITHUB_ENV" |
| 78 | + echo "OMNIAUTH_OAUTH2=${{ matrix.omniauth_oauth2 }}" >> "$GITHUB_ENV" |
| 79 | +
|
| 80 | + - name: Install dependencies |
| 81 | + run: | |
| 82 | + bundle config set frozen false |
| 83 | + bundle install --jobs 4 --retry 2 |
| 84 | +
|
| 85 | + - name: Rails integration test |
| 86 | + run: bundle exec rake test_rails_integration |
| 87 | + |
| 88 | + - name: Rails integration warnings check |
| 89 | + run: | |
| 90 | + bundle exec ruby -w -Itest test/rails_integration_test.rb 2> warnings.log |
| 91 | + if grep -q "warning:" warnings.log; then |
| 92 | + cat warnings.log |
| 93 | + exit 1 |
| 94 | + fi |
0 commit comments