diff --git a/fixtures/matrix-extra.args b/fixtures/matrix-extra.args new file mode 100644 index 00000000..6b69595d --- /dev/null +++ b/fixtures/matrix-extra.args @@ -0,0 +1,2 @@ +--matrix-extra=abc:1,2,3 +--matrix-extra=foo:bar,baz diff --git a/fixtures/matrix-extra.bash b/fixtures/matrix-extra.bash new file mode 100644 index 00000000..3cf447b1 --- /dev/null +++ b/fixtures/matrix-extra.bash @@ -0,0 +1,513 @@ +# SUCCESS +# *INFO* Generating Bash script for testing for GHC versions: 8.0.2 8.2.2 8.4.4 8.6.5 8.8.4 8.10.3 +#!/bin/bash +# shellcheck disable=SC2086,SC2016,SC2046 +# REGENDATA ["--matrix-extra=abc:1,2,3","--matrix-extra=foo:bar,baz","bash","matrix-extra.project"] + +set -o pipefail + +# Mode +############################################################################## + +if [ "$1" = "indocker" ]; then + INDOCKER=true + shift +else + INDOCKER=false +fi + +# Run configuration +############################################################################## + +CFG_CABAL_STORE_CACHE="" +CFG_CABAL_REPO_CACHE="" +CFG_JOBS="8.10.3 8.8.4 8.6.5 8.4.4 8.2.2 8.0.2" +CFG_CABAL_UPDATE=false + +SCRIPT_NAME=$(basename "$0") +START_TIME="$(date +'%s')" + +XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config} + +# Job configuration +############################################################################## + +GHC_VERSION="non-existing" +CABAL_VERSION=3.2 +HEADHACKAGE=false + +# Locale +############################################################################## + +export LC_ALL=C.UTF-8 + +# Utilities +############################################################################## + +SGR_RED='\033[1;31m' +SGR_GREEN='\033[1;32m' +SGR_BLUE='\033[1;34m' +SGR_CYAN='\033[1;96m' +SGR_RESET='\033[0m' # No Color + +put_info() { + printf "$SGR_CYAN%s$SGR_RESET\n" "### $*" +} + +put_error() { + printf "$SGR_RED%s$SGR_RESET\n" "!!! $*" +} + +run_cmd() { + local PRETTYCMD="$*" + local PROMPT + if $INDOCKER; then + PROMPT="$(pwd) >>>" + else + PROMPT=">>>" + fi + + printf "$SGR_BLUE%s %s$SGR_RESET\n" "$PROMPT" "$PRETTYCMD" + + local start_time end_time cmd_duration total_duration + start_time=$(date +'%s') + + "$@" + local RET=$? + + end_time=$(date +'%s') + cmd_duration=$((end_time - start_time)) + total_duration=$((end_time - START_TIME)) + + cmd_min=$((cmd_duration / 60)) + cmd_sec=$((cmd_duration % 60)) + + total_min=$((total_duration / 60)) + total_sec=$((total_duration % 60)) + + if [ $RET -eq 0 ]; then + printf "$SGR_GREEN%s$SGR_RESET (%dm%02ds; %dm%02ds)\n" "<<< $PRETTYCMD" "$cmd_min" "$cmd_sec" "$total_min" "$total_sec" + else + printf "$SGR_RED%s$SGR_RESET\n" "!!! $PRETTYCMD" + exit 1 + fi +} + +run_cmd_if() { + local COND=$1 + shift + + if [ $COND -eq 1 ]; then + run_cmd "$@" + else + local PRETTYCMD="$*" + local PROMPT + PROMPT="$(pwd) (skipping) >>>" + + printf "$SGR_BLUE%s %s$SGR_RESET\n" "$PROMPT" "$PRETTYCMD" + fi +} + +run_cmd_unchecked() { + local PRETTYCMD="$*" + local PROMPT + if $INDOCKER; then + PROMPT="$(pwd) >>>" + else + PROMPT=">>>" + fi + + printf "$SGR_BLUE%s %s$SGR_RESET\n" "$PROMPT" "$PRETTYCMD" + + local start_time end_time cmd_duration total_duration cmd_min cmd_sec total_min total_sec + start_time=$(date +'%s') + + "$@" + + end_time=$(date +'%s') + cmd_duration=$((end_time - start_time)) + total_duration=$((end_time - START_TIME)) + + cmd_min=$((cmd_duration / 60)) + cmd_sec=$((cmd_duration % 60)) + + total_min=$((total_duration / 60)) + total_sec=$((total_duration % 60)) + + printf "$SGR_GREEN%s$SGR_RESET (%dm%02ds; %dm%02ds)\n" "<<< $PRETTYCMD" "$cmd_min" "$cmd_sec" "$total_min" "$total_sec" +} + +change_dir() { + local DIR=$1 + if [ -d "$DIR" ]; then + printf "$SGR_BLUE%s$SGR_RESET\n" "change directory to $DIR" + cd "$DIR" || exit 1 + else + printf "$SGR_RED%s$SGR_RESET\n" "!!! cd $DIR" + exit 1 + fi +} + +change_dir_if() { + local COND=$1 + local DIR=$2 + + if [ $COND -ne 0 ]; then + change_dir "$DIR" + fi +} + +echo_to() { + local DEST=$1 + local CONTENTS=$2 + + echo "$CONTENTS" >> "$DEST" +} + +echo_if_to() { + local COND=$1 + local DEST=$2 + local CONTENTS=$3 + + if [ $COND -ne 0 ]; then + echo_to "$DEST" "$CONTENTS" + fi +} + +install_cabalplan() { + put_info "installing cabal-plan" + + if [ ! -e $CABAL_REPOCACHE/downloads/cabal-plan ]; then + curl -L https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > /tmp/cabal-plan.xz || exit 1 + (cd /tmp && echo "de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz" | sha256sum -c -)|| exit 1 + mkdir -p $CABAL_REPOCACHE/downloads + xz -d < /tmp/cabal-plan.xz > $CABAL_REPOCACHE/downloads/cabal-plan || exit 1 + chmod a+x $CABAL_REPOCACHE/downloads/cabal-plan || exit 1 + fi + + mkdir -p $CABAL_DIR/bin || exit 1 + ln -s $CABAL_REPOCACHE/downloads/cabal-plan $CABAL_DIR/bin/cabal-plan || exit 1 +} + +# Help +############################################################################## + +show_usage() { +cat < $BUILDDIR/cabal/config <= 80200)) cabal.project "package notmuch" +echo_if_to $((HCNUMVER >= 80200)) cabal.project " ghc-options: -Werror=missing-methods" +cat >> cabal.project <> cabal.project.local +run_cmd cat cabal.project +run_cmd cat cabal.project.local + +# dump install plan +put_info "dump install plan" +run_cmd $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all +run_cmd cabal-plan + +# install dependencies +put_info "install dependencies" +run_cmd $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j all +run_cmd $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j all + +# build w/o tests +put_info "build w/o tests" +run_cmd $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all + +# build +put_info "build" +run_cmd $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all + +# tests +put_info "tests" + +# cabal check +put_info "cabal check" +change_dir "${PKGDIR_notmuch}" +run_cmd ${CABAL} -vnormal check +change_dir "$BUILDDIR" + +# haddock +put_info "haddock" +run_cmd $CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all + +# unconstrained build +put_info "unconstrained build" +run_cmd rm -f cabal.project.local +run_cmd $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all + + +# Done +run_cmd echo OK diff --git a/fixtures/matrix-extra.github b/fixtures/matrix-extra.github new file mode 100644 index 00000000..f7c806c5 --- /dev/null +++ b/fixtures/matrix-extra.github @@ -0,0 +1,300 @@ +# SUCCESS +# *INFO* Generating GitHub config for testing for GHC versions: 8.0.2 8.2.2 8.4.4 8.6.5 8.8.4 8.10.3 +# This GitHub workflow config has been generated by a script via +# +# haskell-ci '--matrix-extra=abc:1,2,3' '--matrix-extra=foo:bar,baz' 'github' 'matrix-extra.project' +# +# 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 +# +# REGENDATA ["--matrix-extra=abc:1,2,3","--matrix-extra=foo:bar,baz","github","matrix-extra.project"] +# +name: Haskell-CI +on: + - push + - pull_request +jobs: + linux: + name: Haskell-CI Linux - GHC ${{ matrix.ghc }} + runs-on: ubuntu-18.04 + container: + image: buildpack-deps:bionic + continue-on-error: ${{ matrix.allow-failure }} + strategy: + matrix: + include: + - ghc: 8.10.3 + allow-failure: false + abc: "1" + foo: bar + - ghc: 8.8.4 + allow-failure: false + abc: "1" + foo: bar + - ghc: 8.6.5 + allow-failure: false + abc: "1" + foo: bar + - ghc: 8.4.4 + allow-failure: false + abc: "1" + foo: bar + - ghc: 8.2.2 + allow-failure: false + abc: "1" + foo: bar + - ghc: 8.0.2 + allow-failure: false + abc: "1" + foo: bar + - ghc: 8.10.3 + allow-failure: false + abc: "1" + foo: baz + - ghc: 8.8.4 + allow-failure: false + abc: "1" + foo: baz + - ghc: 8.6.5 + allow-failure: false + abc: "1" + foo: baz + - ghc: 8.4.4 + allow-failure: false + abc: "1" + foo: baz + - ghc: 8.2.2 + allow-failure: false + abc: "1" + foo: baz + - ghc: 8.0.2 + allow-failure: false + abc: "1" + foo: baz + - ghc: 8.10.3 + allow-failure: false + abc: "2" + foo: bar + - ghc: 8.8.4 + allow-failure: false + abc: "2" + foo: bar + - ghc: 8.6.5 + allow-failure: false + abc: "2" + foo: bar + - ghc: 8.4.4 + allow-failure: false + abc: "2" + foo: bar + - ghc: 8.2.2 + allow-failure: false + abc: "2" + foo: bar + - ghc: 8.0.2 + allow-failure: false + abc: "2" + foo: bar + - ghc: 8.10.3 + allow-failure: false + abc: "2" + foo: baz + - ghc: 8.8.4 + allow-failure: false + abc: "2" + foo: baz + - ghc: 8.6.5 + allow-failure: false + abc: "2" + foo: baz + - ghc: 8.4.4 + allow-failure: false + abc: "2" + foo: baz + - ghc: 8.2.2 + allow-failure: false + abc: "2" + foo: baz + - ghc: 8.0.2 + allow-failure: false + abc: "2" + foo: baz + - ghc: 8.10.3 + allow-failure: false + abc: "3" + foo: bar + - ghc: 8.8.4 + allow-failure: false + abc: "3" + foo: bar + - ghc: 8.6.5 + allow-failure: false + abc: "3" + foo: bar + - ghc: 8.4.4 + allow-failure: false + abc: "3" + foo: bar + - ghc: 8.2.2 + allow-failure: false + abc: "3" + foo: bar + - ghc: 8.0.2 + allow-failure: false + abc: "3" + foo: bar + - ghc: 8.10.3 + allow-failure: false + abc: "3" + foo: baz + - ghc: 8.8.4 + allow-failure: false + abc: "3" + foo: baz + - ghc: 8.6.5 + allow-failure: false + abc: "3" + foo: baz + - ghc: 8.4.4 + allow-failure: false + abc: "3" + foo: baz + - ghc: 8.2.2 + allow-failure: false + abc: "3" + foo: baz + - ghc: 8.0.2 + allow-failure: false + abc: "3" + foo: baz + 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-add-repository -y 'ppa:hvr/ghc' + apt-get update + apt-get install -y ghc-$GHC_VERSION cabal-install-3.2 + env: + GHC_VERSION: ${{ matrix.ghc }} + - 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 + HC=/opt/ghc/$GHC_VERSION/bin/ghc + echo "HC=$HC" >> $GITHUB_ENV + echo "HCPKG=/opt/ghc/$GHC_VERSION/bin/ghc-pkg" >> $GITHUB_ENV + echo "HADDOCK=/opt/ghc/$GHC_VERSION/bin/haddock" >> $GITHUB_ENV + echo "CABAL=/opt/cabal/3.2/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 "ARG_COMPILER=--ghc --with-compiler=/opt/ghc/$GHC_VERSION/bin/ghc" >> $GITHUB_ENV + echo "GHCJSARITH=0" >> $GITHUB_ENV + env: + GHC_VERSION: ${{ matrix.ghc }} + - name: env + run: | + env + - name: write cabal config + run: | + mkdir -p $CABAL_DIR + cat >> $CABAL_CONFIG < cabal-plan.xz + echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c - + xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan + rm -f cabal-plan.xz + chmod a+x $HOME/.cabal/bin/cabal-plan + cabal-plan --version + - name: checkout + uses: actions/checkout@v2 + with: + path: source + - name: sdist + run: | + mkdir -p sdist + cd source || false + $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist + - name: unpack + run: | + mkdir -p unpacked + find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \; + - name: generate cabal.project + run: | + PKGDIR_notmuch="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/notmuch-[0-9.]*')" + echo "PKGDIR_notmuch=${PKGDIR_notmuch}" >> $GITHUB_ENV + touch cabal.project + touch cabal.project.local + echo "packages: ${PKGDIR_notmuch}" >> cabal.project + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package notmuch" >> cabal.project ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + cat >> cabal.project <> cabal.project.local + cat cabal.project + cat cabal.project.local + - name: dump install plan + run: | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all + cabal-plan + - name: cache + uses: actions/cache@v2 + with: + key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }} + path: ~/.cabal/store + restore-keys: ${{ runner.os }}-${{ matrix.ghc }}- + - name: install dependencies + run: | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all + - name: build w/o tests + run: | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all + - name: build + run: | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always + - name: cabal check + run: | + cd ${PKGDIR_notmuch} || false + ${CABAL} -vnormal check + - name: haddock + run: | + $CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all + - name: unconstrained build + run: | + rm -f cabal.project.local + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all diff --git a/fixtures/matrix-extra.project b/fixtures/matrix-extra.project new file mode 100644 index 00000000..393d9ee5 --- /dev/null +++ b/fixtures/matrix-extra.project @@ -0,0 +1 @@ +packages: notmuch diff --git a/fixtures/matrix-extra.travis b/fixtures/matrix-extra.travis new file mode 100644 index 00000000..e11b24e2 --- /dev/null +++ b/fixtures/matrix-extra.travis @@ -0,0 +1,150 @@ +# SUCCESS +# *INFO* Generating Travis-CI config for testing for GHC versions: 8.0.2 8.2.2 8.4.4 8.6.5 8.8.4 8.10.3 +# This Travis job script has been generated by a script via +# +# haskell-ci '--matrix-extra=abc:1,2,3' '--matrix-extra=foo:bar,baz' 'travis' 'matrix-extra.project' +# +# 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: ~> 1.0 +language: c +os: linux +dist: xenial +git: + # whether to recursively clone submodules + submodules: false +cache: + directories: + - $HOME/.cabal/packages + - $HOME/.cabal/store + - $HOME/.hlint +before_cache: + - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log + # remove files that are regenerated by 'cabal update' + - rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.* + - rm -fv $CABALHOME/packages/hackage.haskell.org/*.json + - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache + - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar + - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx + - rm -rfv $CABALHOME/packages/head.hackage +jobs: + include: + - compiler: ghc-8.10.3 + addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.10.3","cabal-install-3.4"]}} + os: linux + - compiler: ghc-8.8.4 + addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.4","cabal-install-3.4"]}} + os: linux + - compiler: ghc-8.6.5 + addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.4"]}} + os: linux + - compiler: ghc-8.4.4 + addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.4.4","cabal-install-3.4"]}} + os: linux + - compiler: ghc-8.2.2 + addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.2.2","cabal-install-3.4"]}} + os: linux + - compiler: ghc-8.0.2 + addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.0.2","cabal-install-3.4"]}} + os: linux +before_install: + - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//') + - WITHCOMPILER="-w $HC" + - HADDOCK=$(echo "/opt/$CC/bin/haddock" | sed 's/-/\//') + - HCPKG="$HC-pkg" + - unset CC + - CABAL=/opt/ghc/bin/cabal + - CABALHOME=$HOME/.cabal + - export PATH="$CABALHOME/bin:$PATH" + - TOP=$(pwd) + - "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')" + - echo $HCNUMVER + - CABAL="$CABAL -vnormal+nowrap" + - set -o pipefail + - TEST=--enable-tests + - BENCH=--enable-benchmarks + - HEADHACKAGE=false + - rm -f $CABALHOME/config + - | + echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config + echo "remote-build-reporting: anonymous" >> $CABALHOME/config + echo "write-ghc-environment-files: never" >> $CABALHOME/config + echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config + echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config + echo "world-file: $CABALHOME/world" >> $CABALHOME/config + echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config + echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config + echo "installdir: $CABALHOME/bin" >> $CABALHOME/config + echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config + echo "store-dir: $CABALHOME/store" >> $CABALHOME/config + echo "install-dirs user" >> $CABALHOME/config + echo " prefix: $CABALHOME" >> $CABALHOME/config + echo "repository hackage.haskell.org" >> $CABALHOME/config + echo " url: http://hackage.haskell.org/" >> $CABALHOME/config +install: + - ${CABAL} --version + - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]" + - | + echo "program-default-options" >> $CABALHOME/config + echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config + - cat $CABALHOME/config + - rm -fv cabal.project cabal.project.local cabal.project.freeze + - travis_retry ${CABAL} v2-update -v + # Generate cabal.project + - rm -rf cabal.project cabal.project.local cabal.project.freeze + - touch cabal.project + - | + echo "packages: notmuch" >> cabal.project + - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo 'package notmuch' >> cabal.project ; fi + - "if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi" + - | + - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(notmuch)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done" + - cat cabal.project || true + - cat cabal.project.local || true + - if [ -f "notmuch/configure.ac" ]; then (cd "notmuch" && autoreconf -i); fi + - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} + - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'" + - rm cabal.project.freeze + - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all + - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all +script: + - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX) + # Packaging... + - ${CABAL} v2-sdist all + # Unpacking... + - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/ + - cd ${DISTDIR} || false + - find . -maxdepth 1 -type f -name '*.tar.gz' -exec tar -xvf '{}' \; + - find . -maxdepth 1 -type f -name '*.tar.gz' -exec rm '{}' \; + - PKGDIR_notmuch="$(find . -maxdepth 1 -type d -regex '.*/notmuch-[0-9.]*')" + # Generate cabal.project + - rm -rf cabal.project cabal.project.local cabal.project.freeze + - touch cabal.project + - | + echo "packages: ${PKGDIR_notmuch}" >> cabal.project + - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo 'package notmuch' >> cabal.project ; fi + - "if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi" + - | + - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(notmuch)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done" + - cat cabal.project || true + - cat cabal.project.local || true + # Building... + # this builds all libraries and executables (without tests/benchmarks) + - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all + # Building with tests and benchmarks... + # build & run tests, build benchmarks + - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all --write-ghc-environment-files=always + # cabal check... + - (cd ${PKGDIR_notmuch} && ${CABAL} -vnormal check) + # haddock... + - ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all + # Building without installed constraints for packages in global-db... + - rm -f cabal.project.local + - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all + +# REGENDATA ["--matrix-extra=abc:1,2,3","--matrix-extra=foo:bar,baz","travis","matrix-extra.project"] +# EOF diff --git a/fixtures/notmuch/notmuch.cabal b/fixtures/notmuch/notmuch.cabal new file mode 100644 index 00000000..c98b46a3 --- /dev/null +++ b/fixtures/notmuch/notmuch.cabal @@ -0,0 +1,129 @@ +-- Initial notmuch.cabal generated by cabal init. For further +-- documentation, see http://haskell.org/cabal/users-guide/ + +name: notmuch +version: 0.3.0.0 +synopsis: Haskell binding to Notmuch, the mail indexer +description: + Binding to the notmuch mail indexer, providing a hopefully + somewhat typesafe way to search your email. +license: GPL-3 +license-file: gpl-3.0.txt +extra-source-files: + README.rst +author: Fraser Tweedale +maintainer: frase@frase.id.au +copyright: Copyright (C) 2014-2018 Fraser Tweedale +category: FFI +build-type: Simple +cabal-version: >=1.10 +tested-with: + GHC==8.0.2, GHC==8.2.2, GHC==8.4.4, GHC==8.6.5, GHC==8.8.4, GHC==8.10.3 + +homepage: https://github.com/purebred-mua/hs-notmuch +bug-reports: https://github.com/purebred-mua/hs-notmuch/issues +source-repository head + type: git + location: https://github.com/purebred-mua/hs-notmuch.git + +flag demos + description: Build demonstration programs + default: False + +library + exposed-modules: + Notmuch + Notmuch.Util + + other-modules: + Notmuch.Binding + Notmuch.Binding.Constants + Notmuch.Search + Notmuch.Tag + Notmuch.Talloc + + build-depends: + base >= 4.9 && <5 + , bytestring >= 0.10 && < 0.11 + , deepseq >= 1.4 + , filepath >= 1.0 + , mtl >= 2 && < 3 + , profunctors >= 5 && < 6 + , tagged >= 0.8 && < 1 + , time + , text + + build-tools: + c2hs >= 0.19.1 + + extra-libraries: + notmuch + , talloc + + ghc-options: -Wall + hs-source-dirs: src + default-language: Haskell2010 + +executable hs-notmuch-files + if !flag(demos) + buildable: False + default-language: Haskell2010 + hs-source-dirs: tools + ghc-options: -Wall + main-is: Files.hs + build-depends: + base >= 4.9 + , mtl + , notmuch + +executable hs-notmuch-tag-message + if !flag(demos) + buildable: False + default-language: Haskell2010 + hs-source-dirs: tools + ghc-options: -Wall + main-is: TagMessage.hs + build-depends: + base >= 4.9 + , bytestring + , mtl + , notmuch + +executable hs-notmuch-tag-count + if !flag(demos) + buildable: False + default-language: Haskell2010 + hs-source-dirs: tools + ghc-options: -Wall + main-is: TagCount.hs + build-depends: + base >= 4.9 + , bytestring + , mtl + , containers + , notmuch + +executable hs-notmuch-tag-set + if !flag(demos) + buildable: False + default-language: Haskell2010 + hs-source-dirs: tools + ghc-options: -Wall + main-is: TagSet.hs + build-depends: + base >= 4.9 + , bytestring + , mtl + , notmuch + +executable hs-notmuch-index-file + if !flag(demos) + buildable: False + default-language: Haskell2010 + hs-source-dirs: tools + ghc-options: -Wall + main-is: IndexFile.hs + build-depends: + base >= 4.9 + , mtl + , notmuch diff --git a/haskell-ci.cabal b/haskell-ci.cabal index d0514c7d..b8d0018d 100644 --- a/haskell-ci.cabal +++ b/haskell-ci.cabal @@ -48,6 +48,7 @@ extra-source-files: fixtures/servant-foreign/servant-foreign.cabal fixtures/servant-server/servant-server.cabal fixtures/splitmix/splitmix.cabal + fixtures/notmuch/notmuch.cabal source-repository head type: git diff --git a/test/Tests.hs b/test/Tests.hs index 61b6b252..93a46dfa 100644 --- a/test/Tests.hs +++ b/test/Tests.hs @@ -29,6 +29,7 @@ main = do , fixtureGoldenTest "messy" , fixtureGoldenTest "psql" , fixtureGoldenTest "travis-patch" + , fixtureGoldenTest "matrix-extra" , testGroup "copy-fields" [ fixtureGoldenTest "copy-fields-all" , fixtureGoldenTest "copy-fields-some"