|
| 1 | +name: ci |
| 2 | + |
| 3 | +on: push |
| 4 | + |
| 5 | +jobs: |
| 6 | + rubocop: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + steps: |
| 9 | + - name: Checkout repository |
| 10 | + uses: actions/checkout@v3 |
| 11 | + - name: Setup Ruby |
| 12 | + uses: ruby/setup-ruby@v1 |
| 13 | + with: |
| 14 | + ruby-version: ruby |
| 15 | + bundler-cache: true |
| 16 | + - name: Lint codebase |
| 17 | + run: bundle exec rubocop --parallel |
| 18 | + |
| 19 | + rspec: |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + os: [ubuntu-latest, macos-latest] |
| 24 | + ruby: ['2.7', '3.0', '3.1', '3.2'] |
| 25 | + include: |
| 26 | + - os: ubuntu-latest |
| 27 | + ruby: '3.2' |
| 28 | + coverage: true |
| 29 | + runs-on: ${{ matrix.os }} |
| 30 | + steps: |
| 31 | + - name: Checkout repository |
| 32 | + uses: actions/checkout@v3 |
| 33 | + - name: Setup Ruby |
| 34 | + uses: ruby/setup-ruby@v1 |
| 35 | + with: |
| 36 | + ruby-version: ${{ matrix.ruby }} |
| 37 | + bundler-cache: true |
| 38 | + - name: Run specs |
| 39 | + run: bundle exec rspec |
| 40 | + env: |
| 41 | + COVERAGE: ${{ matrix.coverage }} |
| 42 | + - name: Generate coverage artifact |
| 43 | + if: ${{ matrix.coverage }} |
| 44 | + uses: actions/upload-artifact@v3 |
| 45 | + with: |
| 46 | + name: docs-coverage |
| 47 | + path: docs/coverage |
| 48 | + |
| 49 | + yard: |
| 50 | + runs-on: ubuntu-latest |
| 51 | + steps: |
| 52 | + - name: Checkout repository |
| 53 | + uses: actions/checkout@v3 |
| 54 | + - name: Setup Ruby |
| 55 | + uses: ruby/setup-ruby@v1 |
| 56 | + with: |
| 57 | + ruby-version: ruby |
| 58 | + bundler-cache: true |
| 59 | + - name: Generate Ruby API documentation |
| 60 | + run : bundle exec yard doc |
| 61 | + - name: Generate Ruby API documentation artifact |
| 62 | + uses: actions/upload-artifact@v3 |
| 63 | + with: |
| 64 | + name: docs-ruby |
| 65 | + path: docs/ruby |
| 66 | + |
| 67 | + pages: |
| 68 | + if: github.ref_name == 'master' |
| 69 | + needs: |
| 70 | + - rubocop |
| 71 | + - rspec |
| 72 | + - yard |
| 73 | + runs-on: ubuntu-latest |
| 74 | + permissions: |
| 75 | + contents: read |
| 76 | + pages: write # to deploy to Pages |
| 77 | + id-token: write # to verify the deployment originates from an appropriate source |
| 78 | + environment: |
| 79 | + name: github-pages |
| 80 | + url: ${{ steps.deployment.outputs.page_url }} |
| 81 | + steps: |
| 82 | + - name: Fetch Ruby API documentation artifact |
| 83 | + uses: actions/download-artifact@v3 |
| 84 | + with: |
| 85 | + name: docs-ruby |
| 86 | + path: docs/ruby |
| 87 | + - name: Fetch coverage artifact |
| 88 | + uses: actions/download-artifact@v3 |
| 89 | + with: |
| 90 | + name: docs-coverage |
| 91 | + path: docs/coverage |
| 92 | + - name: Setup Pages |
| 93 | + uses: actions/configure-pages@v3 |
| 94 | + - name: Upload Pages |
| 95 | + uses: actions/upload-pages-artifact@v2 |
| 96 | + with: |
| 97 | + path: docs |
| 98 | + - name: Deploy Pages |
| 99 | + id: deployment |
| 100 | + uses: actions/deploy-pages@v2 |
0 commit comments