|
| 1 | +name: Check release builds |
| 2 | + |
| 3 | +on: workflow_dispatch |
| 4 | + |
| 5 | +concurrency: |
| 6 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 7 | + cancel-in-progress: true |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +# Set the default shell on all platforms. |
| 13 | +defaults: |
| 14 | + run: |
| 15 | + shell: sh |
| 16 | + |
| 17 | +jobs: |
| 18 | + ################################################################################ |
| 19 | + # Build |
| 20 | + ################################################################################ |
| 21 | + build: |
| 22 | + name: | |
| 23 | + ${{ format( |
| 24 | + 'Check release build on {0}{1}{2}', |
| 25 | + startsWith(matrix.os, 'ubuntu-') && 'Linux' || startsWith(matrix.os, 'macOS-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows', |
| 26 | + matrix.ghc-version && format(' with GHC {0}', matrix.ghc-version), |
| 27 | + matrix.cabal-version && format(' and Cabal {0}', matrix.cabal-version) |
| 28 | + ) |
| 29 | + }} |
| 30 | + runs-on: ${{ matrix.os }} |
| 31 | + timeout-minutes: 60 |
| 32 | + |
| 33 | + steps: |
| 34 | + - name: 📥 Checkout repository |
| 35 | + uses: actions/checkout@v4 |
| 36 | + |
| 37 | + - name: 🗄️ Print Job info |
| 38 | + run: | |
| 39 | + echo 'matrix.os: ${{ matrix.os }}' |
| 40 | + echo 'matrix.ghc-version: ${{ matrix.ghc-version || env.DEFAULT_GHC_VERSION }}' |
| 41 | + echo 'matrix.cabal-version: ${{ matrix.os || env.DEFAULT_CABAL_VERSION }}' |
| 42 | + echo 'toJSON(matrix): ${{ toJSON(matrix) }}' |
| 43 | +
|
| 44 | + - name: 🛠️ Setup Haskell |
| 45 | + id: setup-haskell |
| 46 | + uses: haskell-actions/setup@v2 |
| 47 | + with: |
| 48 | + ghc-version: ${{ matrix.ghc-version }} |
| 49 | + cabal-version: ${{ matrix.cabal-version }} |
| 50 | + |
| 51 | + - name: 🛠️ Setup system dependencies (Linux) |
| 52 | + if: ${{ runner.os == 'Linux' }} |
| 53 | + run: sudo apt-get update && sudo apt-get -y install liburing-dev librocksdb-dev |
| 54 | + env: |
| 55 | + DEBIAN_FRONTEND: "noninteractive" |
| 56 | + |
| 57 | + - name: 🛠️ Configure |
| 58 | + run: | |
| 59 | + touch "cabal.project.temp" |
| 60 | + cabal configure \ |
| 61 | + --project-file="cabal.project.temp" \ |
| 62 | + --disable-tests \ |
| 63 | + --disable-benchmarks \ |
| 64 | + --index-state=HEAD \ |
| 65 | + --ghc-options="-Werror" \ |
| 66 | + cat "cabal.project.temp.local" |
| 67 | +
|
| 68 | + - name: 💾 Generate Cabal plan |
| 69 | + run: | |
| 70 | + cabal build all \ |
| 71 | + --project-file="cabal.project.temp" \ |
| 72 | + --dry-run |
| 73 | +
|
| 74 | + - name: 💾 Restore Cabal dependencies |
| 75 | + uses: actions/cache/restore@v4 |
| 76 | + if: ${{ !env.ACT }} |
| 77 | + id: cache-cabal |
| 78 | + env: |
| 79 | + key: check-release-build-${{ runner.os }}-ghc-${{ steps.setup-haskell.outputs.ghc-version }}-cabal-${{ steps.setup-haskell.outputs.cabal-version }} |
| 80 | + with: |
| 81 | + path: ${{ steps.setup-haskell.outputs.cabal-store }} |
| 82 | + key: ${{ env.key }}-plan-${{ hashFiles('dist-newstyle/cache/plan.json') }} |
| 83 | + restore-keys: ${{ env.key }}- |
| 84 | + |
| 85 | + - name: 🛠️ Build Cabal dependencies |
| 86 | + run: | |
| 87 | + cabal build all \ |
| 88 | + --project-file="cabal.project.temp" \ |
| 89 | + --only-dependencies |
| 90 | +
|
| 91 | + - name: 💾 Save Cabal dependencies |
| 92 | + uses: actions/cache/save@v4 |
| 93 | + if: ${{ !env.ACT && steps.cache-cabal.outputs.cache-hit != 'true' }} |
| 94 | + with: |
| 95 | + path: ${{ steps.setup-haskell.outputs.cabal-store }} |
| 96 | + key: ${{ steps.cache-cabal.outputs.cache-primary-key }} |
| 97 | + |
| 98 | + - name: 🏗️ Build |
| 99 | + run: | |
| 100 | + cabal build all \ |
| 101 | + --project-file="cabal.project.temp" |
| 102 | +
|
| 103 | + strategy: |
| 104 | + fail-fast: false |
| 105 | + matrix: |
| 106 | + os: ["ubuntu-latest", "macOS-latest", "windows-latest"] |
| 107 | + ghc-version: ["9.2", "9.4", "9.6", "9.8", "9.10", "9.12"] |
| 108 | + cabal-version: ["3.12"] |
0 commit comments