name: Haskell CI on: push: branches: - master pull_request: jobs: build: name: GHC ${{matrix.name}} env: # packcheck environment variables LC_ALL: C.UTF-8 BUILD: ${{ matrix.build }} GHCVER: ${{ matrix.ghc_version }} DISABLE_DOCS: ${{ matrix.disable_docs }} DISABLE_TEST: ${{ matrix.disable_test }} DISABLE_BENCH: ${{ matrix.disable_bench }} DISABLE_DIST_CHECKS: ${{ matrix.disable_dist_checks }} SDIST_OPTIONS: ${{ matrix.sdist_options }} DISABLE_SDIST_BUILD: ${{ matrix.disable_sdist_build }} # Cabal options CABAL_REINIT_CONFIG: y # Github has machines with 2 CPUS and 6GB memory so the cabal jobs # default (ncpus) is good, this can be checked from the packcheck # output in case it changes. CABAL_BUILD_OPTIONS: ${{ matrix.cabal_build_options }} --flag limit-build-mem CABAL_BUILD_TARGETS: ${{ matrix.cabal_build_targets }} CABAL_PROJECT: ${{ matrix.cabal_project }} CABAL_CHECK_RELAX: y # Stack options STACK_UPGRADE: "y" RESOLVER: ${{ matrix.resolver }} STACK_YAML: ${{ matrix.stack_yaml }} STACK_BUILD_OPTIONS: ${{ matrix.stack_build_options }} # packcheck location and revision PACKCHECK_LOCAL_PATH: "./packcheck.sh" PACKCHECK_GITHUB_URL: "https://raw.githubusercontent.com/composewell/packcheck" PACKCHECK_GITHUB_COMMIT: "075e13ab716c67d2110db4905ae42b0280af046d" # Pull token from "secrets" setting of the github repo COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} COVERAGE: ${{ matrix.coverage }} DOCTEST: ${{ matrix.doctest }} runs-on: ${{ matrix.runner }} continue-on-error: ${{ matrix.ignore_error }} strategy: fail-fast: true matrix: # The order is important to optimize fail-fast. name: - 8.10.7-sdist-fusion-inspection-Werror - 9.2.2-docspec # - 8.10.7-coverage # Note: if cabal.project is not specified benchmarks and tests won't # run. But we need at least one test where we test without # cabal.project because that is how hackage would build it. include: - name: head ghc_version: head runner: ubuntu-latest build: cabal cabal_version: latest cabal_project: cabal.project.ghc-head disable_sdist_build: "y" ignore_error: true - name: 9.2.2 ghc_version: 9.2.2 runner: ubuntu-latest build: cabal cabal_project: cabal.project cabal_version: 3.6 disable_sdist_build: "y" ignore_error: false - name: 9.2.2-docspec ghc_version: 9.2.2 runner: ubuntu-latest doctest: "y" cabal_version: 3.6 cabal_project: cabal.project ignore_error: false - name: 9.0.2 ghc_version: 9.0.2 runner: ubuntu-latest build: cabal cabal_version: 3.6 cabal_project: cabal.project disable_sdist_build: "y" ignore_error: true - name: 8.10.7-sdist-stack runner: ubuntu-latest build: stack resolver: lts-18.23 stack_yaml: stack.yaml sdist_options: "--ignore-check" stack_build_options: "--flag streamly-benchmarks:-opt" cabal_version: 3.6 ignore_error: false - name: 8.10.7-macos ghc_version: 8.10.7 runner: macos-latest build: cabal cabal_version: 3.6 cabal_project: cabal.project disable_sdist_build: "y" ignore_error: false # - name: 8.10.7-coverage # ghc_version: 8.10.7 # runner: ubuntu-latest # coverage: "y" # cabal_version: 3.6 # ignore_error: false - name: 8.10.7-sdist-fusion-inspection-Werror ghc_version: 8.10.7 runner: ubuntu-latest build: cabal cabal_version: 3.6 cabal_project: cabal.project.Werror cabal_build_options: "--flag fusion-plugin --flag inspection" ignore_error: false - name: 8.8.4-sdist-fusion ghc_version: 8.8.4 runner: ubuntu-latest build: cabal cabal_version: 3.6 cabal_project: cabal.project cabal_build_options: "--flag fusion-plugin" ignore_error: false - name: 8.6.5-sdist-streamk-unoptimized ghc_version: 8.6.5 runner: ubuntu-latest build: cabal cabal_version: 3.6 cabal_project: cabal.project cabal_build_options: "--flag streamk --flag -opt" ignore_error: false - name: 8.6.5-sdist-debug-unoptimized ghc_version: 8.6.5 runner: ubuntu-latest build: cabal cabal_version: 3.6 cabal_project: cabal.project cabal_build_options: "--flag debug --flag -opt" ignore_error: false - name: 8.4.4-sdist ghc_version: 8.4.4 runner: ubuntu-latest build: cabal cabal_version: 3.6 cabal_project: cabal.project ignore_error: false steps: - uses: actions/checkout@v2 - uses: actions/cache@v1 name: Cache ~/.cabal with: path: ~/.cabal # Bump the key version to clear the cache key: ${{ runner.os }}-${{ matrix.ghc_version }}-cabal-v1 - name: Download packcheck run: | # Get packcheck if needed CURL=$(which curl) PACKCHECK_URL=${PACKCHECK_GITHUB_URL}/${PACKCHECK_GITHUB_COMMIT}/packcheck.sh if test ! -e "$PACKCHECK_LOCAL_PATH"; then $CURL -sL -o "$PACKCHECK_LOCAL_PATH" $PACKCHECK_URL; fi; chmod +x $PACKCHECK_LOCAL_PATH os=$(uname -s -m) case "$os" in "Linux x86_64") GHCUP_ARCH="x86_64-linux" ;; "Darwin x86_64") GHCUP_ARCH="x86_64-apple-darwin" ;; *) echo "Unknown OS/Arch: $os"; exit 1;; esac $CURL -sL -o ./ghcup https://downloads.haskell.org/~ghcup/0.1.17.4/${GHCUP_ARCH}-ghcup-0.1.17.4 chmod +x ./ghcup if test "$GHCVER" = "head" then ./ghcup install ghc -u https://gitlab.haskell.org/ghc/ghc/-/jobs/artifacts/master/raw/ghc-x86_64-deb10-linux-integer-simple.tar.xz?job=validate-x86_64-linux-deb10-integer-simple head else ./ghcup install ghc $GHCVER fi ./ghcup set ghc $GHCVER - name: Run tests run: | if test -n "$DOCTEST" then mkdir -p $HOME/.cabal/bin curl -sL https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20210111/cabal-docspec-0.0.0.20210111.xz > cabal-docspec.xz echo '0829bd034fba901cbcfe491d98ed8b28fd54f9cb5c91fa8e1ac62dc4413c9562 cabal-docspec.xz' | sha256sum -c - xz -d < cabal-docspec.xz > $HOME/.cabal/bin/cabal-docspec rm -f cabal-docspec.xz chmod a+x $HOME/.cabal/bin/cabal-docspec cabal update cabal build all $HOME/.cabal/bin/cabal-docspec --version $HOME/.cabal/bin/cabal-docspec --timeout 60 --check-properties --property-variables xs elif test -z "$COVERAGE" then export TOOLS_DIR=/opt # /usr/local/opt/curl/bin for macOS export PATH=$HOME/.local/bin:$HOME/.ghcup/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/opt/curl/bin bash -c "$PACKCHECK_LOCAL_PATH $BUILD" fi if test -n "$COVERAGE" then # Run tests with coverage cabal update # Build hpc-coveralls if needed sudo apt-get install -y libcurl4-gnutls-dev export PATH=$HOME/.cabal/bin:$PATH which hpc-coveralls 2>/dev/null || cabal install --project-file cabal.project.hpc-coveralls hpc-coveralls # Run tests and upload results to coveralls.io bin/test.sh --coverage --raw # XXX Uncomment this and fix it properly later # hpc-coveralls --repo-token="$COVERALLS_TOKEN" --coverage-mode=StrictlyFullLines fi