Repository navigation
test: make the live Rollbar API specs conditional on ROLLBAR_TOKEN (#… #221
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # The following workflow is based on the example provided by | |
| # haskell-actions/setup: | |
| # | |
| # https://github.com/haskell-actions/setup#model-cabal-workflow-with-caching | |
| name: CI | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| group: build-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| generate-matrix: | |
| name: "Generate matrix from cabal" | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Extract the tested GHC versions | |
| id: set-matrix | |
| uses: kleidukos/get-tested@v0.1.7.0 | |
| with: | |
| cabal-file: rollbar-client/rollbar-client.cabal | |
| ubuntu-version: latest | |
| macos-version: latest | |
| version: 0.1.7.0 | |
| build: | |
| name: GHC ${{ matrix.ghc }} on ${{ matrix.os }} | |
| needs: generate-matrix | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Haskell tools | |
| uses: haskell-actions/setup@v2 | |
| id: setup | |
| with: | |
| ghc-version: ${{ matrix.ghc }} | |
| cabal-version: "latest" | |
| cabal-update: true | |
| - name: Configure the build | |
| run: | | |
| cabal configure --enable-tests --enable-benchmarks --disable-documentation | |
| cabal build all --dry-run | |
| - name: Restore cached dependencies | |
| uses: actions/cache/restore@v4 | |
| id: cache | |
| env: | |
| key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }} | |
| with: | |
| path: ${{ steps.setup.outputs.cabal-store }} | |
| key: v1-${{ env.key }}-plan-${{ hashFiles('**/dist-newstyle/cache/plan.json') }} | |
| restore-keys: v1-ghc-deps-${{ env.key }}- | |
| - name: Install dependencies | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: cabal build all --only-dependencies | |
| - name: Save cached dependencies | |
| uses: actions/cache/save@v4 | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| with: | |
| path: ${{ steps.setup.outputs.cabal-store }} | |
| key: ${{ steps.cache.outputs.cache-primary-key }} | |
| - name: Build | |
| run: cabal build all | |
| - name: Run tests | |
| run: cabal test all | |
| env: | |
| # When this secret is missing or empty, the specs that talk to the | |
| # real Rollbar API are skipped; setting a valid token re-enables | |
| # them without any workflow changes. | |
| ROLLBAR_TOKEN: ${{ secrets.ROLLBAR_TOKEN }} |