From 7e8f37ad0d4e4b2b4ba4de58bb7ccf5a23b9bf4d Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Fri, 17 Jan 2020 13:51:00 +0200 Subject: [PATCH 1/3] [.gitattributes] * -text --- .gitattributes | 3 +++ travis-meta.sh | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/.gitattributes b/.gitattributes index ba3614cdefd..ea5cdbb5b3e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,6 @@ +# https://github.community/t5/GitHub-Actions/git-config-core-autocrlf-should-default-to-false/m-p/30731#M534 +* -text + /Cabal/ChangeLog.md merge=union /cabal-install/changelog merge=union /cabal-testsuite/PackageTests/NewBuild/CmdRun/Script/script.hs eol=crlf diff --git a/travis-meta.sh b/travis-meta.sh index 95a18314ab6..e742699abb9 100755 --- a/travis-meta.sh +++ b/travis-meta.sh @@ -6,6 +6,10 @@ # Check that auto-generated files/fields are up to date. # --------------------------------------------------------------------- +# For some reason status might now be clean after checkout +git reset --hard +git status + # Regenerate the CONTRIBUTORS file. # Currently doesn't work because Travis uses --depth=50 when cloning. #./Cabal/misc/gen-authors.sh > AUTHORS From d55a8586345ffd9573008e5c9205b6aa544114a6 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Fri, 17 Jan 2020 14:35:31 +0200 Subject: [PATCH 2/3] T5677 test doesn't work on GitHub actions windows --- cabal-testsuite/PackageTests/Regression/T5677/cabal.test.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/cabal-testsuite/PackageTests/Regression/T5677/cabal.test.hs b/cabal-testsuite/PackageTests/Regression/T5677/cabal.test.hs index cf2a0b01cda..133f4921457 100644 --- a/cabal-testsuite/PackageTests/Regression/T5677/cabal.test.hs +++ b/cabal-testsuite/PackageTests/Regression/T5677/cabal.test.hs @@ -2,4 +2,5 @@ import Test.Cabal.Prelude main = cabalTest $ do -- -Wmissing-export-lists is new in 8.4. skipUnless =<< ghcVersionIs (>= mkVersion [8,3]) + skipIf =<< isWindows -- TODO: https://github.com/haskell/cabal/issues/6271 cabal "v2-build" ["all"] From 56197e1147ae4f9f94ef1f7fc5b76ecabd773255 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Fri, 17 Jan 2020 00:02:11 +0200 Subject: [PATCH 3/3] Add Windows GitHub action workflows Also split workflows into parts, helps with restarting. https://github.community/t5/GitHub-Actions/re-run-jobs/m-p/30476#M440 --- .github/workflows/artifacts.yml | 138 ++++++++++ .github/workflows/bootstrap.yml | 64 +++++ .github/workflows/{validate.yml => linux.yml} | 239 ++---------------- .github/workflows/macos.yml | 117 +++++++++ .github/workflows/quick-jobs.yml | 82 ++++++ .github/workflows/windows.yml | 76 ++++++ Makefile | 11 +- boot/ci-artifacts.template.yml | 138 ++++++++++ boot/ci-bootstrap.template.yml | 64 +++++ boot/ci-linux.template.yml | 62 +++++ boot/ci-macos.template.yml | 62 +++++ boot/ci-quick-jobs.template.yml | 82 ++++++ boot/ci-windows.template.yml | 84 ++++++ boot/validate.template.yml | 239 ------------------ cabal-dev-scripts/src/GenValidate.hs | 23 +- cabal-install/tests/IntegrationTests2.hs | 5 +- .../deterministic.test.hs | 8 +- cabal.project.release | 4 + 18 files changed, 1042 insertions(+), 456 deletions(-) create mode 100644 .github/workflows/artifacts.yml create mode 100644 .github/workflows/bootstrap.yml rename .github/workflows/{validate.yml => linux.yml} (69%) create mode 100644 .github/workflows/macos.yml create mode 100644 .github/workflows/quick-jobs.yml create mode 100644 .github/workflows/windows.yml create mode 100644 boot/ci-artifacts.template.yml create mode 100644 boot/ci-bootstrap.template.yml create mode 100644 boot/ci-linux.template.yml create mode 100644 boot/ci-macos.template.yml create mode 100644 boot/ci-quick-jobs.template.yml create mode 100644 boot/ci-windows.template.yml delete mode 100644 boot/validate.template.yml create mode 100644 cabal.project.release diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml new file mode 100644 index 00000000000..ec673f7c7e5 --- /dev/null +++ b/.github/workflows/artifacts.yml @@ -0,0 +1,138 @@ +name: Artifacts +on: + push: + branches: + - master + - "3.2" + pull_request: + branches: + - master + release: + types: + - created + +jobs: + artifact-linux: + name: Artifact on Linux + runs-on: ubuntu-18.04 + container: + # Older Ubuntu for older glibc + image: phadej/ghc:8.6.5-xenial + steps: + - name: Set PATH + run: | + echo "::add-path::$HOME/.cabal/bin" + - name: Update Hackage index + run: cabal v2-update + - uses: actions/checkout@v1 + - name: Release project + run: | + cp cabal.project.release cabal.project + rm -rf cabal.project.local cabal.project.freeze + - name: Build + run: | + cabal v2-build cabal-install:exe:cabal + cp $(find dist-newstyle -type f -executable -name cabal) cabal.exe + - name: Smoke test + run: | + ./cabal.exe --version + - name: Prepare for upload + run: xz -c < cabal.exe > cabal-artifact.xz + - uses: actions/upload-artifact@v1 + with: + name: cabal-linux-x86_64.xz + path: cabal-artifact.xz + + artifact-macos: + name: Artifact 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: 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 + - uses: actions/checkout@v1 + - name: Release project + run: | + cp cabal.project.release cabal.project + rm -rf cabal.project.local cabal.project.freeze + - name: Build + run: | + cabal v2-build cabal-install:exe:cabal + # macOS find doesn't know -executable + cp $(find dist-newstyle -type f -name cabal) cabal.exe + - name: Smoke test + run: | + ./cabal.exe --version + - name: Prepare for upload + run: xz -c < cabal.exe > cabal-artifact.xz + - uses: actions/upload-artifact@v1 + with: + name: cabal-macos-x86_64.xz + path: cabal-artifact.xz + + artifact-windows: + name: Artifact on Windows + runs-on: windows-latest + steps: + - name: Configure Chocolatey + run: choco source add -n mistuke -s https://www.myget.org/F/mistuke/api/v2 + - name: Install msys2 + run: choco install -y msys2 + - name: Install Cabal + run: choco install -y cabal --version 3.0.0.0 + - name: Install GHC + run: choco install -y ghc --version 8.6.5 + - name: Set PATH + run: | + [Environment]::GetEnvironmentVariable("Path") + Write-Host "::add-path::C:\ProgramData\chocolatey\lib\cabal\tools\cabal-3.0.0.0" + Write-Host "::add-path::C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.6.5\bin" + - name: Print versions + run: | + ghc --version + cabal --version + cabal user-config init -a "http-transport: plain-http" -a "store-dir: C:\SR" -f -v3 + - name: Update Hackage index + run: cabal v2-update + - uses: actions/checkout@v1 + - name: Release project + shell: bash + run: | + cp cabal.project.release cabal.project + rm -rf cabal.project.local cabal.project.freeze + - name: Build + shell: bash + run: | + cabal v2-build cabal-install:exe:cabal + cp dist-newstyle/build/x86_64-windows/ghc-8.6.5/cabal-install-3.3.0.0/build/cabal/cabal.exe cabal.exe + - name: Smoke test + shell: bash + run: | + ./cabal.exe --version + - name: Prepare for upload + shell: bash + run: xz -c < cabal.exe > cabal-artifact.xz + - uses: actions/upload-artifact@v1 + with: + name: cabal-windows-x86_64.xz + path: cabal-artifact.xz diff --git a/.github/workflows/bootstrap.yml b/.github/workflows/bootstrap.yml new file mode 100644 index 00000000000..a1fd2559917 --- /dev/null +++ b/.github/workflows/bootstrap.yml @@ -0,0 +1,64 @@ +# This file is auto-generated +# +# To regenerate it run +# +# make github-actions +# +name: Bootstrap +on: + push: + branches: + - master + - "3.2" + pull_request: + branches: + - master + release: + types: + - created + +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 + + 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 diff --git a/.github/workflows/validate.yml b/.github/workflows/linux.yml similarity index 69% rename from .github/workflows/validate.yml rename to .github/workflows/linux.yml index a4bfab2f0b2..3b0927fa19b 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/linux.yml @@ -4,7 +4,7 @@ # # make github-actions # -name: Validation +name: Linux on: push: branches: @@ -18,128 +18,43 @@ on: - 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 + validate-8_8_2: + name: validate.sh ghc-8.8.2 runs-on: ubuntu-18.04 + container: + image: phadej/ghc:8.8.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" - echo "::add-path::/opt/cabal/3.0/bin" - echo "::add-path::/opt/ghc/8.6.5/bin" - - name: Install cabal-env + - name: Install cabal-plan 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 + 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 - - 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 - + - name: Validate print-config + run: sh validate.sh -j 2 -w ghc-8.8.2 -v --solver-benchmarks -s print-config + - name: Validate print-tool-versions + run: sh validate.sh -j 2 -w ghc-8.8.2 -v --solver-benchmarks -s print-tool-versions + - name: Validate make-cabal-install-dev + run: sh validate.sh -j 2 -w ghc-8.8.2 -v --solver-benchmarks -s make-cabal-install-dev + - name: Validate build + run: sh validate.sh -j 2 -w ghc-8.8.2 -v --solver-benchmarks -s build + - name: Validate lib-tests + run: sh validate.sh -j 2 -w ghc-8.8.2 -v --solver-benchmarks -s lib-tests + - name: Validate lib-suite + run: sh validate.sh -j 2 -w ghc-8.8.2 -v --solver-benchmarks -s lib-suite + - name: Validate cli-tests + run: sh validate.sh -j 2 -w ghc-8.8.2 -v --solver-benchmarks -s cli-tests + - name: Validate cli-suite + run: sh validate.sh -j 2 -w ghc-8.8.2 -v --solver-benchmarks -s cli-suite validate-8_8_1: name: validate.sh ghc-8.8.1 runs-on: ubuntu-18.04 @@ -479,101 +394,3 @@ jobs: 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/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 00000000000..2012c2c2d0e --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,117 @@ +# This file is auto-generated +# +# To regenerate it run +# +# make github-actions +# +name: MacOS +on: + push: + branches: + - master + - "3.2" + pull_request: + branches: + - master + release: + types: + - created + +jobs: + validate-macos-8_8_1: + name: validate.sh 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 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/.github/workflows/quick-jobs.yml b/.github/workflows/quick-jobs.yml new file mode 100644 index 00000000000..c30aec6b95b --- /dev/null +++ b/.github/workflows/quick-jobs.yml @@ -0,0 +1,82 @@ +# This file is auto-generated +# +# To regenerate it run +# +# make github-actions +# +name: Quick jobs +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 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 00000000000..b32b112809c --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,76 @@ +# This file is auto-generated +# +# To regenerate it run +# +# make github-actions +# +name: Windows +on: + push: + branches: + - master + - "3.2" + pull_request: + branches: + - master + release: + types: + - created + +jobs: + + test-windows-8_6_5: + name: test ghc-8.6.5 + runs-on: windows-latest + steps: + - name: Configure Chocolatey + run: choco source add -n mistuke -s https://www.myget.org/F/mistuke/api/v2 + - name: Install msys2 + run: choco install -y msys2 + - name: Install Cabal + run: choco install -y cabal --version 3.0.0.0 + - name: Install GHC + run: choco install -y ghc --version 8.6.5 + - name: Set PATH + run: | + [Environment]::GetEnvironmentVariable("Path") + Write-Host "::add-path::C:\ProgramData\chocolatey\lib\cabal\tools\cabal-3.0.0.0" + Write-Host "::add-path::C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.6.5\bin" + - name: Print versions + run: | + ghc --version + cabal --version + cabal user-config init -a "http-transport: plain-http" -a "store-dir: C:\SR" -f -v3 + - uses: actions/cache@v1 + with: + path: C:\SR + key: linux-store-meta + - name: Update Hackage index + run: cabal v2-update + - uses: actions/checkout@v1 + - name: make cabal-install-dev + run: runghc cabal-dev-scripts/src/Preprocessor.hs -o cabal-install/cabal-install.cabal -f CABAL_FLAG_LIB cabal-install/cabal-install.cabal.pp + # We cannot ask for all dependencies, but we can for Cabal. + - name: cabal v2-build Cabal --only-dependencies + run: cabal v2-build Cabal --only-dependencies + - name: cabal v2-build + run: cabal v2-build all + - name: cabal-install memory-usage-tests + run: | + cd cabal-install + cabal v2-run cabal-install:memory-usage-tests + - name: cabal-install solver-quickcheck + run: | + cd cabal-install + cabal v2-run cabal-install:solver-quickcheck + - name: cabal-install integration-tests2 + run: | + cd cabal-install + cabal v2-run cabal-install:integration-tests2 + - name: cabal-install unit-tests + run: | + cd cabal-install + cabal v2-run cabal-install:unit-tests -- --pattern "! (/FileMonitor/ || /VCS/ || /Get/)" + - name: cabal-tests + # Using only one job, -j1, to fail less. + run: cabal v2-run cabal-tests -- -j1 --with-cabal=dist-newstyle\build\x86_64-windows\ghc-8.6.5\cabal-install-3.3.0.0\x\cabal\build\cabal\cabal.exe diff --git a/Makefile b/Makefile index e0ff28545e4..c835e0bf422 100644 --- a/Makefile +++ b/Makefile @@ -66,9 +66,14 @@ 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 +github-actions : .github/workflows/artifacts.yml +github-actions : .github/workflows/quick-jobs.yml +github-actions : .github/workflows/bootstrap.yml +github-actions : .github/workflows/linux.yml +github-actions : .github/workflows/macos.yml +github-actions : .github/workflows/windows.yml + +.github/workflows/%.yml : boot/ci-%.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! diff --git a/boot/ci-artifacts.template.yml b/boot/ci-artifacts.template.yml new file mode 100644 index 00000000000..ec673f7c7e5 --- /dev/null +++ b/boot/ci-artifacts.template.yml @@ -0,0 +1,138 @@ +name: Artifacts +on: + push: + branches: + - master + - "3.2" + pull_request: + branches: + - master + release: + types: + - created + +jobs: + artifact-linux: + name: Artifact on Linux + runs-on: ubuntu-18.04 + container: + # Older Ubuntu for older glibc + image: phadej/ghc:8.6.5-xenial + steps: + - name: Set PATH + run: | + echo "::add-path::$HOME/.cabal/bin" + - name: Update Hackage index + run: cabal v2-update + - uses: actions/checkout@v1 + - name: Release project + run: | + cp cabal.project.release cabal.project + rm -rf cabal.project.local cabal.project.freeze + - name: Build + run: | + cabal v2-build cabal-install:exe:cabal + cp $(find dist-newstyle -type f -executable -name cabal) cabal.exe + - name: Smoke test + run: | + ./cabal.exe --version + - name: Prepare for upload + run: xz -c < cabal.exe > cabal-artifact.xz + - uses: actions/upload-artifact@v1 + with: + name: cabal-linux-x86_64.xz + path: cabal-artifact.xz + + artifact-macos: + name: Artifact 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: 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 + - uses: actions/checkout@v1 + - name: Release project + run: | + cp cabal.project.release cabal.project + rm -rf cabal.project.local cabal.project.freeze + - name: Build + run: | + cabal v2-build cabal-install:exe:cabal + # macOS find doesn't know -executable + cp $(find dist-newstyle -type f -name cabal) cabal.exe + - name: Smoke test + run: | + ./cabal.exe --version + - name: Prepare for upload + run: xz -c < cabal.exe > cabal-artifact.xz + - uses: actions/upload-artifact@v1 + with: + name: cabal-macos-x86_64.xz + path: cabal-artifact.xz + + artifact-windows: + name: Artifact on Windows + runs-on: windows-latest + steps: + - name: Configure Chocolatey + run: choco source add -n mistuke -s https://www.myget.org/F/mistuke/api/v2 + - name: Install msys2 + run: choco install -y msys2 + - name: Install Cabal + run: choco install -y cabal --version 3.0.0.0 + - name: Install GHC + run: choco install -y ghc --version 8.6.5 + - name: Set PATH + run: | + [Environment]::GetEnvironmentVariable("Path") + Write-Host "::add-path::C:\ProgramData\chocolatey\lib\cabal\tools\cabal-3.0.0.0" + Write-Host "::add-path::C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.6.5\bin" + - name: Print versions + run: | + ghc --version + cabal --version + cabal user-config init -a "http-transport: plain-http" -a "store-dir: C:\SR" -f -v3 + - name: Update Hackage index + run: cabal v2-update + - uses: actions/checkout@v1 + - name: Release project + shell: bash + run: | + cp cabal.project.release cabal.project + rm -rf cabal.project.local cabal.project.freeze + - name: Build + shell: bash + run: | + cabal v2-build cabal-install:exe:cabal + cp dist-newstyle/build/x86_64-windows/ghc-8.6.5/cabal-install-3.3.0.0/build/cabal/cabal.exe cabal.exe + - name: Smoke test + shell: bash + run: | + ./cabal.exe --version + - name: Prepare for upload + shell: bash + run: xz -c < cabal.exe > cabal-artifact.xz + - uses: actions/upload-artifact@v1 + with: + name: cabal-windows-x86_64.xz + path: cabal-artifact.xz diff --git a/boot/ci-bootstrap.template.yml b/boot/ci-bootstrap.template.yml new file mode 100644 index 00000000000..a1fd2559917 --- /dev/null +++ b/boot/ci-bootstrap.template.yml @@ -0,0 +1,64 @@ +# This file is auto-generated +# +# To regenerate it run +# +# make github-actions +# +name: Bootstrap +on: + push: + branches: + - master + - "3.2" + pull_request: + branches: + - master + release: + types: + - created + +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 + + 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 diff --git a/boot/ci-linux.template.yml b/boot/ci-linux.template.yml new file mode 100644 index 00000000000..720a176347b --- /dev/null +++ b/boot/ci-linux.template.yml @@ -0,0 +1,62 @@ +# This file is auto-generated +# +# To regenerate it run +# +# make github-actions +# +name: Linux +on: + push: + branches: + - master + - "3.2" + pull_request: + branches: + - master + release: + types: + - created + +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 %} diff --git a/boot/ci-macos.template.yml b/boot/ci-macos.template.yml new file mode 100644 index 00000000000..8a0aecd7292 --- /dev/null +++ b/boot/ci-macos.template.yml @@ -0,0 +1,62 @@ +# This file is auto-generated +# +# To regenerate it run +# +# make github-actions +# +name: MacOS +on: + push: + branches: + - master + - "3.2" + pull_request: + branches: + - master + release: + types: + - created + +jobs: +{% for job in macosJobs %} + validate-macos-{{ mangleVersion job.version }}: + name: validate.sh 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/boot/ci-quick-jobs.template.yml b/boot/ci-quick-jobs.template.yml new file mode 100644 index 00000000000..c30aec6b95b --- /dev/null +++ b/boot/ci-quick-jobs.template.yml @@ -0,0 +1,82 @@ +# This file is auto-generated +# +# To regenerate it run +# +# make github-actions +# +name: Quick jobs +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 diff --git a/boot/ci-windows.template.yml b/boot/ci-windows.template.yml new file mode 100644 index 00000000000..48a5431cdc6 --- /dev/null +++ b/boot/ci-windows.template.yml @@ -0,0 +1,84 @@ +# This file is auto-generated +# +# To regenerate it run +# +# make github-actions +# +name: Windows +on: + push: + branches: + - master + - "3.2" + pull_request: + branches: + - master + release: + types: + - created + +jobs: + +{############################################################################} +{# Windows jobs #} +{############################################################################} +{% for job in winJobs %} + test-windows-{{ mangleVersion job.version }}: + name: test ghc-{{job.version}} + runs-on: windows-latest +{% for needs in job.needs %} + needs: test-windows-{{ mangleVersion needs }} +{% endfor %} + steps: + - name: Configure Chocolatey + run: choco source add -n mistuke -s https://www.myget.org/F/mistuke/api/v2 + - name: Install msys2 + run: choco install -y msys2 + - name: Install Cabal + run: choco install -y cabal --version 3.0.0.0 + - name: Install GHC + run: choco install -y ghc --version 8.6.5 + - name: Set PATH + run: | + [Environment]::GetEnvironmentVariable("Path") + Write-Host "::add-path::C:\ProgramData\chocolatey\lib\cabal\tools\cabal-3.0.0.0" + Write-Host "::add-path::C:\ProgramData\chocolatey\lib\ghc\tools\ghc-{{ job.version }}\bin" + - name: Print versions + run: | + ghc --version + cabal --version + cabal user-config init -a "http-transport: plain-http" -a "store-dir: C:\SR" -f -v3 + - uses: actions/cache@v1 + with: + path: C:\SR + key: linux-store-meta + - name: Update Hackage index + run: cabal v2-update + - uses: actions/checkout@v1 + - name: make cabal-install-dev + run: runghc cabal-dev-scripts/src/Preprocessor.hs -o cabal-install/cabal-install.cabal -f CABAL_FLAG_LIB cabal-install/cabal-install.cabal.pp + # We cannot ask for all dependencies, but we can for Cabal. + - name: cabal v2-build Cabal --only-dependencies + run: cabal v2-build Cabal --only-dependencies + - name: cabal v2-build + run: cabal v2-build all + - name: cabal-install memory-usage-tests + run: | + cd cabal-install + cabal v2-run cabal-install:memory-usage-tests + - name: cabal-install solver-quickcheck + run: | + cd cabal-install + cabal v2-run cabal-install:solver-quickcheck + - name: cabal-install integration-tests2 + run: | + cd cabal-install + cabal v2-run cabal-install:integration-tests2 + - name: cabal-install unit-tests + run: | + cd cabal-install + cabal v2-run cabal-install:unit-tests -- --pattern "! (/FileMonitor/ || /VCS/ || /Get/)" + - name: cabal-tests + # Using only one job, -j1, to fail less. + run: cabal v2-run cabal-tests -- -j1 --with-cabal=dist-newstyle\build\x86_64-windows\ghc-{{ job.version }}\cabal-install-3.3.0.0\x\cabal\build\cabal\cabal.exe +{% endfor %} diff --git a/boot/validate.template.yml b/boot/validate.template.yml deleted file mode 100644 index adc840aa8a5..00000000000 --- a/boot/validate.template.yml +++ /dev/null @@ -1,239 +0,0 @@ -# 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/src/GenValidate.hs b/cabal-dev-scripts/src/GenValidate.hs index 299f186773c..80e8ff19ce1 100644 --- a/cabal-dev-scripts/src/GenValidate.hs +++ b/cabal-dev-scripts/src/GenValidate.hs @@ -22,7 +22,8 @@ main = do -- 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.8.2" False "--solver-benchmarks" False [] defSteps + , GhcJob "8.8.1" False "--solver-benchmarks" False [] defSteps -- to be removed , 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 @@ -41,6 +42,14 @@ main = do [ 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" ] + , zWinJobs = + -- 8.8.1 fails atm, + -- Shutting down GHCi sessions (please be patient)... + -- Unexpected failure on GHCi exit: fd:10: hClose: resource vanished (Broken pipe) + -- cabal-tests: fd:10: hClose: resource vanished (Broken pipe) + -- [ WinGhcJob "8.8.1" ["8.6.5"] + [ WinGhcJob "8.6.5" [] + ] , zMangleVersion = map mangleChar , zOr = (||) , zNotNull = not . null @@ -86,6 +95,7 @@ libSteps = data Z = Z { zJobs :: [GhcJob] , zMacosJobs :: [MacGhcJob] + , zWinJobs :: [WinGhcJob] , zMangleVersion :: String -> String , zOr :: Bool -> Bool -> Bool , zNotNull :: [String] -> Bool @@ -112,6 +122,12 @@ data MacGhcJob = MacGhcJob } deriving (Generic) +data WinGhcJob = WinGhcJob + { wgjVersion :: String + , wgjNeeds :: [String] + } + deriving (Generic) + mkMacGhcJob :: String -> String -> MacGhcJob mkMacGhcJob v u = MacGhcJob { mgjVersion = v @@ -135,3 +151,8 @@ instance Zinza MacGhcJob where toType = genericToTypeSFP toValue = genericToValueSFP fromValue = genericFromValueSFP + +instance Zinza WinGhcJob where + toType = genericToTypeSFP + toValue = genericToValueSFP + fromValue = genericFromValueSFP diff --git a/cabal-install/tests/IntegrationTests2.hs b/cabal-install/tests/IntegrationTests2.hs index a5b02040fbc..2538a7e4382 100644 --- a/cabal-install/tests/IntegrationTests2.hs +++ b/cabal-install/tests/IntegrationTests2.hs @@ -1724,6 +1724,9 @@ expectBuildFailed (BuildFailure _ reason) = withFileFinallyRestore :: FilePath -> IO a -> IO a withFileFinallyRestore file action = do copyFile file backup - action `finally` renameFile backup file + action `finally` handle onIOError (renameFile backup file) where backup = file <.> "backup" + + onIOError :: IOException -> IO () + onIOError e = putStrLn $ "WARNING: Cannot restore " ++ file ++ "; " ++ show e diff --git a/cabal-testsuite/PackageTests/NewSdist/DeterministicTrivial/deterministic.test.hs b/cabal-testsuite/PackageTests/NewSdist/DeterministicTrivial/deterministic.test.hs index 692af2ee15d..64b0a329a95 100644 --- a/cabal-testsuite/PackageTests/NewSdist/DeterministicTrivial/deterministic.test.hs +++ b/cabal-testsuite/PackageTests/NewSdist/DeterministicTrivial/deterministic.test.hs @@ -11,7 +11,13 @@ main = cabalTest $ do let dir = testCurrentDir env knownSdist = dir "deterministic-0.tar.gz" mySdist = dir "dist-newstyle" "sdist" "deterministic-0.tar.gz" - + + -- This helps to understand why this test fails, if it does: + -- + -- shell "tar" ["-tzvf", knownSdist] + -- shell "tar" ["-tzvf", mySdist] + -- + known <- liftIO (BS.readFile knownSdist) unknown <- liftIO (BS.readFile mySdist) diff --git a/cabal.project.release b/cabal.project.release new file mode 100644 index 00000000000..0c7a63204df --- /dev/null +++ b/cabal.project.release @@ -0,0 +1,4 @@ +packages: Cabal/ +packages: cabal-install/ +tests: False +benchmarks: False