diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 2e71619..79fa948 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -1,4 +1,6 @@ name: Haskell-CI +permissions: + contents: read on: push: @@ -15,13 +17,13 @@ concurrency: cancel-in-progress: true jobs: - linux: - name: Haskell-CI - Linux - ${{ matrix.ghc-version }} + test-with-cabal: + name: Haskell-CI - Linux - cabal - ${{ matrix.ghc-version }} strategy: matrix: ghc-version: [latest, 9.12, "9.10", 9.8, 9.6] - os: [ubuntu-24.04] + os: [ubuntu-latest] fail-fast: false runs-on: ${{ matrix.os }} @@ -43,3 +45,59 @@ jobs: with: key: ${{ matrix.os }}-${{ matrix.ghc-version }}-${{ github.sha }} path: ~/.cabal/store + + + test-with-stack: + name: Stack + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + resolver: [lts-24, nightly] + ghc-version: [latest, 9.12, "9.10", 9.8, 9.6] + env: + STACK_ARGS: '--resolver ${{ matrix.resolver }} --system-ghc' + steps: + - uses: actions/checkout@v4 + + - uses: haskell-actions/setup@v2 + id: setup-haskell-cabal + name: Setup Haskell + with: + ghc-version: ${{ matrix.ghc }} + enable-stack: true + stack-version: ${{ matrix.stack || 'latest' }} + + - name: Cache + id: cache + uses: actions/cache@v4 + with: + path: | + ${{ steps.setup-haskell-cabal.outputs.stack-root }} + .stack-work + key: ${{ runner.os }}-${{ matrix.resolver }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-${{ matrix.resolver }} + - name: Reset modtime + run: | + set -ex + curl -sSL https://raw.githubusercontent.com/lehins/utils/master/haskell/git-modtime/git-modtime.hs -o git-modtime.hs + runhaskell -- git-modtime.hs -f .stack-work-root/tree-contents.txt + - name: Build + run: | + set -ex + stack $STACK_ARGS test --no-run-tests --bench --no-run-benchmarks --haddock --no-haddock-deps + - name: Test + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + run: | + set -ex + if [ "${{ matrix.os }}.${{ matrix.resolver }}" == "ubuntu-latest.lts-24" ] && [ -n "${COVERALLS_REPO_TOKEN}" ]; then + stack $STACK_ARGS test --coverage + stack $STACK_ARGS hpc report --all + curl -L https://github.com/rubik/stack-hpc-coveralls/releases/download/v0.0.7.0/shc-Linux-X64.tar.bz2 | tar xj shc + ./shc --repo-token="$COVERALLS_REPO_TOKEN" --partial-coverage --fetch-coverage combined custom + else + stack $STACK_ARGS test + fi diff --git a/stack.yaml b/stack.yaml new file mode 100644 index 0000000..ea8c26a --- /dev/null +++ b/stack.yaml @@ -0,0 +1,67 @@ +# This file was automatically generated by 'stack init' +# +# Some commonly used options have been documented as comments in this file. +# For advanced use and comprehensive documentation of the format, please see: +# https://docs.haskellstack.org/en/stable/configure/yaml/ + +# A 'specific' Stackage snapshot or a compiler version. +# A snapshot resolver dictates the compiler version and the set of packages +# to be used for project dependencies. For example: +# +# snapshot: lts-23.24 +# snapshot: nightly-2025-06-15 +# snapshot: ghc-9.8.4 +# +# The location of a snapshot can be provided as a file or url. Stack assumes +# a snapshot provided as a file might change, whereas a url resource does not. +# +# snapshot: ./custom-snapshot.yaml +# snapshot: https://example.com/snapshots/2024-01-01.yaml +snapshot: + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/24/14.yaml + +# User packages to be built. +# Various formats can be used as shown in the example below. +# +# packages: +# - some-directory +# - https://example.com/foo/bar/baz-0.0.2.tar.gz +# subdirs: +# - auto-update +# - wai +packages: +- . +# Dependency packages to be pulled from upstream that are not in the snapshot. +# These entries can reference officially published versions as well as +# forks / in-progress versions pinned to a git hash. For example: +# +# extra-deps: +# - acme-missiles-0.3 +# - git: https://github.com/commercialhaskell/stack.git +# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a +# +# extra-deps: [] + +# Override default flag values for project packages and extra-deps +# flags: {} + +# Extra package databases containing global packages +# extra-package-dbs: [] + +# Control whether we use the GHC we find on the path +# system-ghc: true +# +# Require a specific version of Stack, using version ranges +# require-stack-version: -any # Default +# require-stack-version: ">=3.7" +# +# Override the architecture used by Stack, especially useful on Windows +# arch: i386 +# arch: x86_64 +# +# Extra directories used by Stack for building +# extra-include-dirs: [/path/to/dir] +# extra-lib-dirs: [/path/to/dir] +# +# Allow a newer minor version of GHC than the snapshot specifies +# compiler-check: newer-minor