|
| 1 | +name: Haskell CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "main" |
| 7 | + pull_request: |
| 8 | + merge_group: |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + |
| 17 | +# Set the default shell on all platforms. |
| 18 | +defaults: |
| 19 | + run: |
| 20 | + shell: sh |
| 21 | + |
| 22 | +jobs: |
| 23 | + ################################################################################ |
| 24 | + # Build |
| 25 | + ################################################################################ |
| 26 | + build: |
| 27 | + runs-on: ${{ matrix.os }} |
| 28 | + timeout-minutes: 60 |
| 29 | + |
| 30 | + strategy: |
| 31 | + fail-fast: false |
| 32 | + # Picking matrix combinations is tricky as it's a trade-off: on the one |
| 33 | + # hand we want to test as many interesting combinations as possible, but |
| 34 | + # on the other hand we don't want combinatorial explosion. We strike a |
| 35 | + # balance as follows: |
| 36 | + # |
| 37 | + # * Build and test with all combinations of OS/GHC/Cabal, but with a fixed |
| 38 | + # Botan version, preferably the latest version which is currently |
| 39 | + # Botan-3.9.0. |
| 40 | + # |
| 41 | + # * Build and test with all Botan versions, but with a fixed OS/GHC/Cabal |
| 42 | + # combination, preferably Linux/GHC-9.6/Cabal-3.12 |
| 43 | + matrix: |
| 44 | + os: ["ubuntu-latest", "macOS-latest", "windows-latest"] |
| 45 | + #ghc-version: ["9.2", "9.4", "9.6", "9.8", "9.10", "9.12"] |
| 46 | + ghc-version: ["9.6"] |
| 47 | + cabal-version: ["3.12"] |
| 48 | + botan-version: ["3.9.0"] |
| 49 | + #include: |
| 50 | + #- os: "ubuntu-latest" |
| 51 | + # ghc-version: "9.6" |
| 52 | + # cabal-version: "3.12" |
| 53 | + # botan-version: "3.0.0" |
| 54 | + #- os: "ubuntu-latest" |
| 55 | + # ghc-version: "9.6" |
| 56 | + # cabal-version: "3.12" |
| 57 | + # botan-version: "3.1.1" |
| 58 | + #- os: "ubuntu-latest" |
| 59 | + # ghc-version: "9.6" |
| 60 | + # cabal-version: "3.12" |
| 61 | + # botan-version: "3.2.0" |
| 62 | + #- os: "ubuntu-latest" |
| 63 | + # ghc-version: "9.6" |
| 64 | + # cabal-version: "3.12" |
| 65 | + # botan-version: "3.3.0" |
| 66 | + #- os: "ubuntu-latest" |
| 67 | + # ghc-version: "9.6" |
| 68 | + # cabal-version: "3.12" |
| 69 | + # botan-version: "3.4.0" |
| 70 | + #- os: "ubuntu-latest" |
| 71 | + # ghc-version: "9.6" |
| 72 | + # cabal-version: "3.12" |
| 73 | + # botan-version: "3.5.0" |
| 74 | + #- os: "ubuntu-latest" |
| 75 | + # ghc-version: "9.6" |
| 76 | + # cabal-version: "3.12" |
| 77 | + # botan-version: "3.6.1" |
| 78 | + #- os: "ubuntu-latest" |
| 79 | + # ghc-version: "9.6" |
| 80 | + # cabal-version: "3.12" |
| 81 | + # botan-version: "3.7.1" |
| 82 | + #- os: "ubuntu-latest" |
| 83 | + # ghc-version: "9.6" |
| 84 | + # cabal-version: "3.12" |
| 85 | + # botan-version: "3.8.1" |
| 86 | + |
| 87 | + steps: |
| 88 | + - name: 📥 Checkout repository |
| 89 | + uses: actions/checkout@v5 |
| 90 | + |
| 91 | + - name: 🛠️ Setup Botan |
| 92 | + uses: ./.github/actions/setup-botan |
| 93 | + timeout-minutes: 30 |
| 94 | + with: |
| 95 | + botan-version: ${{ matrix.botan-version }} |
| 96 | + |
| 97 | + - name: 🛠️ Setup Haskell |
| 98 | + id: setup-haskell |
| 99 | + uses: haskell-actions/setup@v2 |
| 100 | + with: |
| 101 | + ghc-version: ${{ matrix.ghc-version }} |
| 102 | + cabal-version: ${{ matrix.cabal-version }} |
| 103 | + |
| 104 | + - name: 🛠️ Configure |
| 105 | + run: | |
| 106 | + cabal configure \ |
| 107 | + --enable-tests \ |
| 108 | + --enable-benchmarks \ |
| 109 | + --disable-documentation \ |
| 110 | + --ghc-options="-Werror" \ |
| 111 | + cat "cabal.project.local" |
| 112 | +
|
| 113 | + # This step will generate a dist-newstyle/cache/plan.json file. This file is |
| 114 | + # hashed and the resulting hash is included in the cache key. |
| 115 | + - name: 💾 Generate Cabal plan |
| 116 | + run: | |
| 117 | + cabal build all --dry-run |
| 118 | +
|
| 119 | + - name: 💾 Restore cache |
| 120 | + uses: actions/cache/restore@v4 |
| 121 | + id: restore-cabal-cache |
| 122 | + env: |
| 123 | + key: build-botan-${{ runner.os }}-ghc-${{ steps.setup-haskell.outputs.ghc-version }}-cabal-${{ steps.setup-haskell.outputs.cabal-version }}-Botan-${{ matrix.botan-version }} |
| 124 | + with: |
| 125 | + path: ${{ steps.setup-haskell.outputs.cabal-store }} |
| 126 | + key: ${{ env.key }}-plan-${{ hashFiles('dist-newstyle/cache/plan.json') }} |
| 127 | + restore-keys: ${{ env.key }}- |
| 128 | + |
| 129 | + - name: 🛠️ Build Cabal dependencies |
| 130 | + run: | |
| 131 | + cabal build all --only-dependencies |
| 132 | +
|
| 133 | + - name: 💾 Save cache |
| 134 | + uses: actions/cache/save@v4 |
| 135 | + if: ${{ steps.restore-cabal-cache.outputs.cache-hit != 'true' }} |
| 136 | + with: |
| 137 | + path: ${{ steps.setup-haskell.outputs.cabal-store }} |
| 138 | + key: ${{ steps.restore-cabal-cache.outputs.cache-primary-key }} |
| 139 | + |
| 140 | + - name: 🏗️ Build |
| 141 | + run: | |
| 142 | + cabal build all |
| 143 | +
|
| 144 | + - name: 🧪 Test |
| 145 | + id: test |
| 146 | + run: | |
| 147 | + cabal test all -j1 --test-show-details=direct |
| 148 | + env: |
| 149 | + # Most tests in the repositoy use hspec instead of Tasty, but we make |
| 150 | + # sure to include a timeout for Tasty tests regardless. |
| 151 | + TASTY_TIMEOUT: "5m" |
0 commit comments