|
| 1 | +name: Build and Test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + |
| 6 | +concurrency: |
| 7 | + group: ${{ github.workflow }}-${{ github.ref_name }} |
| 8 | + cancel-in-progress: ${{ github.ref_name != 'main' }} |
| 9 | + |
| 10 | +defaults: |
| 11 | + run: |
| 12 | + shell: bash |
| 13 | + |
| 14 | +jobs: |
| 15 | + find-stack-yamls: |
| 16 | + name: Find stack.yamls for GHC Matrix |
| 17 | + runs-on: ubuntu-22.04 |
| 18 | + outputs: |
| 19 | + stack-yamls: ${{ steps.set-output.outputs.stack-yamls }} |
| 20 | + steps: |
| 21 | + - name: Find Stack Yamls |
| 22 | + id: set-output |
| 23 | + uses: flipstone/github-actions/find-stack-ghc-yamls@bef3396e6c3777767d1d4837203cfdb2635b4933 |
| 24 | + |
| 25 | + build: |
| 26 | + name: Build and Test |
| 27 | + needs: find-stack-yamls |
| 28 | + runs-on: ubuntu-22.04 |
| 29 | + strategy: |
| 30 | + max-parallel: 5 |
| 31 | + matrix: |
| 32 | + stack-yaml: ${{ fromJson(needs.find-stack-yamls.outputs.stack-yamls) }} |
| 33 | + |
| 34 | + steps: |
| 35 | + - name: Checkout |
| 36 | + uses: actions/checkout@v4 |
| 37 | + |
| 38 | + - name: Cache |
| 39 | + uses: actions/cache@v4 |
| 40 | + env: |
| 41 | + cache-version: v3 |
| 42 | + with: |
| 43 | + key: ${{ env.cache-version }}-${{ matrix.stack-yaml }}-${{ hashFiles(matrix.stack-yaml, 'stack-base.yaml', 'package.yaml') }} |
| 44 | + restore-keys: | |
| 45 | + ${{ env.cache-version }}-${{ matrix.stack-yaml }}- |
| 46 | + path: | |
| 47 | + ./stack-root |
| 48 | +
|
| 49 | + - name: Setup Stack |
| 50 | + uses: flipstone/github-actions/setup-dockerized-stack@bef3396e6c3777767d1d4837203cfdb2635b4933 |
| 51 | + with: |
| 52 | + stack-root: ./stack-root |
| 53 | + |
| 54 | + - name: Build and test |
| 55 | + run: ./scripts/test --stack-yaml ${{ matrix.stack-yaml }} |
| 56 | + |
| 57 | + cabal-check: |
| 58 | + name: Cabal Check |
| 59 | + runs-on: ubuntu-22.04 |
| 60 | + steps: |
| 61 | + - name: Checkout |
| 62 | + uses: actions/checkout@v4 |
| 63 | + |
| 64 | + - name: Setup Stack (for docker env) |
| 65 | + uses: flipstone/github-actions/setup-dockerized-stack@bef3396e6c3777767d1d4837203cfdb2635b4933 |
| 66 | + with: |
| 67 | + stack-root: ./stack-root |
| 68 | + |
| 69 | + - name: Check for Hackage releasable issues |
| 70 | + run: docker compose run --rm dev cabal check |
| 71 | + |
| 72 | + shellcheck: |
| 73 | + name: shellcheck |
| 74 | + runs-on: ubuntu-22.04 |
| 75 | + steps: |
| 76 | + - name: Checkout |
| 77 | + uses: actions/checkout@v4 |
| 78 | + |
| 79 | + - name: Setup Stack (for docker env) |
| 80 | + uses: flipstone/github-actions/setup-dockerized-stack@bef3396e6c3777767d1d4837203cfdb2635b4933 |
| 81 | + with: |
| 82 | + stack-root: ./stack-root |
| 83 | + |
| 84 | + - name: Format and Check for Diff |
| 85 | + run: scripts/shellcheck |
| 86 | + |
| 87 | + cabal-latest-build: |
| 88 | + name: Cabal Build |
| 89 | + runs-on: ubuntu-22.04 |
| 90 | + steps: |
| 91 | + - name: Checkout |
| 92 | + uses: actions/checkout@v4 |
| 93 | + |
| 94 | + - name: Setup Stack (for docker env) |
| 95 | + uses: flipstone/github-actions/setup-dockerized-stack@bef3396e6c3777767d1d4837203cfdb2635b4933 |
| 96 | + with: |
| 97 | + stack-root: ./stack-root |
| 98 | + |
| 99 | + - name: Build with cabal and latest ghc+deps |
| 100 | + # When a new ghc version is released, we might not be able to build all the dependencies for |
| 101 | + # a little while. So we need to allow failure here. It is a very unfortunate situation that |
| 102 | + # github does not give us a better UX for this as the closest thing to a required check is |
| 103 | + # not configured here, but seemingly only through the api/webui for "branch protection" |
| 104 | + continue-on-error: true |
| 105 | + run: scripts/cabal-latest |
0 commit comments