Skip to content

Commit

Permalink
haskell-ci: patch workflow to skip PackageMap.hs in doctests
Browse files Browse the repository at this point in the history
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:
haskell-CI/haskell-ci#519
  • Loading branch information
sternenseemann committed Jun 5, 2021
1 parent ae11091 commit c833b31
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 27 deletions.
13 changes: 13 additions & 0 deletions distribution-nixpkgs/.github/workflows/ci-skip-package-map.patch
Original file line number Diff line number Diff line change
@@ -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
70 changes: 43 additions & 27 deletions distribution-nixpkgs/.github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# 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
#
# haskell-ci regenerate
#
# 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:
Expand All @@ -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
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c833b31

Please sign in to comment.