From 9970d99dd38fc7cad99e36489f2b63e164d00b4f Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Sat, 5 Jun 2021 19:51:21 +0200 Subject: [PATCH] haskell-ci: patch workflow to skip PackageMap.hs in doctests We use haskell-ci's weird feature to apply a patch to the workflow file in order to not test PackageMap.hs using doctest since it will always fail -- there seems to be no way to install nix in haskell-ci's ubuntu docker containers. We can hopefully drop this if the following issue gets some kind of resolution: https://github.com/haskell-CI/haskell-ci/issues/519 --- .github/workflows/ci-skip-package-map.patch | 13 ++++ .github/workflows/haskell-ci.yml | 70 +++++++++++++-------- 2 files changed, 56 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/ci-skip-package-map.patch diff --git a/.github/workflows/ci-skip-package-map.patch b/.github/workflows/ci-skip-package-map.patch new file mode 100644 index 0000000..ab6a0a3 --- /dev/null +++ b/.github/workflows/ci-skip-package-map.patch @@ -0,0 +1,13 @@ +diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml +index 5ed81c0..9bb7e56 100644 +--- a/.github/workflows/haskell-ci.yml ++++ b/.github/workflows/haskell-ci.yml +@@ -179,7 +179,7 @@ jobs: + - name: doctest + run: | + cd ${PKGDIR_distribution_nixpkgs} || false +- doctest -i ../../dist-newstyle/build/*/*/distribution-nixpkgs-*/build/autogen src ++ doctest -i ../../dist-newstyle/build/*/*/distribution-nixpkgs-*/build/autogen src/Distribution/Nixpkgs/Hashes.hs src/Distribution/Nixpkgs/License.hs src/Distribution/Nixpkgs/Meta.hs src/Language/Nix/PrettyPrinting.hs + - name: hlint + run: | + if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then (cd ${PKGDIR_distribution_nixpkgs} && hlint src) ; fi diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 98e43bb..5eb6f44 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -1,6 +1,6 @@ # This GitHub workflow config has been generated by a script via # -# haskell-ci '--doctest' '--doctest-version=>0.18' '--doctest-options=-i ../../dist-newstyle/build/*/*/distribution-nixpkgs-*/build/autogen' '--hlint' 'github' 'distribution-nixpkgs.cabal' +# haskell-ci '--github-patches' '.github/workflows/ci-skip-package-map.patch' '--doctest' '--doctest-version=>0.18' '--doctest-options=-i ../../dist-newstyle/build/*/*/distribution-nixpkgs-*/build/autogen' '--hlint' 'github' 'distribution-nixpkgs.cabal' # # To regenerate the script (for example after adjusting tested-with) run # @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.13.20210525 +# version: 0.13.20210530 # -# REGENDATA ("0.13.20210525",["--doctest","--doctest-version=>0.18","--doctest-options=-i ../../dist-newstyle/build/*/*/distribution-nixpkgs-*/build/autogen","--hlint","github","distribution-nixpkgs.cabal"]) +# REGENDATA ("0.13.20210530",["--github-patches",".github/workflows/ci-skip-package-map.patch","--doctest","--doctest-version=>0.18","--doctest-options=-i ../../dist-newstyle/build/*/*/distribution-nixpkgs-*/build/autogen","--hlint","github","distribution-nixpkgs.cabal"]) # name: Haskell-CI on: @@ -27,46 +27,61 @@ jobs: matrix: include: - compiler: ghc-9.0.1 + compilerKind: ghc + compilerVersion: 9.0.1 + setup-method: hvr-ppa allow-failure: false - compiler: ghc-8.10.4 + compilerKind: ghc + compilerVersion: 8.10.4 + setup-method: hvr-ppa allow-failure: false - compiler: ghc-8.8.4 + compilerKind: ghc + compilerVersion: 8.8.4 + setup-method: hvr-ppa allow-failure: false - compiler: ghc-8.6.5 + compilerKind: ghc + compilerVersion: 8.6.5 + setup-method: hvr-ppa allow-failure: false fail-fast: false steps: - name: apt run: | apt-get update - apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 apt-add-repository -y 'ppa:hvr/ghc' apt-get update - apt-get install -y $CC cabal-install-3.4 + apt-get install -y "$HCNAME" cabal-install-3.4 env: - CC: ${{ matrix.compiler }} + HCKIND: ${{ matrix.compilerKind }} + HCNAME: ${{ matrix.compiler }} + HCVER: ${{ matrix.compilerVersion }} - name: Set PATH and environment variables run: | echo "$HOME/.cabal/bin" >> $GITHUB_PATH - echo "LANG=C.UTF-8" >> $GITHUB_ENV - echo "CABAL_DIR=$HOME/.cabal" >> $GITHUB_ENV - echo "CABAL_CONFIG=$HOME/.cabal/config" >> $GITHUB_ENV - HCDIR=$(echo "/opt/$CC" | sed 's/-/\//') - HCNAME=ghc - HC=$HCDIR/bin/$HCNAME - echo "HC=$HC" >> $GITHUB_ENV - echo "HCPKG=$HCDIR/bin/$HCNAME-pkg" >> $GITHUB_ENV - echo "HADDOCK=$HCDIR/bin/haddock" >> $GITHUB_ENV - echo "CABAL=/opt/cabal/3.4/bin/cabal -vnormal+nowrap" >> $GITHUB_ENV + echo "LANG=C.UTF-8" >> "$GITHUB_ENV" + echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" + echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" + HCDIR=/opt/$HCKIND/$HCVER + HC=$HCDIR/bin/$HCKIND + echo "HC=$HC" >> "$GITHUB_ENV" + echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV" + echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV" + echo "CABAL=/opt/cabal/3.4/bin/cabal -vnormal+nowrap" >> "$GITHUB_ENV" HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') - echo "HCNUMVER=$HCNUMVER" >> $GITHUB_ENV - echo "ARG_TESTS=--enable-tests" >> $GITHUB_ENV - echo "ARG_BENCH=--enable-benchmarks" >> $GITHUB_ENV - echo "HEADHACKAGE=false" >> $GITHUB_ENV - echo "ARG_COMPILER=--$HCNAME --with-compiler=$HC" >> $GITHUB_ENV - echo "GHCJSARITH=0" >> $GITHUB_ENV + echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" + echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" + echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" + echo "HEADHACKAGE=false" >> "$GITHUB_ENV" + echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" + echo "GHCJSARITH=0" >> "$GITHUB_ENV" env: - CC: ${{ matrix.compiler }} + HCKIND: ${{ matrix.compilerKind }} + HCNAME: ${{ matrix.compiler }} + HCVER: ${{ matrix.compilerVersion }} - name: env run: | env @@ -114,7 +129,7 @@ jobs: cabal-plan --version - name: install doctest run: | - $CABAL --store-dir=$HOME/.haskell-ci-tools/store v2-install $ARG_COMPILER --ignore-project -j2 doctest --constraint='doctest >0.18' + $CABAL --store-dir=$HOME/.haskell-ci-tools/store v2-install $ARG_COMPILER --ignore-project -j2 doctest --constraint='doctest ^>=0.17' doctest --version - name: install hlint run: | @@ -142,7 +157,8 @@ jobs: - name: generate cabal.project run: | PKGDIR_distribution_nixpkgs="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/distribution-nixpkgs-[0-9.]*')" - echo "PKGDIR_distribution_nixpkgs=${PKGDIR_distribution_nixpkgs}" >> $GITHUB_ENV + echo "PKGDIR_distribution_nixpkgs=${PKGDIR_distribution_nixpkgs}" >> "$GITHUB_ENV" + rm -f cabal.project cabal.project.local touch cabal.project touch cabal.project.local echo "packages: ${PKGDIR_distribution_nixpkgs}" >> cabal.project @@ -179,10 +195,10 @@ jobs: - name: doctest run: | cd ${PKGDIR_distribution_nixpkgs} || false - doctest -i ../../dist-newstyle/build/*/*/distribution-nixpkgs-*/build/autogen -XMonadFailDesugaring src + doctest -i ../../dist-newstyle/build/*/*/distribution-nixpkgs-*/build/autogen src/Distribution/Nixpkgs/Hashes.hs src/Distribution/Nixpkgs/License.hs src/Distribution/Nixpkgs/Meta.hs src/Language/Nix/PrettyPrinting.hs - name: hlint run: | - if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then (cd ${PKGDIR_distribution_nixpkgs} && hlint -XMonadFailDesugaring src) ; fi + if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then (cd ${PKGDIR_distribution_nixpkgs} && hlint src) ; fi - name: cabal check run: | cd ${PKGDIR_distribution_nixpkgs} || false