diff --git a/.docker/validate-7.6.3.dockerfile b/.docker/validate-7.6.3.dockerfile index 22c67471139..4340f331086 100644 --- a/.docker/validate-7.6.3.dockerfile +++ b/.docker/validate-7.6.3.dockerfile @@ -63,4 +63,4 @@ RUN cabal v2-install -w ghc-7.6.3 --lib \ # Validate WORKDIR /build COPY . /build -RUN sh ./validate.sh -l -w ghc-7.6.3 -v +RUN sh ./validate.sh --lib-only -w ghc-7.6.3 -v diff --git a/.docker/validate-7.8.4.dockerfile b/.docker/validate-7.8.4.dockerfile index b4c08ffb011..24e51e960a2 100644 --- a/.docker/validate-7.8.4.dockerfile +++ b/.docker/validate-7.8.4.dockerfile @@ -63,4 +63,4 @@ RUN cabal v2-install -w ghc-7.8.4 --lib \ # Validate WORKDIR /build COPY . /build -RUN sh ./validate.sh -l -w ghc-7.8.4 -v +RUN sh ./validate.sh --lib-only -w ghc-7.8.4 -v diff --git a/.docker/validate-8.8.1.dockerfile b/.docker/validate-8.8.1.dockerfile index 0a797ae4a3b..7f1d0172c29 100644 --- a/.docker/validate-8.8.1.dockerfile +++ b/.docker/validate-8.8.1.dockerfile @@ -8,6 +8,13 @@ RUN mkdir -p /root/.cabal/bin && \ rm -f cabal-plan.xz && \ chmod a+x /root/.cabal/bin/cabal-plan +# install cabal-env +RUN curl -sL https://github.com/phadej/cabal-extras/releases/download/preview-20191225/cabal-env-snapshot-20191225-x86_64-linux.xz > cabal-env.xz && \ + echo "1b567d529c5f627fd8c956e57ae8f0d9f11ee66d6db34b7fb0cb1c370b4edf01 cabal-env.xz" | sha256sum -c - && \ + xz -d < cabal-env.xz > $HOME/.cabal/bin/cabal-env && \ + rm -f cabal-env.xz && \ + chmod a+x $HOME/.cabal/bin/cabal-env + # Update index RUN cabal v2-update @@ -49,4 +56,4 @@ RUN cabal v2-install -w ghc-8.8.1 --lib \ # Validate WORKDIR /build COPY . /build -RUN sh ./validate.sh -w ghc-8.8.1 -v -D -b +RUN sh ./validate.sh -w ghc-8.8.1 -v --doctest --solver-benchmarks diff --git a/.docker/validate-old.dockerfile b/.docker/validate-old.dockerfile new file mode 100644 index 00000000000..bcaea16d337 --- /dev/null +++ b/.docker/validate-old.dockerfile @@ -0,0 +1,55 @@ +FROM phadej/ghc:8.8.1-xenial + +# Install cabal-plan +RUN mkdir -p /root/.cabal/bin && \ + 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 > cabal-plan.xz && \ + echo "de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz" | sha256sum -c - && \ + xz -d < cabal-plan.xz > /root/.cabal/bin/cabal-plan && \ + rm -f cabal-plan.xz && \ + chmod a+x /root/.cabal/bin/cabal-plan + +# Install older compilers +RUN apt-get update +RUN apt-get install -y ghc-7.0.4 ghc-7.0.4-dyn ghc-7.2.2 ghc-7.2.2-dyn ghc-7.4.2 ghc-7.4.2-dyn + +# Update index +RUN cabal v2-update + +# We install happy, so it's in the store; we (hopefully) don't use it directly. +RUN cabal v2-install happy --constraint 'happy ^>=1.19.12' + +# Install some other dependencies +# Remove $HOME/.ghc so there aren't any environments +RUN cabal v2-install -w ghc-8.8.1 --lib \ + aeson \ + async \ + base-compat \ + base16-bytestring \ + base64-bytestring \ + cryptohash-sha256 \ + Diff \ + echo \ + ed25519 \ + edit-distance \ + haskell-lexer \ + HTTP \ + network \ + optparse-applicative \ + pretty-show \ + regex-compat-tdfa \ + regex-tdfa \ + resolv \ + statistics \ + tar \ + tasty \ + tasty-golden \ + tasty-hunit \ + tasty-quickcheck \ + tree-diff \ + zlib \ + && rm -rf $HOME/.ghc + +# Validate +WORKDIR /build +COPY . /build +RUN sh ./validate.sh -w ghc-8.8.1 -v --lib-only --extra-hc /opt/ghc/7.0.4/bin/ghc-7.0.4 --extra-hc /opt/ghc/7.2.2/bin/ghc-7.2.2 --extra-hc /opt/ghc/7.4.2/bin/ghc-7.4.2 diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 00000000000..a4bfab2f0b2 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,579 @@ +# This file is auto-generated +# +# To regenerate it run +# +# make github-actions +# +name: Validation +on: + push: + branches: + - master + - "3.2" + pull_request: + branches: + - master + release: + types: + - created + +jobs: + meta: + name: Meta checks + runs-on: ubuntu-18.04 + # This job is not run in a container, any recent GHC should be fine + steps: + - name: Set PATH + run: | + echo "::add-path::$HOME/.cabal/bin" + echo "::add-path::/opt/cabal/3.0/bin" + echo "::add-path::/opt/ghc/8.6.5/bin" + - uses: actions/cache@v1 + with: + path: ~/.cabal/store + key: linux-store-meta + - name: Update Hackage index + run: cabal v2-update + - name: Install alex + run: cabal v2-install alex + - uses: actions/checkout@v1 + - name: Regenerate files + run: | + make lexer + make gen-extra-source-files + make spdx + make github-actions + - name: Check that diff is clean + run: | + git status > /dev/null + git diff-files -p --exit-code + doctest: + name: Doctest Cabal + runs-on: ubuntu-18.04 + steps: + - name: Set PATH + run: | + echo "::add-path::$HOME/.cabal/bin" + echo "::add-path::/opt/cabal/3.0/bin" + echo "::add-path::/opt/ghc/8.6.5/bin" + - name: Install cabal-env + run: | + mkdir -p $HOME/.cabal/bin + curl -sL https://github.com/phadej/cabal-extras/releases/download/preview-20191225/cabal-env-snapshot-20191225-x86_64-linux.xz > cabal-env.xz + echo "1b567d529c5f627fd8c956e57ae8f0d9f11ee66d6db34b7fb0cb1c370b4edf01 cabal-env.xz" | sha256sum -c - + xz -d < cabal-env.xz > $HOME/.cabal/bin/cabal-env + rm -f cabal-env.xz + chmod a+x $HOME/.cabal/bin/cabal-env + - uses: actions/cache@v1 + with: + path: ~/.cabal/store + key: linux-store-doctest + - name: Update Hackage index + run: cabal v2-update + - name: Install doctest + run: cabal v2-install doctest + - name: Install libraries + run: | + cabal-env --transitive QuickCheck + cabal-env array bytestring containers deepseq directory filepath pretty process time binary unix text parsec mtl + cat $HOME/.ghc/*/environments/default + - uses: actions/checkout@v1 + - name: Doctest + run: make doctest + + boostrap-linux: + name: Bootstrap on Linux + runs-on: ubuntu-18.04 + steps: + - name: Set PATH + run: | + echo "::add-path::/opt/ghc/8.6.5/bin" + - uses: actions/checkout@v1 + - name: bootstrap.sh + env: + EXTRA_CONFIGURE_OPTS: "" + run: | + cd cabal-install + sh ./bootstrap.sh --no-doc + - name: Smoke test + run: | + $HOME/.cabal/bin/cabal --version + + - name: Prepare for upload + run: xz -c < $HOME/.cabal/bin/cabal > cabal-artifact.xz + - uses: actions/upload-artifact@v1 + with: + name: cabal-linux-x86_64.xz + path: cabal-artifact.xz + + boostrap-macos: + name: Bootstrap on macOS + runs-on: macos-latest + steps: + - name: Install GHC + run: | + cd $(mktemp -d) + curl -sLO "https://downloads.haskell.org/~ghc/8.6.5/ghc-8.6.5-x86_64-apple-darwin.tar.xz" + tar -xJf ghc-*.tar.xz + cd ghc-* + ./configure --prefix=/opt/ghc/8.6.5 + sudo make install + - name: Set PATH + run: | + echo "::add-path::/opt/ghc/8.6.5/bin" + echo "::add-path::$HOME/.cabal/bin" + - uses: actions/checkout@v1 + - name: bootstrap.sh + env: + EXTRA_CONFIGURE_OPTS: "" + run: | + cd cabal-install + sh ./bootstrap.sh --no-doc + - name: Smoke test + run: | + $HOME/.cabal/bin/cabal --version + + - name: Prepare for upload + run: xz -c < $HOME/.cabal/bin/cabal > cabal-artifact.xz + - uses: actions/upload-artifact@v1 + with: + name: cabal-macos-x86_64.xz + path: cabal-artifact.xz + + validate-8_8_1: + name: validate.sh ghc-8.8.1 + runs-on: ubuntu-18.04 + container: + image: phadej/ghc:8.8.1-bionic + steps: + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions#add-a-system-path-add-path + - name: Set PATH + run: | + echo "::add-path::$HOME/.cabal/bin" + - name: Install cabal-plan + run: | + mkdir -p $HOME/.cabal/bin + curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > 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 + - name: Update Hackage index + run: cabal v2-update + - uses: actions/checkout@v1 + - name: Validate print-config + run: sh validate.sh -j 2 -w ghc-8.8.1 -v --solver-benchmarks -s print-config + - name: Validate print-tool-versions + run: sh validate.sh -j 2 -w ghc-8.8.1 -v --solver-benchmarks -s print-tool-versions + - name: Validate make-cabal-install-dev + run: sh validate.sh -j 2 -w ghc-8.8.1 -v --solver-benchmarks -s make-cabal-install-dev + - name: Validate build + run: sh validate.sh -j 2 -w ghc-8.8.1 -v --solver-benchmarks -s build + - name: Validate lib-tests + run: sh validate.sh -j 2 -w ghc-8.8.1 -v --solver-benchmarks -s lib-tests + - name: Validate lib-suite + run: sh validate.sh -j 2 -w ghc-8.8.1 -v --solver-benchmarks -s lib-suite + - name: Validate cli-tests + run: sh validate.sh -j 2 -w ghc-8.8.1 -v --solver-benchmarks -s cli-tests + - name: Validate cli-suite + run: sh validate.sh -j 2 -w ghc-8.8.1 -v --solver-benchmarks -s cli-suite + validate-8_6_5: + name: validate.sh ghc-8.6.5 + runs-on: ubuntu-18.04 + needs: validate-8_8_1 + container: + image: phadej/ghc:8.6.5-bionic + steps: + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions#add-a-system-path-add-path + - name: Set PATH + run: | + echo "::add-path::$HOME/.cabal/bin" + - name: Install cabal-plan + run: | + mkdir -p $HOME/.cabal/bin + curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > 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 + - name: Update Hackage index + run: cabal v2-update + - uses: actions/checkout@v1 + - name: Validate print-config + run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s print-config + - name: Validate print-tool-versions + run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s print-tool-versions + - name: Validate make-cabal-install-dev + run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s make-cabal-install-dev + - name: Validate build + run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s build + - name: Validate lib-tests + run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s lib-tests + - name: Validate lib-suite + run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s lib-suite + - name: Validate cli-tests + run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s cli-tests + - name: Validate cli-suite + run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s cli-suite + validate-8_4_4: + name: validate.sh ghc-8.4.4 + runs-on: ubuntu-18.04 + needs: validate-8_8_1 + container: + image: phadej/ghc:8.4.4-bionic + steps: + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions#add-a-system-path-add-path + - name: Set PATH + run: | + echo "::add-path::$HOME/.cabal/bin" + - name: Install cabal-plan + run: | + mkdir -p $HOME/.cabal/bin + curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > 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 + - name: Update Hackage index + run: cabal v2-update + - uses: actions/checkout@v1 + - name: Validate print-config + run: sh validate.sh -j 2 -w ghc-8.4.4 -v -s print-config + - name: Validate print-tool-versions + run: sh validate.sh -j 2 -w ghc-8.4.4 -v -s print-tool-versions + - name: Validate make-cabal-install-dev + run: sh validate.sh -j 2 -w ghc-8.4.4 -v -s make-cabal-install-dev + - name: Validate build + run: sh validate.sh -j 2 -w ghc-8.4.4 -v -s build + - name: Validate lib-tests + run: sh validate.sh -j 2 -w ghc-8.4.4 -v -s lib-tests + - name: Validate lib-suite + run: sh validate.sh -j 2 -w ghc-8.4.4 -v -s lib-suite + - name: Validate cli-tests + run: sh validate.sh -j 2 -w ghc-8.4.4 -v -s cli-tests + - name: Validate cli-suite + run: sh validate.sh -j 2 -w ghc-8.4.4 -v -s cli-suite + validate-8_2_2: + name: validate.sh ghc-8.2.2 + runs-on: ubuntu-18.04 + needs: validate-8_8_1 + container: + image: phadej/ghc:8.2.2-bionic + steps: + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions#add-a-system-path-add-path + - name: Set PATH + run: | + echo "::add-path::$HOME/.cabal/bin" + - name: Install cabal-plan + run: | + mkdir -p $HOME/.cabal/bin + curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > 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 + - name: Update Hackage index + run: cabal v2-update + - uses: actions/checkout@v1 + - name: Validate print-config + run: sh validate.sh -j 2 -w ghc-8.2.2 -v -s print-config + - name: Validate print-tool-versions + run: sh validate.sh -j 2 -w ghc-8.2.2 -v -s print-tool-versions + - name: Validate make-cabal-install-dev + run: sh validate.sh -j 2 -w ghc-8.2.2 -v -s make-cabal-install-dev + - name: Validate build + run: sh validate.sh -j 2 -w ghc-8.2.2 -v -s build + - name: Validate lib-tests + run: sh validate.sh -j 2 -w ghc-8.2.2 -v -s lib-tests + - name: Validate lib-suite + run: sh validate.sh -j 2 -w ghc-8.2.2 -v -s lib-suite + - name: Validate cli-tests + run: sh validate.sh -j 2 -w ghc-8.2.2 -v -s cli-tests + - name: Validate cli-suite + run: sh validate.sh -j 2 -w ghc-8.2.2 -v -s cli-suite + validate-8_0_2: + name: validate.sh ghc-8.0.2 + runs-on: ubuntu-18.04 + needs: validate-8_8_1 + container: + image: phadej/ghc:8.0.2-bionic + steps: + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions#add-a-system-path-add-path + - name: Set PATH + run: | + echo "::add-path::$HOME/.cabal/bin" + - name: Install cabal-plan + run: | + mkdir -p $HOME/.cabal/bin + curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > 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 + - name: Update Hackage index + run: cabal v2-update + - uses: actions/checkout@v1 + - name: Validate print-config + run: sh validate.sh -j 2 -w ghc-8.0.2 -v -s print-config + - name: Validate print-tool-versions + run: sh validate.sh -j 2 -w ghc-8.0.2 -v -s print-tool-versions + - name: Validate make-cabal-install-dev + run: sh validate.sh -j 2 -w ghc-8.0.2 -v -s make-cabal-install-dev + - name: Validate build + run: sh validate.sh -j 2 -w ghc-8.0.2 -v -s build + - name: Validate lib-tests + run: sh validate.sh -j 2 -w ghc-8.0.2 -v -s lib-tests + - name: Validate lib-suite + run: sh validate.sh -j 2 -w ghc-8.0.2 -v -s lib-suite + - name: Validate cli-tests + run: sh validate.sh -j 2 -w ghc-8.0.2 -v -s cli-tests + - name: Validate cli-suite + run: sh validate.sh -j 2 -w ghc-8.0.2 -v -s cli-suite + validate-7_10_3: + name: validate.sh ghc-7.10.3 + runs-on: ubuntu-18.04 + needs: validate-8_8_1 + container: + image: phadej/ghc:7.10.3-bionic + steps: + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions#add-a-system-path-add-path + - name: Set PATH + run: | + echo "::add-path::$HOME/.cabal/bin" + - name: Install cabal-plan + run: | + mkdir -p $HOME/.cabal/bin + curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > 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 + - name: Update Hackage index + run: cabal v2-update + - uses: actions/checkout@v1 + - name: Validate print-config + run: sh validate.sh -j 2 -w ghc-7.10.3 -v -s print-config + - name: Validate print-tool-versions + run: sh validate.sh -j 2 -w ghc-7.10.3 -v -s print-tool-versions + - name: Validate make-cabal-install-dev + run: sh validate.sh -j 2 -w ghc-7.10.3 -v -s make-cabal-install-dev + - name: Validate build + run: sh validate.sh -j 2 -w ghc-7.10.3 -v -s build + - name: Validate lib-tests + run: sh validate.sh -j 2 -w ghc-7.10.3 -v -s lib-tests + - name: Validate lib-suite + run: sh validate.sh -j 2 -w ghc-7.10.3 -v -s lib-suite + - name: Validate cli-tests + run: sh validate.sh -j 2 -w ghc-7.10.3 -v -s cli-tests + - name: Validate cli-suite + run: sh validate.sh -j 2 -w ghc-7.10.3 -v -s cli-suite + validate-7_8_4: + name: validate.sh ghc-7.8.4 + runs-on: ubuntu-18.04 + needs: validate-8_8_1 + container: + image: phadej/ghc:7.8.4-bionic + steps: + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions#add-a-system-path-add-path + - name: Set PATH + run: | + echo "::add-path::$HOME/.cabal/bin" + - name: Install cabal-plan + run: | + mkdir -p $HOME/.cabal/bin + curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > 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 + - name: Update Hackage index + run: cabal v2-update + - uses: actions/checkout@v1 + - name: Validate print-config + run: sh validate.sh -j 2 -w ghc-7.8.4 -v --lib-only -s print-config + - name: Validate print-tool-versions + run: sh validate.sh -j 2 -w ghc-7.8.4 -v --lib-only -s print-tool-versions + - name: Validate build + run: sh validate.sh -j 2 -w ghc-7.8.4 -v --lib-only -s build + - name: Validate lib-tests + run: sh validate.sh -j 2 -w ghc-7.8.4 -v --lib-only -s lib-tests + - name: Validate lib-suite + run: sh validate.sh -j 2 -w ghc-7.8.4 -v --lib-only -s lib-suite + validate-7_6_3: + name: validate.sh ghc-7.6.3 + runs-on: ubuntu-18.04 + needs: validate-8_8_1 + container: + image: phadej/ghc:7.6.3-xenial + steps: + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions#add-a-system-path-add-path + - name: Set PATH + run: | + echo "::add-path::$HOME/.cabal/bin" + - name: Install cabal-plan + run: | + mkdir -p $HOME/.cabal/bin + curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > 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 + - name: apt-get update + run: apt-get update + - name: Install dynamic libraries + run: apt-get install -y ghc-7.6.3-dyn + - name: Update Hackage index + run: cabal v2-update + - uses: actions/checkout@v1 + - name: Validate print-config + run: sh validate.sh -j 2 -w ghc-7.6.3 -v --lib-only -s print-config + - name: Validate print-tool-versions + run: sh validate.sh -j 2 -w ghc-7.6.3 -v --lib-only -s print-tool-versions + - name: Validate build + run: sh validate.sh -j 2 -w ghc-7.6.3 -v --lib-only -s build + - name: Validate lib-tests + run: sh validate.sh -j 2 -w ghc-7.6.3 -v --lib-only -s lib-tests + - name: Validate lib-suite + run: sh validate.sh -j 2 -w ghc-7.6.3 -v --lib-only -s lib-suite + validate-8_8_1-old: + name: validate.sh old GHCs + runs-on: ubuntu-18.04 + needs: validate-8_8_1 + container: + image: phadej/ghc:8.8.1-xenial + steps: + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions#add-a-system-path-add-path + - name: Set PATH + run: | + echo "::add-path::$HOME/.cabal/bin" + - name: Install cabal-plan + run: | + mkdir -p $HOME/.cabal/bin + curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > 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 + - name: apt-get update + run: apt-get update + - name: Install dynamic libraries + run: apt-get install -y ghc-8.8.1-dyn + - name: Install extra compilers + run: apt-get install -y ghc-7.0.4-dyn ghc-7.2.2-dyn ghc-7.4.2-dyn + - name: Update Hackage index + run: cabal v2-update + - uses: actions/checkout@v1 + - name: Validate print-config + run: sh validate.sh -j 2 -w ghc-8.8.1 -v --lib-only -s print-config + - name: Validate print-tool-versions + run: sh validate.sh -j 2 -w ghc-8.8.1 -v --lib-only -s print-tool-versions + - name: Validate build + run: sh validate.sh -j 2 -w ghc-8.8.1 -v --lib-only -s build + - name: Validate lib-tests + run: sh validate.sh -j 2 -w ghc-8.8.1 -v --lib-only -s lib-tests + - name: Validate lib-suite + run: sh validate.sh -j 2 -w ghc-8.8.1 -v --lib-only -s lib-suite + - name: Validate lib-suite-extras --extra-hc /opt/ghc/7.0.4/bin/ghc-7.0.4 + run: sh validate.sh -j 2 -w ghc-8.8.1 -v --lib-only -s lib-suite-extras --extra-hc /opt/ghc/7.0.4/bin/ghc-7.0.4 + - name: Validate lib-suite-extras --extra-hc /opt/ghc/7.2.2/bin/ghc-7.2.2 + run: sh validate.sh -j 2 -w ghc-8.8.1 -v --lib-only -s lib-suite-extras --extra-hc /opt/ghc/7.2.2/bin/ghc-7.2.2 + - name: Validate lib-suite-extras --extra-hc /opt/ghc/7.4.2/bin/ghc-7.4.2 + run: sh validate.sh -j 2 -w ghc-8.8.1 -v --lib-only -s lib-suite-extras --extra-hc /opt/ghc/7.4.2/bin/ghc-7.4.2 + + validate-macos-8_8_1: + name: validate.sh macOS ghc-8.8.1 + runs-on: macos-latest + steps: + - name: Install GHC + run: | + cd $(mktemp -d) + curl -sLO https://downloads.haskell.org/~ghc/8.8.1/ghc-8.8.1-x86_64-apple-darwin.tar.xz + tar -xJf ghc-*.tar.xz + cd ghc-* + ./configure --prefix=/opt/ghc/8.8.1 + sudo make install + - name: Install Cabal + run: | + cd $(mktemp -d) + curl -sLO https://downloads.haskell.org/~cabal/cabal-install-3.0.0.0/cabal-install-3.0.0.0-x86_64-apple-darwin17.7.0.tar.xz + tar -xJf cabal-install-*.tar.xz + sudo mkdir -p /opt/cabal/3.0/bin + sudo cp cabal /opt/cabal/3.0/bin/cabal + sudo chmod 755 /opt/cabal/3.0/bin/cabal + - name: Set PATH + run: | + echo "::add-path::/opt/ghc/8.8.1/bin" + echo "::add-path::/opt/cabal/3.0/bin" + echo "::add-path::$HOME/.cabal/bin" + - name: Update Hackage index + run: cabal v2-update + - name: Install cabal-plan + run: | + cd $(mktemp -d) + cabal v2-install cabal-plan --constraint='cabal-plan ^>=0.6.2.0' --constraint='aeson +fast' + - uses: actions/checkout@v1 + - name: Validate print-config + run: sh validate.sh -j 2 -w ghc-8.8.1 -v -s print-config + - name: Validate print-tool-versions + run: sh validate.sh -j 2 -w ghc-8.8.1 -v -s print-tool-versions + - name: Validate make-cabal-install-dev + run: sh validate.sh -j 2 -w ghc-8.8.1 -v -s make-cabal-install-dev + - name: Validate build + run: sh validate.sh -j 2 -w ghc-8.8.1 -v -s build + - name: Validate lib-tests + run: sh validate.sh -j 2 -w ghc-8.8.1 -v -s lib-tests + - name: Validate lib-suite + run: sh validate.sh -j 2 -w ghc-8.8.1 -v -s lib-suite + - name: Validate cli-tests + run: sh validate.sh -j 2 -w ghc-8.8.1 -v -s cli-tests + - name: Validate cli-suite + run: sh validate.sh -j 2 -w ghc-8.8.1 -v -s cli-suite + validate-macos-8_6_5: + name: validate.sh macOS ghc-8.6.5 + runs-on: macos-latest + needs: validate-macos-8_8_1 + steps: + - name: Install GHC + run: | + cd $(mktemp -d) + curl -sLO https://downloads.haskell.org/~ghc/8.6.5/ghc-8.6.5-x86_64-apple-darwin.tar.xz + tar -xJf ghc-*.tar.xz + cd ghc-* + ./configure --prefix=/opt/ghc/8.6.5 + sudo make install + - name: Install Cabal + run: | + cd $(mktemp -d) + curl -sLO https://downloads.haskell.org/~cabal/cabal-install-3.0.0.0/cabal-install-3.0.0.0-x86_64-apple-darwin17.7.0.tar.xz + tar -xJf cabal-install-*.tar.xz + sudo mkdir -p /opt/cabal/3.0/bin + sudo cp cabal /opt/cabal/3.0/bin/cabal + sudo chmod 755 /opt/cabal/3.0/bin/cabal + - name: Set PATH + run: | + echo "::add-path::/opt/ghc/8.6.5/bin" + echo "::add-path::/opt/cabal/3.0/bin" + echo "::add-path::$HOME/.cabal/bin" + - name: Update Hackage index + run: cabal v2-update + - name: Install cabal-plan + run: | + cd $(mktemp -d) + cabal v2-install cabal-plan --constraint='cabal-plan ^>=0.6.2.0' --constraint='aeson +fast' + - uses: actions/checkout@v1 + - name: Validate print-config + run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s print-config + - name: Validate print-tool-versions + run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s print-tool-versions + - name: Validate make-cabal-install-dev + run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s make-cabal-install-dev + - name: Validate build + run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s build + - name: Validate lib-tests + run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s lib-tests + - name: Validate lib-suite + run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s lib-suite + - name: Validate cli-tests + run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s cli-tests + - name: Validate cli-suite + run: sh validate.sh -j 2 -w ghc-8.6.5 -v -s cli-suite diff --git a/Makefile b/Makefile index 8ed8cbd0779..e0ff28545e4 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,12 @@ gen-extra-source-files : gen-extra-source-files-lib gen-extra-source-files-cli gen-extra-source-files-lib : cabal v2-run --builddir=dist-newstyle-meta --project-file=cabal.project.meta gen-extra-source-files -- $$(pwd)/Cabal/Cabal.cabal +# github actions +github-actions : .github/workflows/validate.yml + +.github/workflows/validate.yml : boot/validate.template.yml cabal-dev-scripts/src/GenValidate.hs + cabal v2-run --builddir=dist-newstyle-meta --project-file=cabal.project.meta gen-validate -- $< $@ + # We need to generate cabal-install-dev so the test modules are in .cabal file! gen-extra-source-files-cli : $(MAKE) cabal-install-dev @@ -148,3 +154,6 @@ validate-via-docker-8.6.5: validate-via-docker-8.8.1: docker build -t cabal-validate -f .docker/validate-8.8.1.dockerfile . + +validate-via-docker-old: + docker build -t cabal-validate -f .docker/validate-old.dockerfile . diff --git a/boot/validate.template.yml b/boot/validate.template.yml new file mode 100644 index 00000000000..adc840aa8a5 --- /dev/null +++ b/boot/validate.template.yml @@ -0,0 +1,239 @@ +# This file is auto-generated +# +# To regenerate it run +# +# make github-actions +# +name: Validation +on: + push: + branches: + - master + - "3.2" + pull_request: + branches: + - master + release: + types: + - created + +jobs: +{############################################################################} +{# Misc jobs #} +{############################################################################} + meta: + name: Meta checks + runs-on: ubuntu-18.04 + # This job is not run in a container, any recent GHC should be fine + steps: + - name: Set PATH + run: | + echo "::add-path::$HOME/.cabal/bin" + echo "::add-path::/opt/cabal/3.0/bin" + echo "::add-path::/opt/ghc/8.6.5/bin" + - uses: actions/cache@v1 + with: + path: ~/.cabal/store + key: linux-store-meta + - name: Update Hackage index + run: cabal v2-update + - name: Install alex + run: cabal v2-install alex + - uses: actions/checkout@v1 + - name: Regenerate files + run: | + make lexer + make gen-extra-source-files + make spdx + make github-actions + - name: Check that diff is clean + run: | + git status > /dev/null + git diff-files -p --exit-code + doctest: + name: Doctest Cabal + runs-on: ubuntu-18.04 + steps: + - name: Set PATH + run: | + echo "::add-path::$HOME/.cabal/bin" + echo "::add-path::/opt/cabal/3.0/bin" + echo "::add-path::/opt/ghc/8.6.5/bin" + - name: Install cabal-env + run: | + mkdir -p $HOME/.cabal/bin + curl -sL https://github.com/phadej/cabal-extras/releases/download/preview-20191225/cabal-env-snapshot-20191225-x86_64-linux.xz > cabal-env.xz + echo "1b567d529c5f627fd8c956e57ae8f0d9f11ee66d6db34b7fb0cb1c370b4edf01 cabal-env.xz" | sha256sum -c - + xz -d < cabal-env.xz > $HOME/.cabal/bin/cabal-env + rm -f cabal-env.xz + chmod a+x $HOME/.cabal/bin/cabal-env + - uses: actions/cache@v1 + with: + path: ~/.cabal/store + key: linux-store-doctest + - name: Update Hackage index + run: cabal v2-update + - name: Install doctest + run: cabal v2-install doctest + - name: Install libraries + run: | + cabal-env --transitive QuickCheck + cabal-env array bytestring containers deepseq directory filepath pretty process time binary unix text parsec mtl + cat $HOME/.ghc/*/environments/default + - uses: actions/checkout@v1 + - name: Doctest + run: make doctest + +{############################################################################} +{# Bootstrap jobs #} +{############################################################################} + boostrap-linux: + name: Bootstrap on Linux + runs-on: ubuntu-18.04 + steps: + - name: Set PATH + run: | + echo "::add-path::/opt/ghc/8.6.5/bin" + - uses: actions/checkout@v1 + - name: bootstrap.sh + env: + EXTRA_CONFIGURE_OPTS: "" + run: | + cd cabal-install + sh ./bootstrap.sh --no-doc + - name: Smoke test + run: | + $HOME/.cabal/bin/cabal --version + + - name: Prepare for upload + run: xz -c < $HOME/.cabal/bin/cabal > cabal-artifact.xz + - uses: actions/upload-artifact@v1 + with: + name: cabal-linux-x86_64.xz + path: cabal-artifact.xz + + boostrap-macos: + name: Bootstrap on macOS + runs-on: macos-latest + steps: + - name: Install GHC + run: | + cd $(mktemp -d) + curl -sLO "https://downloads.haskell.org/~ghc/8.6.5/ghc-8.6.5-x86_64-apple-darwin.tar.xz" + tar -xJf ghc-*.tar.xz + cd ghc-* + ./configure --prefix=/opt/ghc/8.6.5 + sudo make install + - name: Set PATH + run: | + echo "::add-path::/opt/ghc/8.6.5/bin" + echo "::add-path::$HOME/.cabal/bin" + - uses: actions/checkout@v1 + - name: bootstrap.sh + env: + EXTRA_CONFIGURE_OPTS: "" + run: | + cd cabal-install + sh ./bootstrap.sh --no-doc + - name: Smoke test + run: | + $HOME/.cabal/bin/cabal --version + + - name: Prepare for upload + run: xz -c < $HOME/.cabal/bin/cabal > cabal-artifact.xz + - uses: actions/upload-artifact@v1 + with: + name: cabal-macos-x86_64.xz + path: cabal-artifact.xz + +{############################################################################} +{# Linux jobs #} +{############################################################################} +{% for job in jobs %} + validate-{{ mangleVersion job.version }}{% if job.old %}-old{% endif %}: + name: validate.sh {%if job.old %}old GHCs{% else %}ghc-{{job.version}}{% endif %} + runs-on: ubuntu-18.04 +{% for needs in job.needs %} + needs: validate-{{ mangleVersion needs }} +{% endfor %} + container: + image: phadej/ghc:{{job.version}}-{% if job.xenial %}xenial{% else %}bionic{% endif %} + steps: + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions#add-a-system-path-add-path + - name: Set PATH + run: | + echo "::add-path::$HOME/.cabal/bin" + - name: Install cabal-plan + run: | + mkdir -p $HOME/.cabal/bin + curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > 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 +{% if or job.xenial job.old %} + - name: apt-get update + run: apt-get update +{% endif %} +{% if job.xenial %} + - name: Install dynamic libraries + run: apt-get install -y ghc-{{job.version}}-dyn +{% endif %} +{% if job.old %} + - name: Install extra compilers + run: apt-get install -y ghc-7.0.4-dyn ghc-7.2.2-dyn ghc-7.4.2-dyn +{% endif %} + - name: Update Hackage index + run: cabal v2-update + - uses: actions/checkout@v1 +{% for step in job.steps %} + - name: Validate {{step}} + run: sh validate.sh -j 2 -w ghc-{{job.version}} -v {{job.flags}} -s {{step}} +{% endfor %} +{% endfor %} + +{############################################################################} +{# MacOS jobs #} +{############################################################################} +{% for job in macosJobs %} + validate-macos-{{ mangleVersion job.version }}: + name: validate.sh macOS ghc-{{job.version}} + runs-on: macos-latest +{% for needs in job.needs %} + needs: validate-macos-{{ mangleVersion needs }} +{% endfor %} + steps: + - name: Install GHC + run: | + cd $(mktemp -d) + curl -sLO {{job.ghcUrl}} + tar -xJf ghc-*.tar.xz + cd ghc-* + ./configure --prefix=/opt/ghc/{{job.version}} + sudo make install + - name: Install Cabal + run: | + cd $(mktemp -d) + curl -sLO https://downloads.haskell.org/~cabal/cabal-install-3.0.0.0/cabal-install-3.0.0.0-x86_64-apple-darwin17.7.0.tar.xz + tar -xJf cabal-install-*.tar.xz + sudo mkdir -p /opt/cabal/3.0/bin + sudo cp cabal /opt/cabal/3.0/bin/cabal + sudo chmod 755 /opt/cabal/3.0/bin/cabal + - name: Set PATH + run: | + echo "::add-path::/opt/ghc/{{job.version}}/bin" + echo "::add-path::/opt/cabal/3.0/bin" + echo "::add-path::$HOME/.cabal/bin" + - name: Update Hackage index + run: cabal v2-update + - name: Install cabal-plan + run: | + cd $(mktemp -d) +{# aeson +fast, so we don't wait for -O2 #} + cabal v2-install cabal-plan --constraint='cabal-plan ^>=0.6.2.0' --constraint='aeson +fast' + - uses: actions/checkout@v1 +{% for step in job.steps %} + - name: Validate {{step}} + run: sh validate.sh -j 2 -w ghc-{{job.version}} -v {{job.flags}} -s {{step}} +{% endfor %} +{% endfor %} diff --git a/cabal-dev-scripts/cabal-dev-scripts.cabal b/cabal-dev-scripts/cabal-dev-scripts.cabal index 05757586ba4..1c13b9242c6 100644 --- a/cabal-dev-scripts/cabal-dev-scripts.cabal +++ b/cabal-dev-scripts/cabal-dev-scripts.cabal @@ -55,3 +55,14 @@ executable gen-spdx-exc , optparse-applicative ^>=0.15.1.0 , text , zinza ^>=0.2 + +executable gen-validate + default-language: Haskell2010 + main-is: GenValidate.hs + hs-source-dirs: src + ghc-options: -Wall + build-depends: + , base + , bytestring + , HsYAML ^>=0.2.1.0 + , zinza ^>=0.2 diff --git a/cabal-dev-scripts/src/GenValidate.hs b/cabal-dev-scripts/src/GenValidate.hs new file mode 100644 index 00000000000..299f186773c --- /dev/null +++ b/cabal-dev-scripts/src/GenValidate.hs @@ -0,0 +1,137 @@ +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE ScopedTypeVariables #-} +-- runghc -package-env=default Validate.hs validate.yml.zinza .github/workflows/validate.yml +module Main (main) where + +import GHC.Generics (Generic) +import System.Environment (getArgs) +import System.Exit (exitFailure) +import Zinza + (Zinza (..), genericFromValueSFP, genericToTypeSFP, genericToValueSFP, + parseAndCompileTemplateIO) + +import qualified Data.ByteString.Lazy.Char8 as LBS8 +import qualified Data.YAML as YAML + +main :: IO () +main = do + args <- getArgs + case args of + [src,tgt] -> do + run <- parseAndCompileTemplateIO src + -- this shouldn't fail (run-time errors are due bugs in zinza) + w <- run Z + { zJobs = + [ GhcJob "8.8.1" False "--solver-benchmarks" False [] defSteps + , GhcJob "8.6.5" False "" False ["8.8.1"] defSteps + , GhcJob "8.4.4" False "" False ["8.8.1"] defSteps + , GhcJob "8.2.2" False "" False ["8.8.1"] defSteps + , GhcJob "8.0.2" False "" False ["8.8.1"] defSteps + , GhcJob "7.10.3" False "" False ["8.8.1"] defSteps + , GhcJob "7.8.4" False "--lib-only" False ["8.8.1"] libSteps + , GhcJob "7.6.3" True "--lib-only" False ["8.8.1"] libSteps + , GhcJob "8.8.1" True "--lib-only" True ["8.8.1"] $ + libSteps ++ + [ "lib-suite-extras --extra-hc /opt/ghc/7.0.4/bin/ghc-7.0.4" + , "lib-suite-extras --extra-hc /opt/ghc/7.2.2/bin/ghc-7.2.2" + , "lib-suite-extras --extra-hc /opt/ghc/7.4.2/bin/ghc-7.4.2" + ] + ] + , zMacosJobs = + [ mkMacGhcJob "8.8.1" "https://downloads.haskell.org/~ghc/8.8.1/ghc-8.8.1-x86_64-apple-darwin.tar.xz" + , mkMacGhcJob "8.6.5" "https://downloads.haskell.org/~ghc/8.6.5/ghc-8.6.5-x86_64-apple-darwin.tar.xz" + ] + , zMangleVersion = map mangleChar + , zOr = (||) + , zNotNull = not . null + , zFalse = False + } + + -- check that YAML is syntactically valid + let bs = LBS8.pack w + case YAML.decode1 bs of + Right (_ :: YAML.Node YAML.Pos) -> return () + Left (pos, err) -> do + putStrLn $ "ERROR:" ++ YAML.prettyPosWithSource pos bs err + exitFailure + + writeFile tgt w + _ -> putStrLn "Usage source.yml.zinza target.yml" + +mangleChar :: Char -> Char +mangleChar '.' = '_' +mangleChar c = c + +defSteps :: [String] +defSteps = + [ "print-config" + , "print-tool-versions" + , "make-cabal-install-dev" + , "build" + , "lib-tests" + , "lib-suite" + , "cli-tests" + , "cli-suite" + ] + +libSteps :: [String] +libSteps = + [ "print-config" + , "print-tool-versions" + , "build" + , "lib-tests" + , "lib-suite" + ] + +data Z = Z + { zJobs :: [GhcJob] + , zMacosJobs :: [MacGhcJob] + , zMangleVersion :: String -> String + , zOr :: Bool -> Bool -> Bool + , zNotNull :: [String] -> Bool + , zFalse :: Bool + } + deriving (Generic) + +data GhcJob = GhcJob + { gjVersion :: String + , gjXenial :: Bool + , gjFlags :: String + , gjOld :: Bool + , gjNeeds :: [String] + , gjSteps :: [String] + } + deriving (Generic) + +data MacGhcJob = MacGhcJob + { mgjVersion :: String + , mgjGhcUrl :: String + , mgjFlags :: String + , mgjNeeds :: [String] + , mgjSteps :: [String] + } + deriving (Generic) + +mkMacGhcJob :: String -> String -> MacGhcJob +mkMacGhcJob v u = MacGhcJob + { mgjVersion = v + , mgjGhcUrl = u + , mgjFlags = "" + , mgjNeeds = ["8.8.1" | v /= "8.8.1"] + , mgjSteps = defSteps + } + +instance Zinza Z where + toType = genericToTypeSFP + toValue = genericToValueSFP + fromValue = genericFromValueSFP + +instance Zinza GhcJob where + toType = genericToTypeSFP + toValue = genericToValueSFP + fromValue = genericFromValueSFP + +instance Zinza MacGhcJob where + toType = genericToTypeSFP + toValue = genericToValueSFP + fromValue = genericFromValueSFP diff --git a/cabal.project.validate b/cabal.project.validate index 81f99f296c9..a52f80931dc 100644 --- a/cabal.project.validate +++ b/cabal.project.validate @@ -1,4 +1,5 @@ packages: Cabal/ cabal-testsuite/ cabal-install/ solver-benchmarks/ +tests: True write-ghc-environment-files: never diff --git a/cabal.project.validate.libonly b/cabal.project.validate.libonly index 2a1f7741dfe..b6f64415239 100644 --- a/cabal.project.validate.libonly +++ b/cabal.project.validate.libonly @@ -1,4 +1,5 @@ packages: Cabal/ cabal-testsuite/ +tests: True write-ghc-environment-files: never diff --git a/validate.sh b/validate.sh index 1ec1ff18c1f..5597700755e 100755 --- a/validate.sh +++ b/validate.sh @@ -8,15 +8,21 @@ HC=ghc-8.2.2 CABAL=cabal CABALPLAN=cabal-plan JOBS=4 -CABALTESTS=true -CABALINSTALLTESTS=true +LIBTESTS=true +CLITESTS=true CABALSUITETESTS=true -CABALONLY=false +LIBONLY=false DEPSONLY=false DOCTEST=false BENCHMARKS=false VERBOSE=false +TARGETS="" +STEPS="" +EXTRAHCS="" + +LISTSTEPS=false + # Help ####################################################################### @@ -24,24 +30,29 @@ show_usage() { cat </dev/null; then -echo "$CYAN=== Cabal: doctest ===================================== $(date +%T) === $RESET" - -timed $CABALNEWBUILD Cabal:lib:Cabal --enable-tests --disable-benchmarks --write-ghc-environment-files=always || exit 1 -timed doctest --fast Cabal/Distribution Cabal/Language -timed rm -f .ghc.environment.* - -else +step_make_cabal_install_dev() { +print_header "make cabal-install-dev" +timed ${RUNHASKELL} cabal-dev-scripts/src/Preprocessor.hs -o cabal-install/cabal-install.cabal -f CABAL_FLAG_LIB cabal-install/cabal-install.cabal.pp +} -echo "No doctest command found" +step_build() { +print_header "build" +timed $CABALNEWBUILD $TARGETS --dry-run || exit 1 +timed $CABALNEWBUILD $TARGETS || exit 1 +} -fi # command -v doctest -fi # DOCTEST +# Cabal lib +####################################################################### -if $CABALTESTS; then -echo "$CYAN=== Cabal: test ======================================== $(date +%T) === $RESET" +step_doctest() { +print_header "Cabal: doctest" +cabal-env --name doctest-Cabal --transitive QuickCheck +cabal-env --name doctest-Cabal array bytestring containers deepseq directory filepath pretty process time binary unix text parsec mtl +timed doctest -package-env=doctest-Cabal --fast Cabal/Distribution Cabal/Language +} -timed $CABALNEWBUILD Cabal:tests --enable-tests --disable-benchmarks --dry-run || exit 1 -timed $CABALNEWBUILD Cabal:tests --enable-tests --disable-benchmarks --dep || exit 1 -timed $CABALNEWBUILD Cabal:tests --enable-tests --disable-benchmarks || exit 1 +step_lib_tests() { +print_header "Cabal: tests" CMD="$($CABALPLANLISTBIN Cabal:test:unit-tests) $TESTSUITEJOBS --hide-successes --with-ghc=$HC" (cd Cabal && timed $CMD) || exit 1 @@ -282,44 +385,32 @@ CMD=$($CABALPLANLISTBIN Cabal:test:hackage-tests) (cd Cabal && timed $CMD read-fields) || exit 1 (cd Cabal && timed $CMD parsec d) || exit 1 (cd Cabal && timed $CMD roundtrip k) || exit 1 +} -fi # $CABALTESTS - -if $CABALSUITETESTS; then - -echo "$CYAN=== cabal-testsuite: build ============================= $(date +%T) === $RESET" - -timed $CABALNEWBUILD cabal-testsuite --enable-tests --disable-benchmarks --dry-run || exit 1 -timed $CABALNEWBUILD cabal-testsuite --enable-tests --disable-benchmarks --dep || exit 1 -timed $CABALNEWBUILD cabal-testsuite --enable-tests --disable-benchmarks || exit 1 +# Cabal cabal-testsuite +####################################################################### -echo "$CYAN=== cabal-testsuite: Cabal test ======================== $(date +%T) === $RESET" +step_lib_suite() { +print_header "Cabal: cabal-testsuite" CMD="$($CABALPLANLISTBIN cabal-testsuite:exe:cabal-tests) --builddir=$CABAL_TESTSUITE_BDIR $TESTSUITEJOBS --with-ghc=$HC --hide-successes" (cd cabal-testsuite && timed $CMD) || exit 1 +} -fi # CABALSUITETESTS (Cabal) +step_lib_suite_extras() { +for EXTRAHC in $EXTRAHCS; do -# If testing only library, stop here -if $CABALONLY; then - footer - exit -fi +CMD="$($CABALPLANLISTBIN cabal-testsuite:exe:cabal-tests) --builddir=$CABAL_TESTSUITE_BDIR $TESTSUITEJOBS --with-ghc=$EXTRAHC --hide-successes" +(cd cabal-testsuite && timed $CMD) || exit 1 + +done +} # cabal-install ####################################################################### -echo "$CYAN=== cabal-install: build =============================== $(date +%T) === $RESET" - -timed $CABALNEWBUILD cabal-install --enable-tests --disable-benchmarks --dry-run || exit 1 - -# For some reason this sometimes fails. So we try twice. -CMD="$CABALNEWBUILD cabal-install --enable-tests --disable-benchmarks" -(timed $CMD) || (timed $CMD) || exit 1 - - -if $CABALINSTALLTESTS; then -echo "$CYAN=== cabal-install: test ================================ $(date +%T) === $RESET" +step_cli_tests() { +print_header "cabal-install: tests" # this are sorted in asc time used, quicker tests first. CMD="$($CABALPLANLISTBIN cabal-install:test:solver-quickcheck) $TESTSUITEJOBS --hide-successes" @@ -336,42 +427,59 @@ CMD="$($CABALPLANLISTBIN cabal-install:test:memory-usage-tests) -j1 --hide-succe # This test-suite doesn't like concurrency CMD="$($CABALPLANLISTBIN cabal-install:test:integration-tests2) -j1 --hide-successes --with-ghc=$HC" (cd cabal-install && timed $CMD) || exit 1 +} -fi # CABALINSTALLTESTS - +# cabal-install cabal-testsuite +####################################################################### -if $CABALSUITETESTS; then -echo "$CYAN=== cabal-testsuite: cabal-install test ================ $(date +%T) === $RESET" +step_cli_suite() { +print_header "cabal-install: cabal-testsuite" CMD="$($CABALPLANLISTBIN cabal-testsuite:exe:cabal-tests) --builddir=$CABAL_TESTSUITE_BDIR --with-cabal=$($CABALPLANLISTBIN cabal-install:exe:cabal) $TESTSUITEJOBS --hide-successes" (cd cabal-testsuite && timed $CMD) || exit 1 - -fi # CABALSUITETESTS +} # solver-benchmarks ####################################################################### -if $BENCHMARKS; then -echo "$CYAN=== solver-benchmarks: build =========================== $(date +%T) === $RESET" - -timed $CABALNEWBUILD solver-benchmarks:hackage-benchmark solver-benchmarks:unit-tests --enable-tests - -echo "$CYAN=== solver-benchmarks: test ============================ $(date +%T) === $RESET" +step_solver_benchmarks_tests() { +print_header "solver-benchmarks: test" CMD="$($CABALPLANLISTBIN solver-benchmarks:test:unit-tests)" (cd Cabal && timed $CMD) || exit 1 +} -echo "$CYAN=== solver-benchmarks: run ============================= $(date +%T) === $RESET" +step_solver_benchmarks_run() { +print_header "solver-benchmarks: run" SOLVEPKG=Chart-diagrams CMD="$($CABALPLANLISTBIN solver-benchmarks:exe:hackage-benchmark) --cabal1=$CABAL --cabal2=$($CABALPLANLISTBIN cabal-install:exe:cabal) --trials=5 --packages=$SOLVEPKG --print-trials" (cd Cabal && timed $CMD) || exit 1 +} -fi - -# END +# Steps dispatcher ####################################################################### -footer +for step in $STEPS; do + case $step in + print-config) step_print_config ;; + print-tool-versions) step_print_tool_versions ;; + make-cabal-install-dev) step_make_cabal_install_dev ;; + build) step_build ;; + doctest) step_doctest ;; + lib-tests) step_lib_tests ;; + cli-tests) step_cli_tests ;; + lib-suite) step_lib_suite ;; + lib-suite-extras) step_lib_suite_extras ;; + cli-suite) step_cli_suite ;; + solver-benchmarks-tests) step_solver_benchmarks_tests ;; + solver-benchmarks-run) step_solver_benchmarks_run ;; + time-summary) step_time_summary ;; + *) + echo "Invalid step $step" + exit 1 + ;; + esac +done #######################################################################