From 5b75a14867aad2b0440b0a433582d47440312e49 Mon Sep 17 00:00:00 2001 From: Eitan Chatav Date: Sat, 3 Oct 2026 11:29:28 -0700 Subject: [PATCH] GitHub Actions CI Test with cabal on GHC 9.6 through 9.14 on Linux, plus GHC 9.10 on macOS and Windows, and with stack against stack.yaml. Each cabal job builds, tests (spec and doctests), runs cabal check, generates haddocks and makes an sdist. GHC environment files are enabled so doctest-parallel can find the package's dependencies under cabal. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 111 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8dc34c4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,111 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + cabal: + name: cabal / ghc ${{ matrix.ghc }} / ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + ghc: ['9.6', '9.8', '9.10', '9.12', '9.14'] + include: + - os: macos-latest + ghc: '9.10' + - os: windows-latest + ghc: '9.10' + + steps: + - uses: actions/checkout@v7 + + - name: Set up GHC ${{ matrix.ghc }} + uses: haskell-actions/setup@v2 + id: setup + with: + ghc-version: ${{ matrix.ghc }} + cabal-version: latest + cabal-update: true + + # doctest-parallel needs a GHC environment file, written by the build step. + - name: Configure the build + run: | + cabal configure --enable-tests --disable-documentation --write-ghc-environment-files=always + cabal build all --dry-run + + - name: Restore cached dependencies + uses: actions/cache/restore@v6 + 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: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }} + restore-keys: ${{ env.key }}- + + - name: Install dependencies + run: cabal build all --only-dependencies + + - name: Save cached dependencies + uses: actions/cache/save@v6 + 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: Test + run: cabal test all --test-show-details=direct + + - name: Check + run: cabal check + + - name: Documentation + run: cabal haddock all + + - name: Source distribution + run: cabal sdist + + stack: + name: stack / ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v7 + + - name: Set up stack + uses: haskell-actions/setup@v2 + with: + enable-stack: true + stack-no-global: true + stack-version: latest + + - name: Cache stack + uses: actions/cache@v6 + with: + path: | + ~/.stack + .stack-work + key: ${{ runner.os }}-stack-${{ hashFiles('stack.yaml', 'package.yaml') }} + restore-keys: ${{ runner.os }}-stack- + + - name: Build and test + run: stack build --test --haddock --no-haddock-deps