diff --git a/.github/workflows/cabal.yml b/.github/workflows/cabal.yml deleted file mode 100644 index 5cbcbe0..0000000 --- a/.github/workflows/cabal.yml +++ /dev/null @@ -1,73 +0,0 @@ -# https://github.com/haskell/actions/tree/main/setup - -name: build -on: - push: - branches: [main, master] - pull_request: - branches: [main, master] - -permissions: - contents: read - -jobs: - build: - name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - ghc-version: ['9.6', '9.4', '9.2', '9.0'] - - steps: - - uses: actions/checkout@v3 - - - name: Set up GHC ${{ matrix.ghc-version }} - uses: haskell/actions/setup@v2 - id: setup - with: - ghc-version: ${{ matrix.ghc-version }} - # Defaults, added for clarity: - cabal-version: 'latest' - cabal-update: true - - - name: Configure the build - run: | - cabal configure --enable-tests --enable-benchmarks --disable-documentation - cabal build --dry-run - # The last step generates dist-newstyle/cache/plan.json for the cache key. - - - name: Restore cached dependencies - uses: actions/cache/restore@v3 - 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 - - # Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail. - - name: Save cached dependencies - uses: actions/cache/save@v3 - # Caches are immutable, trying to save with the same key would error. - if: ${{ steps.cache.outputs.cache-primary-key != steps.cache.outputs.cache-matched-key }} - with: - path: ${{ steps.setup.outputs.cabal-store }} - key: ${{ steps.cache.outputs.cache-primary-key }} - - - name: Build - run: cabal build all - - - name: Run tests - run: cabal test all - - - name: Check cabal file - run: cabal check - - - name: Build documentation - run: cabal haddock all diff --git a/.github/workflows/stack.yml b/.github/workflows/stack.yml new file mode 100644 index 0000000..cb84f40 --- /dev/null +++ b/.github/workflows/stack.yml @@ -0,0 +1,80 @@ +# https://github.com/haskell/actions/tree/main/setup + +name: build +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +permissions: + contents: read + +jobs: + build: + name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + stackage-version: + - lts-21.23 + - lts-20.26 + - lts-19.33 + - lts-18.28 + - lts-16.31 + + steps: + - uses: actions/checkout@v3 + + - uses: haskell-actions/setup@v2 + name: Set up stack ${{ matrix.stackage-version }} + id: setup + with: + enable-stack: true + stack-version: ${{ matrix.stackage-version }} + + - uses: actions/cache/restore@v3 + name: Restore cached ~/.stack + with: + path: ~/.stack + key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('**/*.cabal') }}-version-${{ matrix.stackage-version }} + restore-keys: | + ${{ runner.os }}-stack-global- + - uses: actions/cache/restore@v3 + name: Restore cached .stack-work + with: + path: .stack-work + key: ${{ runner.os }}-stack-work-${{ hashFiles('stack.yaml') }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/*.hs') }}-version-${{ matrix.stackage-version }} + restore-keys: | + ${{ runner.os }}-stack-work- + + - name: Install dependencies + run: stack build --resolver ${{ matrix.stackage-version }} --dependencies-only --test --bench + + # Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail. + + - uses: actions/cache/save@v3 + name: Cache ~/.stack + with: + path: ~/.stack + key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('**/*.cabal') }}-version-${{ matrix.stackage-version }} + restore-keys: | + ${{ runner.os }}-stack-global- + - uses: actions/cache/save@v3 + name: Cache .stack-work + with: + path: .stack-work + key: ${{ runner.os }}-stack-work-${{ hashFiles('stack.yaml') }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/*.hs') }}-version-${{ matrix.stackage-version }} + restore-keys: | + ${{ runner.os }}-stack-work- + + - name: Build + run: stack build --test --bench + + - name: Run tests + run: stack test + + - name: Build documentation + run: stack haddock