packages feed

express-1.0.14: .github/workflows/build.yml

# Builds and tests this Haskell project on "GitHub Actions"
#
# 2021-2024  Rudy Matela
#
# some docs: https://github.com/haskell-actions/setup
#
# The official haskell docker image: https://hub.docker.com/_/haskell
name: build
on: [push]
jobs:
  build-and-test:
    runs-on: ubuntu-latest
    steps:

      - name: Cache ~/.cabal/packages
        uses: actions/cache@v3
        with:
          path: ~/.cabal/packages
          key:          v1-${{ runner.os }}-cabal-packages-${{ hashFiles('*.cabal') }}
          restore-keys: v1-${{ runner.os }}-cabal-packages-

      - name: Cache ~/.cabal and ~/.ghc
        uses: actions/cache@v3
        with:
          path: |
            ~/.cabal
            !~/.cabal/packages
            ~/.ghc
          key:          v1-${{ runner.os }}-cabal-ghc-latest-${{ hashFiles('*.cabal') }}
          restore-keys: v1-${{ runner.os }}-cabal-ghc-latest-

      - run: du -hd3 ~/.cabal ~/.ghc || true

      - run: make --version

      - run: haddock --version || sudo apt-get install ghc-haddock
      - run: ghc     --version
      - run: cabal   --version
      - run: haddock --version
      - run: ghc-pkg list

      - name: Check out repository
        uses: actions/checkout@v3

      - run: git --version

      - run: make install-dependencies

      # 2023-07: some projects were failing with missing base for GHC 9.6.
      #          Here we compile through cabal only provisionally.
      # - run: make
      # - run: make test
      # - run: make haddock
      - run: make test-sdist
      #- run: make test-via-cabal
      - run: cabal configure --enable-tests --enable-benchmarks --ghc-options="-O0"
      - run: cabal build
      - run: cabal test
      - run: cabal haddock


  test-with-ghc:
    strategy:
      matrix:
        ghc:
          - '9.8'
          - '9.6'
          - '9.4'
          - '9.2'
          - '9.0'
          - '8.10'
          - '8.6'
          - '8.2'
    runs-on: ubuntu-latest
    needs: build-and-test
    container: haskell:${{ matrix.ghc }}
    steps:
      - name: Cache ~/.cabal/packages
        uses: actions/cache@v3
        with:
          path: ~/.cabal/packages
          key:          v1-${{ runner.os }}-cabal-packages-${{ hashFiles('*.cabal') }}
          restore-keys: v1-${{ runner.os }}-cabal-packages-

      - name: Cache ~/.cabal and ~/.ghc
        uses: actions/cache@v3
        with:
          path: |
            ~/.cabal
            !~/.cabal/packages
            ~/.ghc
          key:          v1-${{ runner.os }}-cabal-ghc-${{ matrix.ghc }}-${{ hashFiles('*.cabal') }}
          restore-keys: v1-${{ runner.os }}-cabal-ghc-${{ matrix.ghc }}-

      - run: du -hd3 ~/.cabal ~/.ghc || true

      - run: make --version || rm /etc/apt/sources.list.d/*.list # faster update
      - run: make --version || apt-get update
      - run: make --version || apt-get install make

      - run: ghc     --version
      - run: cabal   --version
      - run: haddock --version
      - run: ghc-pkg list

      - name: Check out repository
        uses: actions/checkout@v3

      - run: make install-dependencies

      - run: make
      - run: make test
      - run: make haddock
      - run: make test-sdist
      - run: make test-via-cabal

  test-with-stack:
    runs-on: ubuntu-latest
    needs: build-and-test
    steps:
      - name: Setup Haskell's GHC and Cabal as required by current Stackage LTS
        uses: haskell-actions/setup@v2
        with: # lts-19.19
          ghc-version: '9.0.2'
          cabal-version: '3.4'

      - uses: actions/cache@v3
        with:
          path: ~/.stack
          key:          v1-${{ runner.os }}-stack-${{ hashFiles('stack.yaml') }}
          restore-keys: v1-${{ runner.os }}-stack-

      - run: stack --version

      - name: Check out repository
        uses: actions/checkout@v3
      - run: make test-via-stack

  test-with-hugs:
    runs-on: ubuntu-latest
    needs: build-and-test
    steps:
      - run: sudo apt-get update
      - run: sudo apt-get install hugs
      - name: Check out repository
        uses: actions/checkout@v3
      - run: make hugs-test