From b301f059654241b960fc58a675f76b874732753d Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 1 Mar 2022 11:15:45 +0100 Subject: [PATCH 01/47] Correct typo in validate.sh --- validate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validate.sh b/validate.sh index ec08aef9657..c5d96c95bd9 100755 --- a/validate.sh +++ b/validate.sh @@ -36,7 +36,7 @@ Usage: ./validate.sh [options] Available options: -j, --jobs JOBS cabal v2-build -j argument (default: $JOBS) - --libonly Test onlt Cabal-the-library + --libonly Test only Cabal-the-library --cli Test both Cabal-the-library and cabal-install --(no-)run-lib-tests Run library tests --(no-)run-cli-tests Run client tests From deaba671160ba0a26f2f4520446e00f1e80f32fb Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 1 Mar 2022 12:26:49 +0100 Subject: [PATCH 02/47] Merge all os's --- .github/workflows/macos.yml | 118 ----------------- .github/workflows/{linux.yml => validate.yml} | 122 ++++++++++-------- .github/workflows/windows.yml | 122 ------------------ 3 files changed, 69 insertions(+), 293 deletions(-) delete mode 100644 .github/workflows/macos.yml rename .github/workflows/{linux.yml => validate.yml} (64%) delete mode 100644 .github/workflows/windows.yml diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml deleted file mode 100644 index f9a899f0965..00000000000 --- a/.github/workflows/macos.yml +++ /dev/null @@ -1,118 +0,0 @@ -name: MacOS - -# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency. -concurrency: - group: ${{ github.ref }}-${{ github.workflow }} - cancel-in-progress: true - -on: - push: - branches: - - master - pull_request: - release: - types: - - created - -jobs: - validate: - name: Validate macos-latest ghc-${{ matrix.ghc }} - - runs-on: macos-latest - continue-on-error: ${{ matrix.experimental }} - - strategy: - matrix: - include: - - ghc: "9.2.1" - cli: true - experimental: true # work to be done - flags: "" - - ghc: "9.0.2" - cli: false - experimental: true # see #7987 - - ghc: "9.0.1" - cli: false - experimental: true # see #7988 - flags: "--lib-only" - - ghc: "8.10.7" - cli: true - experimental: true # see #7952 and #7988 - flags: "" - - ghc: "8.8.4" - cli: true - experimental: false - flags: "--solver-benchmarks" - - ghc: "8.6.5" - cli: true - experimental: false - flags: "--complete-hackage-tests" - - ghc: "8.4.4" - cli: true - experimental: false - flags: "" - - ghc: "8.2.2" - cli: true - experimental: false - flags: "" - - ghc: "8.0.2" - cli: false - experimental: true # see #7988 and #7989 - flags: "--lib-only" - - steps: - - - uses: actions/checkout@v2 - - - uses: haskell/actions/setup@v1 - id: setup-haskell - with: - ghc-version: ${{ matrix.ghc }} - cabal-version: latest # default, keeping for visibility - - # See the following link for a breakdown of the following step - # https://github.com/haskell/actions/issues/7#issuecomment-745697160 - - uses: actions/cache@v2 - with: - path: | - ${{ steps.setup-haskell.outputs.cabal-store }} - dist-newstyle - key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }} - restore-keys: ${{ runner.os }}-${{ matrix.ghc }}- - - # The '+exe' constraint below is important, otherwise cabal-install - # might decide to build the library but not the executable which is - # what we need. - - name: Install cabal-plan - run: | - cd $(mktemp -d) - cabal install cabal-plan --constraint='cabal-plan +exe' - echo "$HOME/.cabal/bin" >> $GITHUB_PATH - - # Needed by cabal-testsuite/PackageTests/Configure/setup.test.hs - - name: Install Autotools - run: | - brew install automake - - - name: Validate print-config - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ matrix.flags }} -s print-config - - - name: Validate print-tool-versions - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ matrix.flags }} -s print-tool-versions - - - name: Validate build - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ matrix.flags }} -s build - - - name: Validate lib-tests - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ matrix.flags }} -s lib-tests - - - name: Validate lib-suite - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ matrix.flags }} -s lib-suite - - - name: Validate cli-tests - if: matrix.cli == true - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ matrix.flags }} -s cli-tests - - - name: Validate cli-suite - if: matrix.cli == true - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ matrix.flags }} -s cli-suite diff --git a/.github/workflows/linux.yml b/.github/workflows/validate.yml similarity index 64% rename from .github/workflows/linux.yml rename to .github/workflows/validate.yml index d1cb868e7fb..a212ef0e587 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/validate.yml @@ -1,4 +1,8 @@ -name: Linux +name: Validate + +defaults: + run: + shell: bash # See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency. concurrency: @@ -16,50 +20,47 @@ on: jobs: validate: - name: Validate ubuntu-latest ghc-${{ matrix.ghc }} + name: Validate ${{ matrix.os }} ghc-${{ matrix.ghc }} - runs-on: ubuntu-latest - continue-on-error: ${{ matrix.experimental }} + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.experimental == 'true' }} strategy: matrix: + os: ["ubuntu-latest", "macos-latest", "windows-latest"] + ghc: ["9.2.1", "9.0.2", "9.0.1", "8.10.7", "8.8.4", "8.6.5", "8.4.4", "8.0.2"] include: - - ghc: "9.2.1" - cli: true - experimental: true # work to be done - flags: "" - - ghc: "9.0.2" - cli: false - experimental: true # see #7987 - flags: "--lib-only" - - ghc: "9.0.1" - cli: false - experimental: false - flags: "--lib-only" - - ghc: "8.10.7" - cli: true - experimental: false - flags: "" - - ghc: "8.8.4" - cli: true - experimental: false - flags: "--solver-benchmarks" - - ghc: "8.6.5" - cli: true - experimental: false - flags: "--complete-hackage-tests" - - ghc: "8.4.4" - cli: true - experimental: false - flags: "" - - ghc: "8.2.2" - cli: true - experimental: false - flags: "" - - ghc: "8.0.2" - cli: false - experimental: false - flags: "--lib-only" + - os: "ubuntu-latest" + ghc: "9.2.1" + experimental: "true" # work to be done + - os: "macos-latest" + ghc: "9.2.1" + experimental: "true" # work to be done + - os: "ubuntu-latest" + ghc: "9.0.2" + cli: "false" + experimental: "true" # see #7987 + - os: "macos-latest" + ghc: "9.0.2" + cli: "false" + experimental: "true" # see #7987 + - os: "macos-latest" + ghc: "9.0.1" + cli: "false" + experimental: "true" # see #7988 + - os: "ubuntu-latest" + ghc: "9.0.1" + cli: "false" + - os: "macos-latest" + ghc: "8.10.7" + experimental: "true" # see #7952 and #7988 + - os: "ubuntu-latest" + ghc: "8.0.2" + cli: "false" + - os: "macos-latest" + ghc: "8.0.2" + cli: "false" + experimental: "true" # see #7988 and #7989 steps: @@ -90,43 +91,58 @@ jobs: cabal install cabal-plan --constraint='cabal-plan +exe' echo "$HOME/.cabal/bin" >> $GITHUB_PATH + - name: Set validate inputs + id: validate-inputs + run: | + FLAGS="" + if [[ "${{ matrix.cli }}" == "false" ]]; then + FLAGS="$FLAGS --lib-only" + fi + if [[ ${{ matrix.ghc }} == 8.8.4 ]]; then + FLAGS="$FLAGS --solver-benchmarks" + fi + if [[ ${{ matrix.ghc }} == 8.6.5 ]]; then + FLAGS="$FLAGS --complete-hackage-tests" + fi + echo ::set-output name=flags::$FLAGS + - name: Validate print-config - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ matrix.flags }} -s print-config + run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ steps.validate-inputs.outputs.flags }} -s print-config - name: Validate print-tool-versions - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ matrix.flags }} -s print-tool-versions + run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ steps.validate-inputs.outputs.flags }} -s print-tool-versions - name: Validate build - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ matrix.flags }} -s build + run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ steps.validate-inputs.outputs.flags }} -s build - name: Validate lib-tests - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ matrix.flags }} -s lib-tests + run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ steps.validate-inputs.outputs.flags }} -s lib-tests - name: Validate lib-suite - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ matrix.flags }} -s lib-suite + run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ steps.validate-inputs.outputs.flags }} -s lib-suite - name: Validate cli-tests - if: matrix.cli == true - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ matrix.flags }} -s cli-tests + if: matrix.cli != 'false' + run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ steps.validate-inputs.outputs.flags }} -s cli-tests - name: Validate cli-suite - if: matrix.cli == true - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ matrix.flags }} -s cli-suite + if: matrix.cli != 'false' + run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ steps.validate-inputs.outputs.flags }} -s cli-suite validate-old-ghcs: name: Validate old ghcs ${{ matrix.extra-ghc }} runs-on: ubuntu-18.04 needs: validate - # This job needs an older ubuntu (16.04) cause the needed - # old ghcs using the `-dyn` flavour are not installable - # from ppa/hvr in newer ones + # This job needs an older ubuntu (16.04) cause + # the required old ghcs using the `-dyn` flavour + # are not installable from ppa/hvr in newer ones # see https://github.com/haskell/cabal/issues/8011 container: image: phadej/ghc:8.8.4-xenial strategy: matrix: - # Newer ghc versions than 8.8.4 has to be installed with ghcup cause + # Newer ghc versions than 8.8.4 have to be installed with ghcup cause # they are not available in ppa/hvr. The ghcup installation # needs `sudo` which is not available in the xenial container ghc: ["8.8.4"] diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index 421539b0a67..00000000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,122 +0,0 @@ -name: Windows - -# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency. -concurrency: - group: ${{ github.ref }}-${{ github.workflow }} - cancel-in-progress: true - -on: - push: - branches: - - master - pull_request: - release: - types: - - created - -jobs: - test-windows: - strategy: - matrix: - ghc: - - "8.6.5" - - "8.10.4" - - name: test ghc-${{ matrix.ghc }} - runs-on: windows-latest - steps: - - uses: actions/setup-haskell@v1.1.4 - with: - ghc-version: ${{ matrix.ghc }} - cabal-version: '3.4.0.0' - - name: Print versions - run: | - [Environment]::GetEnvironmentVariable("Path") - cabal --version - ghc --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: windows-store-meta - - uses: actions/checkout@v2 - # all dependencies of Cabal already there (due to GHC depending on Cabal) - - name: cabal v2-build Cabal - run: cabal v2-build Cabal - # We cannot ask for all dependencies, but we can for cabal-install. - - name: cabal v2-build cabal-install --only-dependencies - run: cabal v2-build cabal-install --only-dependencies - - name: cabal v2-build - run: cabal v2-build all - - name: Cabal unit-tests - run: | - cabal v2-test Cabal-tests - - name: cabal-install memory-usage-tests - run: | - cd cabal-install - cabal v2-run cabal-install:memory-usage-tests - - name: cabal-install long-tests - run: | - cd cabal-install - cabal v2-run cabal-install:long-tests -- --pattern "! (/FileMonitor/ || /VCS/ || /Get/)" - - 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-testsuite:cabal-tests -- -j1 --with-cabal=dist-newstyle\build\x86_64-windows\ghc-${{ matrix.ghc }}\cabal-install-3.7.0.0\x\cabal\build\cabal\cabal.exe - - # TODO: store the exe from above as artifact and re-use it here instead of building anew - test-windows-dogfood: - strategy: - matrix: - ghc: - - "8.6.5" - - "8.10.4" - name: test ghc-${{ matrix.ghc }} dogfood - runs-on: windows-latest - steps: - - uses: actions/setup-haskell@v1.1.4 - with: - ghc-version: ${{ matrix.ghc }} - cabal-version: '3.4.0.0' - - name: Print versions - run: | - [Environment]::GetEnvironmentVariable("Path") - cabal --version - ghc --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: windows-store-meta - - name: Update Hackage index - run: cabal v2-update - - uses: actions/checkout@v2 - # all dependencies of Cabal already there (due to GHC depending on Cabal) - - name: cabal v2-build Cabal - run: cabal v2-build Cabal - # We cannot ask for all dependencies, but we can for cabal-install. - - name: cabal v2-build cabal-install --only-dependencies - run: cabal v2-build cabal-install --only-dependencies - - name: cabal v2-build - run: cabal v2-build all - - name: wipe out cabal store - run: Remove-Item -Recurse -Force C:\SR - - name: eat its own dogfood by building own Cabal source with itself - run: | - cp $(cabal list-bin exe:cabal) ./cabal-exe-current - ./cabal-exe-current --version - ./cabal-exe-current v2-build Cabal - shell: bash - - name: eat its own dogfood by building all deps with itself - run: ./cabal-exe-current v2-build cabal-install --only-dependencies - shell: bash - - name: eat its own dogfood by building own source with itself - run: ./cabal-exe-current v2-build all - shell: bash From ff12a3dc30b71e1d853b5f4f7a54b3bb184d462b Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 1 Mar 2022 13:09:59 +0100 Subject: [PATCH 03/47] Add windows arch to validate.sh --- validate.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/validate.sh b/validate.sh index c5d96c95bd9..3e8e1a55059 100755 --- a/validate.sh +++ b/validate.sh @@ -290,7 +290,9 @@ JOBS="-j$JOBS" # assume compiler is GHC RUNHASKELL=$(echo $HC | sed -E 's/ghc(-[0-9.]*)$/runghc\1/') -if [ "$(uname)" = "Linux" ]; then +if [ "$OSTYPE" = "msys" -o "$OSTYPE" = "cygwin" ]; then + ARCH="x86_64-windows" +elif [ "$(uname)" = "Linux" ]; then ARCH="x86_64-linux" else ARCH="x86_64-osx" From 9e03dbc894d5df00e4f959444f33456e56055c66 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 1 Mar 2022 13:14:15 +0100 Subject: [PATCH 04/47] Dont use cli for win and 8.0.2 --- .github/workflows/validate.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index a212ef0e587..86f84b318bf 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -61,6 +61,9 @@ jobs: ghc: "8.0.2" cli: "false" experimental: "true" # see #7988 and #7989 + - os: "windows-latest" + ghc: "8.0.2" + cli: "false" steps: From 06ec4b9351aa6c4cfb342ee6f55bd7e3ac493937 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 1 Mar 2022 14:00:01 +0100 Subject: [PATCH 05/47] Remove compile warnings --- cabal-testsuite/src/Test/Cabal/Prelude.hs | 3 ++- cabal-testsuite/src/Test/Cabal/Server.hs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cabal-testsuite/src/Test/Cabal/Prelude.hs b/cabal-testsuite/src/Test/Cabal/Prelude.hs index fc17d964f8e..2bc4e0bd7a0 100644 --- a/cabal-testsuite/src/Test/Cabal/Prelude.hs +++ b/cabal-testsuite/src/Test/Cabal/Prelude.hs @@ -62,10 +62,11 @@ import System.Exit (ExitCode (..)) import System.FilePath ((), takeExtensions, takeDrive, takeDirectory, normalise, splitPath, joinPath, splitFileName, (<.>), dropTrailingPathSeparator) import Control.Concurrent (threadDelay) import qualified Data.Char as Char -import System.Directory (getTemporaryDirectory, getCurrentDirectory, canonicalizePath, copyFile, removeFile, copyFile, doesDirectoryExist, doesFileExist, createDirectoryIfMissing, getDirectoryContents) +import System.Directory (getTemporaryDirectory, getCurrentDirectory, canonicalizePath, copyFile, copyFile, doesDirectoryExist, doesFileExist, createDirectoryIfMissing, getDirectoryContents) #ifndef mingw32_HOST_OS import Control.Monad.Catch ( bracket_ ) +import System.Directory ( removeFile ) import System.Posix.Files ( createSymbolicLink ) import System.Posix.Resource #endif diff --git a/cabal-testsuite/src/Test/Cabal/Server.hs b/cabal-testsuite/src/Test/Cabal/Server.hs index 5dc4f26a122..8a2fbb981dd 100644 --- a/cabal-testsuite/src/Test/Cabal/Server.hs +++ b/cabal-testsuite/src/Test/Cabal/Server.hs @@ -254,7 +254,8 @@ initServer s0 = do pid <- withProcessHandle (serverProcessHandle s0) $ \ph -> case ph of OpenHandle x -> fmap show (Win32.getProcessId x) - ClosedHandle _ -> return (serverProcessId s0) + -- TODO: handle OpenExtHandle? + _ -> return (serverProcessId s0) #else pid <- withProcessHandle (serverProcessHandle s0) $ \ph -> case ph of From 9a5f975432225418f75f55540633f1e2d54c9e11 Mon Sep 17 00:00:00 2001 From: Javier Neira Date: Tue, 1 Mar 2022 15:22:54 +0100 Subject: [PATCH 06/47] Install autoconf in mac --- .github/workflows/validate.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 86f84b318bf..3625bd00e66 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -94,6 +94,12 @@ jobs: cabal install cabal-plan --constraint='cabal-plan +exe' echo "$HOME/.cabal/bin" >> $GITHUB_PATH + # Needed by cabal-testsuite/PackageTests/Configure/setup.test.hs + - name: Install Autotools + if: runner.os == 'macOS' + run: | + brew install automake + - name: Set validate inputs id: validate-inputs run: | From 5bd1df091d4ca059c19ded0112422248c5ce0e79 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 1 Mar 2022 21:59:14 +0100 Subject: [PATCH 07/47] Use full path to ghc --- .github/workflows/validate.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 3625bd00e66..f2fe4ba4617 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -116,6 +116,7 @@ jobs: echo ::set-output name=flags::$FLAGS - name: Validate print-config + run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ steps.validate-inputs.outputs.flags }} -s print-config - name: Validate print-tool-versions @@ -125,7 +126,11 @@ jobs: run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ steps.validate-inputs.outputs.flags }} -s build - name: Validate lib-tests - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ steps.validate-inputs.outputs.flags }} -s lib-tests + env: + # `rawSystemStdInOut reports text decoding errors` + # test does not find ghc without the full path in windows + GHCPATH: ${{ steps.setup-haskell.outputs.ghc-exe }} + run: sh validate.sh -j 2 -w $GHCPATH -v ${{ steps.validate-inputs.outputs.flags }} -s lib-tests - name: Validate lib-suite run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ steps.validate-inputs.outputs.flags }} -s lib-suite From 7d4cb5823ad4e57a8cc1b1bb2745c454bcfc54ca Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 1 Mar 2022 23:30:28 +0100 Subject: [PATCH 08/47] Dont execute hackage tests in win --- validate.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/validate.sh b/validate.sh index 3e8e1a55059..827097a8fe4 100755 --- a/validate.sh +++ b/validate.sh @@ -290,7 +290,7 @@ JOBS="-j$JOBS" # assume compiler is GHC RUNHASKELL=$(echo $HC | sed -E 's/ghc(-[0-9.]*)$/runghc\1/') -if [ "$OSTYPE" = "msys" -o "$OSTYPE" = "cygwin" ]; then +if [ "$OSTYPE" = "msys" ]; then ARCH="x86_64-windows" elif [ "$(uname)" = "Linux" ]; then ARCH="x86_64-linux" @@ -395,7 +395,10 @@ CMD="$($CABALPLANLISTBIN Cabal-tests:test:no-thunks-test) $TESTSUITEJOBS --hide- (cd Cabal-tests && timed $CMD) || exit 1 CMD=$($CABALPLANLISTBIN Cabal-tests:test:hackage-tests) -(cd Cabal-tests && timed $CMD read-fields) || exit 1 +# hackage-tests is not buildable in windows so $CMD will be empty here +if [ "$OSTYPE" != "msys" ]; then + (cd Cabal-tests && timed $CMD read-fields) || exit 1 +fi if $HACKAGETESTSALL; then (cd Cabal-tests && timed $CMD parsec) || exit 1 From 0e4cfcfacb6d9ca7c76f503fc0acfa039be1063b Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 2 Mar 2022 08:24:47 +0100 Subject: [PATCH 09/47] Make shorter memory tests suite name --- cabal-install/cabal-install.cabal | 2 +- doc/cabal-commands.rst | 4 ++-- validate.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cabal-install/cabal-install.cabal b/cabal-install/cabal-install.cabal index 216588ade87..5f8311da7bd 100644 --- a/cabal-install/cabal-install.cabal +++ b/cabal-install/cabal-install.cabal @@ -332,7 +332,7 @@ Test-Suite unit-tests -- Tests to run with a limited stack and heap size -- -Test-Suite memory-usage-tests +Test-Suite mem-use-tests import: warnings, base-dep, cabal-dep, cabal-syntax-dep, cabal-install-solver-dep type: exitcode-stdio-1.0 main-is: MemoryUsageTests.hs diff --git a/doc/cabal-commands.rst b/doc/cabal-commands.rst index bb6a357feca..55936302d34 100644 --- a/doc/cabal-commands.rst +++ b/doc/cabal-commands.rst @@ -202,7 +202,7 @@ Example showing a failure to resolve to a single executable. cabal: The list-bin command is for finding a single binary at once. The target 'cabal-install' refers to the package cabal-install-#.#.#.# which includes the executable 'cabal', the test suite 'unit-tests', the test suite - 'memory-usage-tests', the test suite 'long-tests' and the test suite + 'mem-use-tests', the test suite 'long-tests' and the test suite 'integration-tests2'. For a scope that results in only one item we'll get a path. @@ -223,7 +223,7 @@ We can also scope to test suite targets as they produce binaries. cabal: The list-bin command is for finding a single binary at once. The target 'cabal-install:tests' refers to the test suites in the package cabal-install-#.#.#.# which includes the test suite 'unit-tests', the test - suite 'memory-usage-tests', the test suite 'long-tests' and the test suite + suite 'mem-use-tests', the test suite 'long-tests' and the test suite 'integration-tests2'. $ cabal list-bin cabal-install:unit-tests diff --git a/validate.sh b/validate.sh index 827097a8fe4..be7ed40c2ce 100755 --- a/validate.sh +++ b/validate.sh @@ -443,7 +443,7 @@ CMD="$($CABALPLANLISTBIN cabal-install:test:unit-tests) -j1 --hide-successes" (cd cabal-install && timed $CMD) || exit 1 # Only single job, otherwise we fail with "Heap exhausted" -CMD="$($CABALPLANLISTBIN cabal-install:test:memory-usage-tests) -j1 --hide-successes" +CMD="$($CABALPLANLISTBIN cabal-install:test:mem-use-tests) -j1 --hide-successes" (cd cabal-install && timed $CMD) || exit 1 # This test-suite doesn't like concurrency From d8ea51b29663b33f75e11925c43d9987c3e27f4d Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 2 Mar 2022 09:46:03 +0100 Subject: [PATCH 10/47] Add comment about the name change warning about the windows max path issue --- cabal-install/cabal-install.cabal | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cabal-install/cabal-install.cabal b/cabal-install/cabal-install.cabal index 5f8311da7bd..de6d1e93099 100644 --- a/cabal-install/cabal-install.cabal +++ b/cabal-install/cabal-install.cabal @@ -331,7 +331,9 @@ Test-Suite unit-tests -- Tests to run with a limited stack and heap size --- +-- The test suite name must be keep short cause a longer one +-- could make the build generate paths which exceeds the windows +-- max path limit (still a problem for some ghc versions) Test-Suite mem-use-tests import: warnings, base-dep, cabal-dep, cabal-syntax-dep, cabal-install-solver-dep type: exitcode-stdio-1.0 From e2dd6aefd6f50cb9554539381eee1fb7f12fa85a Mon Sep 17 00:00:00 2001 From: jneira Date: Thu, 3 Mar 2022 12:31:33 +0100 Subject: [PATCH 11/47] Use FLAGS as global env var --- .github/workflows/validate.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index f2fe4ba4617..9bde25a6b9b 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -113,17 +113,17 @@ jobs: if [[ ${{ matrix.ghc }} == 8.6.5 ]]; then FLAGS="$FLAGS --complete-hackage-tests" fi - echo ::set-output name=flags::$FLAGS + echo "FLAGS=$FLAGS" >> $GITHUB_ENV - name: Validate print-config - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ steps.validate-inputs.outputs.flags }} -s print-config + run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s print-config - name: Validate print-tool-versions - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ steps.validate-inputs.outputs.flags }} -s print-tool-versions + run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s print-tool-versions - name: Validate build - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ steps.validate-inputs.outputs.flags }} -s build + run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s build - name: Validate lib-tests env: @@ -207,4 +207,7 @@ jobs: run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ matrix.flags }} -s build - name: "Validate lib-suite-extras --extra-hc ghc-${{ matrix.extra-ghc }}" - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v --lib-only -s lib-suite-extras --extra-hc /opt/ghc/${{ matrix.extra-ghc }}/bin/ghc-${{ matrix.extra-ghc }} + env: + FLAGS: "--lib-only -s lib-suite-extras" + EXTRA_GHC: "/opt/ghc/${{ matrix.extra-ghc }}/bin/ghc-${{ matrix.extra-ghc }}" + run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS --extra-hc $EXTRA_GHC From 1679a53395c782fa935b95290ee42d7e98bd294b Mon Sep 17 00:00:00 2001 From: jneira Date: Thu, 3 Mar 2022 14:39:53 +0100 Subject: [PATCH 12/47] Fix abs paths test for windows --- .../tests/UnitTests/Distribution/Client/FileMonitor.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cabal-install/tests/UnitTests/Distribution/Client/FileMonitor.hs b/cabal-install/tests/UnitTests/Distribution/Client/FileMonitor.hs index c949f39d055..bc8b66d2628 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/FileMonitor.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/FileMonitor.hs @@ -697,19 +697,19 @@ testGlobAbsolutePath mtimeChange = threadDelay mtimeChange removeFile root "dir/good-a" reason <- expectMonitorChanged root monitor () - reason @?= MonitoredFileChanged (root' "dir/good-a") + reason @?= MonitoredFileChanged (root' "dir" "good-a") -- absolute glob, adding a file updateMonitor root monitor [monitorFileGlobStr (root' "dir/good-*")] () () threadDelay mtimeChange touchFile root ("dir/good-a") reason2 <- expectMonitorChanged root monitor () - reason2 @?= MonitoredFileChanged (root' "dir/good-a") + reason2 @?= MonitoredFileChanged (root' "dir" "good-a") -- absolute glob, changing a file updateMonitor root monitor [monitorFileGlobStr (root' "dir/good-*")] () () threadDelay mtimeChange touchFileContent root "dir/good-b" reason3 <- expectMonitorChanged root monitor () - reason3 @?= MonitoredFileChanged (root' "dir/good-b") + reason3 @?= MonitoredFileChanged (root' "dir" "good-b") ------------------ From 89e7157f31e4efd1a4e18780474a283881e9acc0 Mon Sep 17 00:00:00 2001 From: jneira Date: Sat, 5 Mar 2022 16:40:15 +0100 Subject: [PATCH 13/47] Mark unit tests broken for win --- cabal-install/cabal-install.cabal | 7 ++++--- .../Distribution/Client/FileMonitor.hs | 13 ++++++++++--- .../UnitTests/Distribution/Client/VCS.hs | 19 ++++++++++++++----- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/cabal-install/cabal-install.cabal b/cabal-install/cabal-install.cabal index de6d1e93099..c9c7966e2c4 100644 --- a/cabal-install/cabal-install.cabal +++ b/cabal-install/cabal-install.cabal @@ -263,7 +263,7 @@ executable cabal -- Small, fast running tests. -- -Test-Suite unit-tests +test-suite unit-tests import: warnings, base-dep, cabal-dep, cabal-syntax-dep, cabal-install-solver-dep default-language: Haskell2010 ghc-options: -rtsopts -threaded @@ -332,9 +332,9 @@ Test-Suite unit-tests -- Tests to run with a limited stack and heap size -- The test suite name must be keep short cause a longer one --- could make the build generate paths which exceeds the windows +-- could make the build generating paths which exceeds the windows -- max path limit (still a problem for some ghc versions) -Test-Suite mem-use-tests +test-suite mem-use-tests import: warnings, base-dep, cabal-dep, cabal-syntax-dep, cabal-install-solver-dep type: exitcode-stdio-1.0 main-is: MemoryUsageTests.hs @@ -409,6 +409,7 @@ test-suite long-tests random, tagged, tasty >= 1.2.3 && <1.5, + tasty-expected-failure, tasty-hunit >= 0.10, tasty-quickcheck, QuickCheck >= 2.14 && <2.15, diff --git a/cabal-install/tests/UnitTests/Distribution/Client/FileMonitor.hs b/cabal-install/tests/UnitTests/Distribution/Client/FileMonitor.hs index bc8b66d2628..77d321ce964 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/FileMonitor.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/FileMonitor.hs @@ -14,6 +14,7 @@ import qualified Prelude as IO (writeFile) import Distribution.Compat.Binary import Distribution.Simple.Utils (withTempDirectory) +import Distribution.System (buildOS, OS (Windows)) import Distribution.Verbosity (silent) import Distribution.Client.FileMonitor @@ -22,6 +23,7 @@ import Distribution.Utils.Structured (structureHash, Structured) import GHC.Fingerprint (Fingerprint (..)) import Test.Tasty +import Test.Tasty.ExpectedFailure import Test.Tasty.HUnit @@ -60,8 +62,9 @@ tests mtimeChange = , testCase "add non-match" $ testGlobAddNonMatch mtimeChange , testCase "remove non-match" $ testGlobRemoveNonMatch mtimeChange - , testCase "add non-match" $ testGlobAddNonMatchSubdir mtimeChange - , testCase "remove non-match" $ testGlobRemoveNonMatchSubdir mtimeChange + , knownBrokenIn buildOS "See issue #XXXX" $ + testCase "add non-match subdir" $ testGlobAddNonMatchSubdir mtimeChange + , testCase "remove non-match subdir" $ testGlobRemoveNonMatchSubdir mtimeChange , testCase "invariant sorted 1" $ testInvariantMonitorStateGlobFiles mtimeChange @@ -69,7 +72,8 @@ tests mtimeChange = mtimeChange , testCase "match dirs" $ testGlobMatchDir mtimeChange - , testCase "match dirs only" $ testGlobMatchDirOnly mtimeChange + , knownBrokenIn buildOS "See issue #XXXX" $ + testCase "match dirs only" $ testGlobMatchDirOnly mtimeChange , testCase "change file type" $ testGlobChangeFileType mtimeChange , testCase "absolute paths" $ testGlobAbsolutePath mtimeChange ] @@ -80,6 +84,9 @@ tests mtimeChange = , testCase "value updated" testValueUpdated ] + where knownBrokenIn Windows msg = expectFailBecause msg + knownBrokenIn _ _ = id + -- Check the file system behaves the way we expect it to -- we rely on file mtimes having a reasonable resolution diff --git a/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs b/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs index c450cf86c0e..679038afbb9 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs @@ -7,6 +7,7 @@ import Distribution.Client.VCS import Distribution.Client.RebuildMonad ( execRebuild ) import Distribution.Simple.Program +import Distribution.System ( buildOS, OS (Windows) ) import Distribution.Verbosity as Verbosity import Distribution.Client.Types.SourceRepo (SourceRepositoryPackage (..), SourceRepoProxy) @@ -27,6 +28,7 @@ import System.Random import Test.Tasty import Test.Tasty.QuickCheck +import Test.Tasty.ExpectedFailure import UnitTests.Distribution.Client.ArbitraryInstances import UnitTests.TempTestDir (withTestDir, removeDirectoryRecursiveHack) @@ -48,26 +50,30 @@ import UnitTests.TempTestDir (withTestDir, removeDirectoryRecursiveHack) -- tests :: MTimeChange -> [TestTree] tests mtimeChange = map (localOption $ QuickCheckTests 10) - [ testGroup "git" + [ knownBrokenIn buildOS "See issue #XXXX" $ + testGroup "git" [ testProperty "check VCS test framework" prop_framework_git , testProperty "cloneSourceRepo" prop_cloneRepo_git , testProperty "syncSourceRepos" prop_syncRepos_git ] - -- for the moment they're not yet working - , testGroup "darcs" $ const [] + -- + , ignoreTestBecause "for the moment they're not yet working" $ + testGroup "darcs" [ testProperty "check VCS test framework" $ prop_framework_darcs mtimeChange , testProperty "cloneSourceRepo" $ prop_cloneRepo_darcs mtimeChange , testProperty "syncSourceRepos" $ prop_syncRepos_darcs mtimeChange ] - , testGroup "pijul" $ const [] + , ignoreTestBecause "for the moment they're not yet working" $ + testGroup "pijul" [ testProperty "check VCS test framework" prop_framework_pijul , testProperty "cloneSourceRepo" prop_cloneRepo_pijul , testProperty "syncSourceRepos" prop_syncRepos_pijul ] - , testGroup "mercurial" $ const [] + , ignoreTestBecause "for the moment they're not yet working" $ + testGroup "mercurial" [ testProperty "check VCS test framework" prop_framework_hg , testProperty "cloneSourceRepo" prop_cloneRepo_hg , testProperty "syncSourceRepos" prop_syncRepos_hg @@ -75,6 +81,9 @@ tests mtimeChange = map (localOption $ QuickCheckTests 10) ] + where knownBrokenIn Windows msg = expectFailBecause msg + knownBrokenIn _ _ = id + prop_framework_git :: BranchingRepoRecipe 'SubmodulesSupported -> Property prop_framework_git = ioProperty From 37f682a33b122fb6e90310b3b635b259c40e406b Mon Sep 17 00:00:00 2001 From: jneira Date: Sun, 6 Mar 2022 11:03:51 +0100 Subject: [PATCH 14/47] Mark ForeignLibs broken for win and 9.0 Referencing issue #7989 --- cabal-testsuite/PackageTests/ForeignLibs/setup.test.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cabal-testsuite/PackageTests/ForeignLibs/setup.test.hs b/cabal-testsuite/PackageTests/ForeignLibs/setup.test.hs index 108219f29f2..8b0bf0e4b1e 100644 --- a/cabal-testsuite/PackageTests/ForeignLibs/setup.test.hs +++ b/cabal-testsuite/PackageTests/ForeignLibs/setup.test.hs @@ -27,8 +27,10 @@ main = setupAndCabalTest . recordMode DoNotRecord $ do -- Foreign libraries don't work with GHC 7.6 and earlier skipUnlessGhcVersion ">= 7.8" osx <- isOSX - ghc <- isGhcVersion "== 8.0.2" - expectBrokenIf (osx && ghc) 7989 $ + ghc80 <- isGhcVersion "== 8.0.2" + win <- isWindows + ghcGreaterThan90 <- isGhcVersion ">= 9.0" + expectBrokenIf ((osx && ghc80) || (win && ghcGreaterThan90)) 7989 $ withPackageDb $ do setup_install [] setup "copy" [] -- regression test #4156 From 572197a600bbcd94be0e9c04f4f863a45b87c295 Mon Sep 17 00:00:00 2001 From: jneira Date: Sun, 6 Mar 2022 18:50:47 +0100 Subject: [PATCH 15/47] Fix unexpected ok for windows --- cabal-testsuite/PackageTests/NewBuild/T3827/cabal.test.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.test.hs b/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.test.hs index c1287f9bb2a..1771c5e19fe 100644 --- a/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.test.hs +++ b/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.test.hs @@ -1,7 +1,8 @@ import Test.Cabal.Prelude main = cabalTest $ do + win <- isWindows missesProfiling <- isGhcVersion ">= 9.2.1" osx <- isOSX missesProfilingOsx <- isGhcVersion ">= 8.10.7" - expectBrokenIf (missesProfiling || osx && missesProfilingOsx) 8032 $ + expectBrokenIf (missesProfiling && not win || osx && missesProfilingOsx) 8032 $ cabal "v2-build" ["exe:q"] From 1d3f4300c1c58ac8531dc41505f73a9f6cd418be Mon Sep 17 00:00:00 2001 From: jneira Date: Sun, 6 Mar 2022 18:55:53 +0100 Subject: [PATCH 16/47] Ignore windows test artifacts --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 9852cbc2d15..8f1097ae8a1 100644 --- a/.gitignore +++ b/.gitignore @@ -65,6 +65,10 @@ progress.txt # test files register.sh +# windows test artifacts +cabal-testsuite/**/*.exe +cabal-testsuite/**/*.bat + # python artifacts from documentation builds *.pyc .python-sphinx-virtualenv/ From 682907a187c915a662df184a2c4f0485a4b72998 Mon Sep 17 00:00:00 2001 From: jneira Date: Sun, 6 Mar 2022 23:29:55 +0100 Subject: [PATCH 17/47] Special case for win and old ghcs --- .github/workflows/validate.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 9bde25a6b9b..0b51922c542 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -54,6 +54,9 @@ jobs: - os: "macos-latest" ghc: "8.10.7" experimental: "true" # see #7952 and #7988 + - os: "windows-latest" + ghc: "8.8.4" + cli: "false" # lot of segfaults caused by ghc bugs - os: "ubuntu-latest" ghc: "8.0.2" cli: "false" @@ -139,9 +142,18 @@ jobs: if: matrix.cli != 'false' run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ steps.validate-inputs.outputs.flags }} -s cli-tests + # Lot of tests of the cli suite in windows fails due + # to the max path issue using the msys2 shell (cause paths are longer) + # We have to run the suite in powershell directly. + - name: Validate cli-suite for windows and old ghcs + if: matrix.cli != 'false' && (runner.os == 'Windows' && (matrix.ghc == '8.4.4' || matrix.ghc == '8.6.5')) + shell: powershell + run: | + cabal v2-run cabal-testsuite:cabal-tests -- -j1 --with-cabal=dist-newstyle\build\x86_64-windows\ghc-${{ matrix.ghc }}\cabal-install-3.7.0.0\x\cabal\build\cabal\cabal.exe + - name: Validate cli-suite - if: matrix.cli != 'false' - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ steps.validate-inputs.outputs.flags }} -s cli-suite + if: matrix.cli != 'false' && !(runner.os == 'Windows' && (matrix.ghc == '8.4.4' || matrix.ghc == '8.6.5')) + run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s cli-suite validate-old-ghcs: name: Validate old ghcs ${{ matrix.extra-ghc }} From 4f12a20cf30f2e6df307b37e1c26de471f92b96c Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 7 Mar 2022 08:59:59 +0100 Subject: [PATCH 18/47] Fix validate workflow --- .github/workflows/validate.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 0b51922c542..33e1e3a563b 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -29,34 +29,29 @@ jobs: matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] ghc: ["9.2.1", "9.0.2", "9.0.1", "8.10.7", "8.8.4", "8.6.5", "8.4.4", "8.0.2"] + exclude: + # lot of segfaults caused by ghc bugs + - os: "windows-latest" + ghc: "8.8.4" include: - os: "ubuntu-latest" ghc: "9.2.1" - experimental: "true" # work to be done - os: "macos-latest" ghc: "9.2.1" - experimental: "true" # work to be done - os: "ubuntu-latest" ghc: "9.0.2" cli: "false" - experimental: "true" # see #7987 - os: "macos-latest" ghc: "9.0.2" cli: "false" - experimental: "true" # see #7987 - os: "macos-latest" ghc: "9.0.1" cli: "false" - experimental: "true" # see #7988 - os: "ubuntu-latest" ghc: "9.0.1" cli: "false" - os: "macos-latest" ghc: "8.10.7" - experimental: "true" # see #7952 and #7988 - - os: "windows-latest" - ghc: "8.8.4" - cli: "false" # lot of segfaults caused by ghc bugs - os: "ubuntu-latest" ghc: "8.0.2" cli: "false" @@ -119,7 +114,10 @@ jobs: echo "FLAGS=$FLAGS" >> $GITHUB_ENV - name: Validate print-config +<<<<<<< HEAD +======= +>>>>>>> 5b443654e (Fix validate workflow) run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s print-config - name: Validate print-tool-versions @@ -144,7 +142,9 @@ jobs: # Lot of tests of the cli suite in windows fails due # to the max path issue using the msys2 shell (cause paths are longer) - # We have to run the suite in powershell directly. + # We have to run the suite in powershell directly to avoid it. + # Newer ghcs don't suffer the issue so we could remove this step + # when we remove support for older ones - name: Validate cli-suite for windows and old ghcs if: matrix.cli != 'false' && (runner.os == 'Windows' && (matrix.ghc == '8.4.4' || matrix.ghc == '8.6.5')) shell: powershell @@ -205,7 +205,7 @@ jobs: with: path: | ${{ steps.setup-haskell.outputs.cabal-store }} - dist-newstyle + dist-* key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }} restore-keys: ${{ runner.os }}-${{ matrix.ghc }}- From f0dccf7f8a364f4303c22aee63d95337f6349fc7 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 7 Mar 2022 09:34:18 +0100 Subject: [PATCH 19/47] Clean matrix and fix old ghcs --- .github/workflows/validate.yml | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 33e1e3a563b..67a143eb210 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -1,5 +1,7 @@ name: Validate +# We use bash as default even in windows +# to try keep the workflow as uniform as possible defaults: run: shell: bash @@ -21,10 +23,7 @@ on: jobs: validate: name: Validate ${{ matrix.os }} ghc-${{ matrix.ghc }} - runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.experimental == 'true' }} - strategy: matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] @@ -34,31 +33,22 @@ jobs: - os: "windows-latest" ghc: "8.8.4" include: - - os: "ubuntu-latest" - ghc: "9.2.1" - - os: "macos-latest" - ghc: "9.2.1" - - os: "ubuntu-latest" - ghc: "9.0.2" - cli: "false" - - os: "macos-latest" - ghc: "9.0.2" - cli: "false" + # We only run the cli test suite for the last minor version - os: "macos-latest" ghc: "9.0.1" cli: "false" - os: "ubuntu-latest" ghc: "9.0.1" cli: "false" - - os: "macos-latest" - ghc: "8.10.7" + - os: "windows-latest" + ghc: "9.0.1" + cli: "false" - os: "ubuntu-latest" ghc: "8.0.2" cli: "false" - os: "macos-latest" ghc: "8.0.2" cli: "false" - experimental: "true" # see #7988 and #7989 - os: "windows-latest" ghc: "8.0.2" cli: "false" @@ -144,7 +134,7 @@ jobs: # to the max path issue using the msys2 shell (cause paths are longer) # We have to run the suite in powershell directly to avoid it. # Newer ghcs don't suffer the issue so we could remove this step - # when we remove support for older ones + # when we remove support for those older ghcs - name: Validate cli-suite for windows and old ghcs if: matrix.cli != 'false' && (runner.os == 'Windows' && (matrix.ghc == '8.4.4' || matrix.ghc == '8.6.5')) shell: powershell @@ -222,4 +212,4 @@ jobs: env: FLAGS: "--lib-only -s lib-suite-extras" EXTRA_GHC: "/opt/ghc/${{ matrix.extra-ghc }}/bin/ghc-${{ matrix.extra-ghc }}" - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS --extra-hc $EXTRA_GHC + run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ env.FLAGS }} --extra-hc ${{ env.EXTRA_GHC }} From dad1c1ed2a0e652ffad3ad1cb64966ce7d15ce05 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 7 Mar 2022 10:31:34 +0100 Subject: [PATCH 20/47] Add post job --- .github/workflows/validate.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 67a143eb210..36504bc7328 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -213,3 +213,19 @@ jobs: FLAGS: "--lib-only -s lib-suite-extras" EXTRA_GHC: "/opt/ghc/${{ matrix.extra-ghc }}/bin/ghc-${{ matrix.extra-ghc }}" run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ env.FLAGS }} --extra-hc ${{ env.EXTRA_GHC }} + + # We use this job as a resume of the workflow + # It will fail if any of the previous jobs does it + # This way we can use it exclusively in branch protection rules + # and abstract away the concrete jobs of the workflow, including their names + validate-post-job: + name: Validate post job + runs-on: ubuntu-18.04 + # IMPORTANT! Any job added to the workflow should be added here too + needs: [validate, validate-old-ghcs] + + steps: + - run: | + echo "jobs info: ${{ toJSON(needs) }}" + - if: contains(needs.*.result, 'failure') + run: exit 1 \ No newline at end of file From 883a5cd66fb408fe6fb715ac7fac5b9378f54c57 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 7 Mar 2022 11:40:55 +0100 Subject: [PATCH 21/47] Remove superfluous spaces --- validate.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/validate.sh b/validate.sh index be7ed40c2ce..ac4fb44316e 100755 --- a/validate.sh +++ b/validate.sh @@ -319,7 +319,7 @@ print_header print-config cat < Date: Mon, 7 Mar 2022 13:15:10 +0100 Subject: [PATCH 22/47] Skip T3827 for ghc-9.0.2, see #8032 --- cabal-testsuite/PackageTests/NewBuild/T3827/cabal.test.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.test.hs b/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.test.hs index 1771c5e19fe..f89a4fe4d9c 100644 --- a/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.test.hs +++ b/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.test.hs @@ -1,8 +1,8 @@ import Test.Cabal.Prelude main = cabalTest $ do - win <- isWindows - missesProfiling <- isGhcVersion ">= 9.2.1" + linux <- isLinux + missesProfilingLinux <- isGhcVersion ">= 9.0.2" osx <- isOSX missesProfilingOsx <- isGhcVersion ">= 8.10.7" - expectBrokenIf (missesProfiling && not win || osx && missesProfilingOsx) 8032 $ + expectBrokenIf (linux && missesProfilingLinux || osx && missesProfilingOsx) 8032 $ cabal "v2-build" ["exe:q"] From fec51329335402b5aa73b307e2c6255334482a3f Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 7 Mar 2022 14:41:58 +0100 Subject: [PATCH 23/47] Upload cabal executable --- .github/workflows/validate.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 36504bc7328..7c0fa36e3f3 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -114,7 +114,19 @@ jobs: run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s print-tool-versions - name: Validate build - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s build + run: | + sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s build + if [[ "${{ matrix.cli }}" != "false" ]]; then + CABAL_EXEC=$(cabal-plan list-bin --builddir=dist-val-ghc-${{ matrix.ghc }} cabal-install:exe:cabal) + echo "CABAL_EXEC=$CABAL_EXEC" >> $GITHUB_ENV + fi + + - name: Upload cabal-install executable to workflow artifacts + if: matrix.cli != 'false' + uses: actions/upload-artifact@v2 + with: + name: cabal-${{ runner.os }}-${{ matrix.ghc }} + path: ${{ env.CABAL_EXEC }} - name: Validate lib-tests env: @@ -228,4 +240,4 @@ jobs: - run: | echo "jobs info: ${{ toJSON(needs) }}" - if: contains(needs.*.result, 'failure') - run: exit 1 \ No newline at end of file + run: exit 1 From 5ac0f6a288b53fbfd7c63e5cb30212f930c492be Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 8 Mar 2022 09:31:30 +0100 Subject: [PATCH 24/47] Tar cabal executable --- .github/workflows/validate.yml | 69 ++++++++++++++++++++++++++++++---- 1 file changed, 62 insertions(+), 7 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 7c0fa36e3f3..146f2204c1d 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -20,6 +20,11 @@ on: types: - created +# We choose a stable ghc version across all os's +# which will be used to do the next release +env: + GHC_FOR_RELEASE: '8.10.7' + jobs: validate: name: Validate ${{ matrix.os }} ghc-${{ matrix.ghc }} @@ -116,17 +121,26 @@ jobs: - name: Validate build run: | sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s build - if [[ "${{ matrix.cli }}" != "false" ]]; then + if [[ "${{ matrix.cli }}" != "false" && ${{ matrix.ghc }} == ${{ env.GHC_FOR_RELEASE }} ]]; then CABAL_EXEC=$(cabal-plan list-bin --builddir=dist-val-ghc-${{ matrix.ghc }} cabal-install:exe:cabal) - echo "CABAL_EXEC=$CABAL_EXEC" >> $GITHUB_ENV + # We have to tar the executable to preserve executable permission + # see https://github.com/actions/upload-artifact/issues/38 + if [[ ${{ runner.os }} == 'Windows' ]]; then + CABAL_EXEC=$(cygpath $CABAL_EXEC) + fi + tar -cvf cabal-head.tar -C $(dirname "$CABAL_EXEC") $(basename "$CABAL_EXEC") + echo "CABAL_EXEC_TAR=cabal-head.tar" >> $GITHUB_ENV fi + # We upload the cabal executable built with the ghc used in the release for: + # - Reuse it in the dogfooding job (although we could use the cached build dir) + # - Make it available in the workflow to make easier testing it locally - name: Upload cabal-install executable to workflow artifacts - if: matrix.cli != 'false' + if: matrix.cli != 'false' && matrix.ghc == env.GHC_FOR_RELEASE uses: actions/upload-artifact@v2 with: name: cabal-${{ runner.os }}-${{ matrix.ghc }} - path: ${{ env.CABAL_EXEC }} + path: ${{ env.CABAL_EXEC_TAR }} - name: Validate lib-tests env: @@ -200,9 +214,9 @@ jobs: with: ghc-version: ${{ matrix.ghc }} - # TODO: ideally those jobs should reuse the cabal artifact generated in the - # previous step. Until that we use the cache generated in the previous step - # to make the build faster. This job only needs it in read mode. + # As we are reusing the cached build dir from the previous step + # the generated artifacts are available here, + # including the cabal executable and the test suite - uses: actions/cache@v2 with: path: | @@ -226,6 +240,47 @@ jobs: EXTRA_GHC: "/opt/ghc/${{ matrix.extra-ghc }}/bin/ghc-${{ matrix.extra-ghc }}" run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ env.FLAGS }} --extra-hc ${{ env.EXTRA_GHC }} + # The previous job uses a released version of cabal to build cabal HEAD itself + # This one uses the cabal HEAD generated executable in the previous step + # to build itself again, as sanity check + dogfooding: + name: Dogfooding ${{ matrix.os }} ghc-${{ matrix.ghc }} + runs-on: ${{ matrix.os }} + needs: validate + strategy: + matrix: + os: ["ubuntu-latest", "macos-latest", "windows-latest"] + # We only use one ghc version the used one for the next release (defined at top of the workflow) + ghc: [ env.GHC_FOR_RELEASE ] + + steps: + - uses: actions/checkout@v2 + + - uses: haskell/actions/setup@v1 + id: setup-haskell + with: + ghc-version: ${{ matrix.ghc }} + cabal-version: latest # default, we are not using it in this job + + - name: Download cabal executable from workflow artifacts + # We only store the artifact built with the ghc used for the release + if: matrix.ghc == env.GHC_FOR_RELEASE + uses: actions/download-artifact@v2 + with: + name: cabal-${{ runner.os }}-${{ matrix.ghc }} + path: cabal-head + + - name: Untar the cabal executable + run: tar -xf ./cabal-head/cabal-head.tar -C ./cabal-head + + - name: print-config using cabal HEAD + run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} --with-cabal ./cabal-head/cabal -v -s print-config + + # We dont use cache to force a build with a fresh store dir and build dir + # This way we check cabal can build all its dependencies + - name: Build using cabal HEAD + run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} --with-cabal ./cabal-head/cabal -v -s build + # We use this job as a resume of the workflow # It will fail if any of the previous jobs does it # This way we can use it exclusively in branch protection rules From a44310113528402ce685f6833b557f0dc83ca653 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 7 Mar 2022 23:11:18 +0100 Subject: [PATCH 25/47] Add dogfooding job --- .github/workflows/validate.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 146f2204c1d..87b5a40a0a9 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -251,7 +251,7 @@ jobs: matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] # We only use one ghc version the used one for the next release (defined at top of the workflow) - ghc: [ env.GHC_FOR_RELEASE ] + ghc: ["8.10.7"] steps: - uses: actions/checkout@v2 @@ -289,7 +289,7 @@ jobs: name: Validate post job runs-on: ubuntu-18.04 # IMPORTANT! Any job added to the workflow should be added here too - needs: [validate, validate-old-ghcs] + needs: [validate, validate-old-ghcs, dogfooding] steps: - run: | From 13a1abe56d6614fb0fbcd38a4e9eb8e89ce9aa94 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 8 Mar 2022 09:51:29 +0100 Subject: [PATCH 26/47] Use constants and clean up --- .github/workflows/validate.yml | 35 ++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 87b5a40a0a9..bd5ca1dbf9e 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -20,10 +20,13 @@ on: types: - created -# We choose a stable ghc version across all os's -# which will be used to do the next release env: + # We choose a stable ghc version across all os's + # which will be used to do the next release GHC_FOR_RELEASE: '8.10.7' + # Ideally the three ghcs should be the used for the release + GHC_FOR_SOLVER_BENCHMARKS: '8.8.4' + GHC_FOR_COMPLETE_HACKAGE_TESTS: '8.6.5' jobs: validate: @@ -100,10 +103,10 @@ jobs: if [[ "${{ matrix.cli }}" == "false" ]]; then FLAGS="$FLAGS --lib-only" fi - if [[ ${{ matrix.ghc }} == 8.8.4 ]]; then + if [[ ${{ matrix.ghc }} == ${{ env.GHC_FOR_SOLVER_BENCHMARKS }} ]]; then FLAGS="$FLAGS --solver-benchmarks" fi - if [[ ${{ matrix.ghc }} == 8.6.5 ]]; then + if [[ ${{ matrix.ghc }} == ${{ env.GHC_FOR_COMPLETE_HACKAGE_TESTS }} ]]; then FLAGS="$FLAGS --complete-hackage-tests" fi echo "FLAGS=$FLAGS" >> $GITHUB_ENV @@ -121,16 +124,18 @@ jobs: - name: Validate build run: | sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s build - if [[ "${{ matrix.cli }}" != "false" && ${{ matrix.ghc }} == ${{ env.GHC_FOR_RELEASE }} ]]; then - CABAL_EXEC=$(cabal-plan list-bin --builddir=dist-val-ghc-${{ matrix.ghc }} cabal-install:exe:cabal) - # We have to tar the executable to preserve executable permission - # see https://github.com/actions/upload-artifact/issues/38 - if [[ ${{ runner.os }} == 'Windows' ]]; then - CABAL_EXEC=$(cygpath $CABAL_EXEC) - fi - tar -cvf cabal-head.tar -C $(dirname "$CABAL_EXEC") $(basename "$CABAL_EXEC") - echo "CABAL_EXEC_TAR=cabal-head.tar" >> $GITHUB_ENV + + - name: Tar cabal head executable + if: matrix.cli != 'false' && matrix.ghc == env.GHC_FOR_RELEASE + run: | + CABAL_EXEC=$(cabal-plan list-bin --builddir=dist-val-ghc-${{ matrix.ghc }} cabal-install:exe:cabal) + # We have to tar the executable to preserve executable permissions + # see https://github.com/actions/upload-artifact/issues/38 + if [[ ${{ runner.os }} == 'Windows' ]]; then + CABAL_EXEC=$(cygpath $CABAL_EXEC) fi + tar -cvf cabal-head.tar -C $(dirname "$CABAL_EXEC") $(basename "$CABAL_EXEC") + echo "CABAL_EXEC_TAR=cabal-head.tar" >> $GITHUB_ENV # We upload the cabal executable built with the ghc used in the release for: # - Reuse it in the dogfooding job (although we could use the cached build dir) @@ -240,7 +245,7 @@ jobs: EXTRA_GHC: "/opt/ghc/${{ matrix.extra-ghc }}/bin/ghc-${{ matrix.extra-ghc }}" run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ env.FLAGS }} --extra-hc ${{ env.EXTRA_GHC }} - # The previous job uses a released version of cabal to build cabal HEAD itself + # The previous jobs use a released version of cabal to build cabal HEAD itself # This one uses the cabal HEAD generated executable in the previous step # to build itself again, as sanity check dogfooding: @@ -263,8 +268,6 @@ jobs: cabal-version: latest # default, we are not using it in this job - name: Download cabal executable from workflow artifacts - # We only store the artifact built with the ghc used for the release - if: matrix.ghc == env.GHC_FOR_RELEASE uses: actions/download-artifact@v2 with: name: cabal-${{ runner.os }}-${{ matrix.ghc }} From a69c0e861b7fe26d4a105cdeb16fdcec84c0761c Mon Sep 17 00:00:00 2001 From: jneira Date: Fri, 11 Mar 2022 14:11:42 +0100 Subject: [PATCH 27/47] Make it fail if any job is cancelled --- .github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index bd5ca1dbf9e..367093cc4cb 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -297,5 +297,5 @@ jobs: steps: - run: | echo "jobs info: ${{ toJSON(needs) }}" - - if: contains(needs.*.result, 'failure') + - if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') run: exit 1 From 5d4d616aeb84115c24320d31eaca49644ced9ad8 Mon Sep 17 00:00:00 2001 From: jneira Date: Sat, 12 Mar 2022 21:42:23 +0100 Subject: [PATCH 28/47] Dont run any hackage tests on win --- validate.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/validate.sh b/validate.sh index ac4fb44316e..fede7289dab 100755 --- a/validate.sh +++ b/validate.sh @@ -397,16 +397,16 @@ CMD="$($CABALPLANLISTBIN Cabal-tests:test:no-thunks-test) $TESTSUITEJOBS --hide- CMD=$($CABALPLANLISTBIN Cabal-tests:test:hackage-tests) # hackage-tests is not buildable in windows so $CMD will be empty here if [ "$OSTYPE" != "msys" ]; then - (cd Cabal-tests && timed $CMD read-fields) || exit 1 + (cd Cabal-tests && timed $CMD read-fields) || exit 1 + if $HACKAGETESTSALL; then + (cd Cabal-tests && timed $CMD parsec) || exit 1 + (cd Cabal-tests && timed $CMD roundtrip) || exit 1 + else + (cd Cabal-tests && timed $CMD parsec d) || exit 1 + (cd Cabal-tests && timed $CMD roundtrip k) || exit 1 + fi fi -if $HACKAGETESTSALL; then - (cd Cabal-tests && timed $CMD parsec) || exit 1 - (cd Cabal-tests && timed $CMD roundtrip) || exit 1 -else - (cd Cabal-tests && timed $CMD parsec d) || exit 1 - (cd Cabal-tests && timed $CMD roundtrip k) || exit 1 -fi } # Cabal cabal-testsuite From c9a968a3d52d8d67b00920ec1a982ced3c0c491d Mon Sep 17 00:00:00 2001 From: jneira Date: Sat, 12 Mar 2022 21:54:55 +0100 Subject: [PATCH 29/47] Recover bad rebase --- .github/workflows/validate.yml | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 367093cc4cb..a20c0d6e8e0 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -75,9 +75,10 @@ jobs: # https://github.com/haskell/actions/issues/7#issuecomment-745697160 - uses: actions/cache@v2 with: + # validate.sh uses a special build dir path: | ${{ steps.setup-haskell.outputs.cabal-store }} - dist-newstyle + dist-* key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }} restore-keys: ${{ runner.os }}-${{ matrix.ghc }}- @@ -112,10 +113,6 @@ jobs: echo "FLAGS=$FLAGS" >> $GITHUB_ENV - name: Validate print-config -<<<<<<< HEAD - -======= ->>>>>>> 5b443654e (Fix validate workflow) run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s print-config - name: Validate print-tool-versions @@ -152,28 +149,17 @@ jobs: # `rawSystemStdInOut reports text decoding errors` # test does not find ghc without the full path in windows GHCPATH: ${{ steps.setup-haskell.outputs.ghc-exe }} - run: sh validate.sh -j 2 -w $GHCPATH -v ${{ steps.validate-inputs.outputs.flags }} -s lib-tests + run: sh validate.sh -j 2 -w $GHCPATH -v $FLAGS -s lib-tests - name: Validate lib-suite - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ steps.validate-inputs.outputs.flags }} -s lib-suite + run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s lib-suite - name: Validate cli-tests if: matrix.cli != 'false' - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ steps.validate-inputs.outputs.flags }} -s cli-tests - - # Lot of tests of the cli suite in windows fails due - # to the max path issue using the msys2 shell (cause paths are longer) - # We have to run the suite in powershell directly to avoid it. - # Newer ghcs don't suffer the issue so we could remove this step - # when we remove support for those older ghcs - - name: Validate cli-suite for windows and old ghcs - if: matrix.cli != 'false' && (runner.os == 'Windows' && (matrix.ghc == '8.4.4' || matrix.ghc == '8.6.5')) - shell: powershell - run: | - cabal v2-run cabal-testsuite:cabal-tests -- -j1 --with-cabal=dist-newstyle\build\x86_64-windows\ghc-${{ matrix.ghc }}\cabal-install-3.7.0.0\x\cabal\build\cabal\cabal.exe + run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s cli-tests - name: Validate cli-suite - if: matrix.cli != 'false' && !(runner.os == 'Windows' && (matrix.ghc == '8.4.4' || matrix.ghc == '8.6.5')) + if: matrix.cli != 'false' run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s cli-suite validate-old-ghcs: From 24c68cbc46db95b16ab9ab9d7228c11b8aa5d8ed Mon Sep 17 00:00:00 2001 From: jneira Date: Sat, 12 Mar 2022 23:31:50 +0100 Subject: [PATCH 30/47] Mark more tests as broken --- .../PackageTests/Regression/T6906/cabal.test.hs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cabal-testsuite/PackageTests/Regression/T6906/cabal.test.hs b/cabal-testsuite/PackageTests/Regression/T6906/cabal.test.hs index 1636c27af8d..628ab68ba3d 100644 --- a/cabal-testsuite/PackageTests/Regression/T6906/cabal.test.hs +++ b/cabal-testsuite/PackageTests/Regression/T6906/cabal.test.hs @@ -1,9 +1,12 @@ import Test.Cabal.Prelude main = cabalTest $ do - res <- recordMode DoNotRecord $ cabalG' ["--config=cabal.config"] "v2-install" ["-v3"] - assertOutputContains "creating file with the inputs used to compute the package hash:" res - assertOutputContains "extra-lib-dirs: bar" res - assertOutputDoesNotContain "extra-lib-dirs: bar bar" res - assertOutputContains "extra-include-dirs: foo" res - assertOutputDoesNotContain "extra-include-dirs: foo foo" res + win <- isWindows + ghcsWithMaxPathIssue <- isGhcVersion "<= 8.6.5" + expectBrokenIf (win && ghcsWithMaxPathIssue) 6271 $ do + res <- recordMode DoNotRecord $ cabalG' ["--config=cabal.config"] "v2-install" ["-v3"] + assertOutputContains "creating file with the inputs used to compute the package hash:" res + assertOutputContains "extra-lib-dirs: bar" res + assertOutputDoesNotContain "extra-lib-dirs: bar bar" res + assertOutputContains "extra-include-dirs: foo" res + assertOutputDoesNotContain "extra-include-dirs: foo foo" res From 596cc597719cff9ff921515d9a257a1fb681ce4a Mon Sep 17 00:00:00 2001 From: jneira Date: Sun, 13 Mar 2022 15:03:01 +0100 Subject: [PATCH 31/47] Correct ghc bounds --- cabal-testsuite/PackageTests/Regression/T6906/cabal.test.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cabal-testsuite/PackageTests/Regression/T6906/cabal.test.hs b/cabal-testsuite/PackageTests/Regression/T6906/cabal.test.hs index 628ab68ba3d..233f4a2a3d1 100644 --- a/cabal-testsuite/PackageTests/Regression/T6906/cabal.test.hs +++ b/cabal-testsuite/PackageTests/Regression/T6906/cabal.test.hs @@ -2,7 +2,7 @@ import Test.Cabal.Prelude main = cabalTest $ do win <- isWindows - ghcsWithMaxPathIssue <- isGhcVersion "<= 8.6.5" + ghcsWithMaxPathIssue <- isGhcVersion "< 8.6.5" expectBrokenIf (win && ghcsWithMaxPathIssue) 6271 $ do res <- recordMode DoNotRecord $ cabalG' ["--config=cabal.config"] "v2-install" ["-v3"] assertOutputContains "creating file with the inputs used to compute the package hash:" res From c38470e8f9bf947795d9290188ea43bf29d32bdc Mon Sep 17 00:00:00 2001 From: jneira Date: Sun, 13 Mar 2022 22:35:50 +0100 Subject: [PATCH 32/47] Ref to #3126 and refactor knownBroken --- .../tests/UnitTests/Distribution/Client/FileMonitor.hs | 9 +++++---- cabal-install/tests/UnitTests/Distribution/Client/VCS.hs | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cabal-install/tests/UnitTests/Distribution/Client/FileMonitor.hs b/cabal-install/tests/UnitTests/Distribution/Client/FileMonitor.hs index 77d321ce964..629265acb8c 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/FileMonitor.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/FileMonitor.hs @@ -62,7 +62,7 @@ tests mtimeChange = , testCase "add non-match" $ testGlobAddNonMatch mtimeChange , testCase "remove non-match" $ testGlobRemoveNonMatch mtimeChange - , knownBrokenIn buildOS "See issue #XXXX" $ + , knownBrokenInWindows "See issue #3126" $ testCase "add non-match subdir" $ testGlobAddNonMatchSubdir mtimeChange , testCase "remove non-match subdir" $ testGlobRemoveNonMatchSubdir mtimeChange @@ -72,7 +72,7 @@ tests mtimeChange = mtimeChange , testCase "match dirs" $ testGlobMatchDir mtimeChange - , knownBrokenIn buildOS "See issue #XXXX" $ + , knownBrokenInWindows "See issue #3126" $ testCase "match dirs only" $ testGlobMatchDirOnly mtimeChange , testCase "change file type" $ testGlobChangeFileType mtimeChange , testCase "absolute paths" $ testGlobAbsolutePath mtimeChange @@ -84,8 +84,9 @@ tests mtimeChange = , testCase "value updated" testValueUpdated ] - where knownBrokenIn Windows msg = expectFailBecause msg - knownBrokenIn _ _ = id + where knownBrokenInWindows msg = case buildOS of + Windows -> expectFailBecause msg + _ -> id -- Check the file system behaves the way we expect it to diff --git a/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs b/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs index 679038afbb9..5b0dbef1ad3 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs @@ -50,7 +50,7 @@ import UnitTests.TempTestDir (withTestDir, removeDirectoryRecursiveHack) -- tests :: MTimeChange -> [TestTree] tests mtimeChange = map (localOption $ QuickCheckTests 10) - [ knownBrokenIn buildOS "See issue #XXXX" $ + [ knownBrokenInWindows "See issue #XXXX" $ testGroup "git" [ testProperty "check VCS test framework" prop_framework_git , testProperty "cloneSourceRepo" prop_cloneRepo_git @@ -81,8 +81,9 @@ tests mtimeChange = map (localOption $ QuickCheckTests 10) ] - where knownBrokenIn Windows msg = expectFailBecause msg - knownBrokenIn _ _ = id + where knownBrokenInWindows msg = case buildOS of + Windows -> expectFailBecause msg + _ -> id prop_framework_git :: BranchingRepoRecipe 'SubmodulesSupported -> Property prop_framework_git = From 23ccc1385da068aa1ae67207dbb8cfb36c3a746d Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 14 Mar 2022 08:40:55 +0100 Subject: [PATCH 33/47] Use 8.10.7 for exhaustive tests --- .github/workflows/validate.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index a20c0d6e8e0..822583ac979 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -25,8 +25,8 @@ env: # which will be used to do the next release GHC_FOR_RELEASE: '8.10.7' # Ideally the three ghcs should be the used for the release - GHC_FOR_SOLVER_BENCHMARKS: '8.8.4' - GHC_FOR_COMPLETE_HACKAGE_TESTS: '8.6.5' + GHC_FOR_SOLVER_BENCHMARKS: '8.10.7' + GHC_FOR_COMPLETE_HACKAGE_TESTS: '8.10.7' jobs: validate: From 8460b5f78f8d52e289fd4a6cec6f8c8f2425e5d9 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 14 Mar 2022 11:51:35 +0100 Subject: [PATCH 34/47] Use ghc for release in dogfooding Using validate job outputs cause it seems you can't use the env context directly in matrix --- .github/workflows/validate.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 822583ac979..a1c53e3aeda 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -32,6 +32,8 @@ jobs: validate: name: Validate ${{ matrix.os }} ghc-${{ matrix.ghc }} runs-on: ${{ matrix.os }} + outputs: + GHC_FOR_RELEASE: ${{ format('["{0}"]', env.GHC_FOR_RELEASE) }} strategy: matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] @@ -98,7 +100,6 @@ jobs: brew install automake - name: Set validate inputs - id: validate-inputs run: | FLAGS="" if [[ "${{ matrix.cli }}" == "false" ]]; then @@ -242,7 +243,9 @@ jobs: matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] # We only use one ghc version the used one for the next release (defined at top of the workflow) - ghc: ["8.10.7"] + # We need to build an array dynamically to inject the appropiate env var in a previous job, + # see https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson + ghc: ${{ fromJSON (needs.validate.outputs.GHC_FOR_RELEASE) }} steps: - uses: actions/checkout@v2 From 5b9e871b7fa7c849a57e9da651e3e6f480763d28 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 14 Mar 2022 20:34:01 +0100 Subject: [PATCH 35/47] Correct builddir --- .github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index a1c53e3aeda..ef15f22c545 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -126,7 +126,7 @@ jobs: - name: Tar cabal head executable if: matrix.cli != 'false' && matrix.ghc == env.GHC_FOR_RELEASE run: | - CABAL_EXEC=$(cabal-plan list-bin --builddir=dist-val-ghc-${{ matrix.ghc }} cabal-install:exe:cabal) + CABAL_EXEC=$(cabal-plan list-bin --builddir=dist-newstyle-validate-ghc-${{ matrix.ghc }} cabal-install:exe:cabal) # We have to tar the executable to preserve executable permissions # see https://github.com/actions/upload-artifact/issues/38 if [[ ${{ runner.os }} == 'Windows' ]]; then From 95e85df1b2e9bb10f839bcc7f7eb58bcc96faaaf Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 14 Mar 2022 20:35:08 +0100 Subject: [PATCH 36/47] Remove ghc-9.0.1 from matrix --- .github/workflows/validate.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index ef15f22c545..fa70d21d031 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -37,22 +37,12 @@ jobs: strategy: matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] - ghc: ["9.2.1", "9.0.2", "9.0.1", "8.10.7", "8.8.4", "8.6.5", "8.4.4", "8.0.2"] + ghc: ["9.2.1", "9.0.2", "8.10.7", "8.8.4", "8.6.5", "8.4.4", "8.0.2"] exclude: # lot of segfaults caused by ghc bugs - os: "windows-latest" ghc: "8.8.4" include: - # We only run the cli test suite for the last minor version - - os: "macos-latest" - ghc: "9.0.1" - cli: "false" - - os: "ubuntu-latest" - ghc: "9.0.1" - cli: "false" - - os: "windows-latest" - ghc: "9.0.1" - cli: "false" - os: "ubuntu-latest" ghc: "8.0.2" cli: "false" From 0d1b29529278f37daa2ae2af1ba5cdbafb4f4dba Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 14 Mar 2022 21:12:58 +0100 Subject: [PATCH 37/47] Fix typo in test folder name --- .../CmdRun/{ScriptNoExtention => ScriptNoExtension}/cabal.out | 0 .../CmdRun/{ScriptNoExtention => ScriptNoExtension}/cabal.test.hs | 0 .../CmdRun/{ScriptNoExtention => ScriptNoExtension}/with sp | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename cabal-testsuite/PackageTests/NewBuild/CmdRun/{ScriptNoExtention => ScriptNoExtension}/cabal.out (100%) rename cabal-testsuite/PackageTests/NewBuild/CmdRun/{ScriptNoExtention => ScriptNoExtension}/cabal.test.hs (100%) rename cabal-testsuite/PackageTests/NewBuild/CmdRun/{ScriptNoExtention => ScriptNoExtension}/with sp (100%) diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptNoExtention/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptNoExtension/cabal.out similarity index 100% rename from cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptNoExtention/cabal.out rename to cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptNoExtension/cabal.out diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptNoExtention/cabal.test.hs b/cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptNoExtension/cabal.test.hs similarity index 100% rename from cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptNoExtention/cabal.test.hs rename to cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptNoExtension/cabal.test.hs diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptNoExtention/with sp b/cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptNoExtension/with sp similarity index 100% rename from cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptNoExtention/with sp rename to cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptNoExtension/with sp From 64837b74f65dfb270f05b4c60f3f9f277d9c79c8 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 14 Mar 2022 23:16:06 +0100 Subject: [PATCH 38/47] Pass raw ghc to cli suite exec --- .github/workflows/validate.yml | 2 +- validate.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index fa70d21d031..d194d44f506 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -151,7 +151,7 @@ jobs: - name: Validate cli-suite if: matrix.cli != 'false' - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s cli-suite + run: sh validate.sh -j 2 -w ghc -v $FLAGS -s cli-suite validate-old-ghcs: name: Validate old ghcs ${{ matrix.extra-ghc }} diff --git a/validate.sh b/validate.sh index fede7289dab..ec94aaaeb21 100755 --- a/validate.sh +++ b/validate.sh @@ -457,7 +457,7 @@ CMD="$($CABALPLANLISTBIN cabal-install:test:integration-tests2) -j1 --hide-succe 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" +CMD="$($CABALPLANLISTBIN cabal-testsuite:exe:cabal-tests) --builddir=$CABAL_TESTSUITE_BDIR --with-cabal=$($CABALPLANLISTBIN cabal-install:exe:cabal) $TESTSUITEJOBS --with-ghc=$HC --hide-successes" (cd cabal-testsuite && timed $CMD) || exit 1 } From 22e33d7731a95454c155fa35ca3b7fe92da5f302 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 15 Mar 2022 08:25:08 +0100 Subject: [PATCH 39/47] Add comment about -w ghc workaround Linking https://github.com/haskell/cabal/issues/6271#issuecomment-1065102255 --- .github/workflows/validate.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index d194d44f506..57d2cbf87dc 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -151,6 +151,9 @@ jobs: - name: Validate cli-suite if: matrix.cli != 'false' + # We have to use `-w ghc` intead `-w ghc-${{ matrix.ghc }}` here to + # workaround the max path limit in windows for ghc <= 8.6.5 + # See https://github.com/haskell/cabal/issues/6271#issuecomment-1065102255 run: sh validate.sh -j 2 -w ghc -v $FLAGS -s cli-suite validate-old-ghcs: From 52e52c162b24bf5406b62912ba28451c20a0ff05 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 15 Mar 2022 11:08:05 +0100 Subject: [PATCH 40/47] Refer to #8048 in the known broken test --- cabal-install/tests/UnitTests/Distribution/Client/VCS.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs b/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs index 5b0dbef1ad3..3421355d8ef 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs @@ -50,7 +50,7 @@ import UnitTests.TempTestDir (withTestDir, removeDirectoryRecursiveHack) -- tests :: MTimeChange -> [TestTree] tests mtimeChange = map (localOption $ QuickCheckTests 10) - [ knownBrokenInWindows "See issue #XXXX" $ + [ knownBrokenInWindows "See issue #8048" $ testGroup "git" [ testProperty "check VCS test framework" prop_framework_git , testProperty "cloneSourceRepo" prop_cloneRepo_git From af35bcaf9cb2c0a24f7784051ae9a67ad66c7d79 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 15 Mar 2022 11:08:27 +0100 Subject: [PATCH 41/47] Formatting --- .github/workflows/validate.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 57d2cbf87dc..cf79465274d 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -110,8 +110,7 @@ jobs: run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s print-tool-versions - name: Validate build - run: | - sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s build + run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s build - name: Tar cabal head executable if: matrix.cli != 'false' && matrix.ghc == env.GHC_FOR_RELEASE From 4f4d47eda37293b1d1af69b3640b9862f74895c6 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 15 Mar 2022 21:14:41 +0100 Subject: [PATCH 42/47] Use PATH ghc as default --- validate.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/validate.sh b/validate.sh index ec94aaaeb21..8040dea5ee9 100755 --- a/validate.sh +++ b/validate.sh @@ -4,7 +4,13 @@ # default config ####################################################################### -HC=ghc-8.2.2 +# We use the default ghc in PATH as default +# Use the ghc-x.y.z trigger several errors in windows: +# * It triggers the max path length issue: +# See https://github.com/haskell/cabal/issues/6271#issuecomment-1065102255 +# * It triggers a `createProcess: does not exist` error in units tests +# See https://github.com/haskell/cabal/issues/8049 +HC=ghc CABAL=cabal CABALPLAN=cabal-plan JOBS=4 From dc1683ba05f817d94f567ca1eea139b202a22fb0 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 15 Mar 2022 21:15:48 +0100 Subject: [PATCH 43/47] Dont use ghc-x.y.z and reorganize flags --- .github/workflows/validate.yml | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index cf79465274d..681578661bb 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -27,6 +27,7 @@ env: # Ideally the three ghcs should be the used for the release GHC_FOR_SOLVER_BENCHMARKS: '8.10.7' GHC_FOR_COMPLETE_HACKAGE_TESTS: '8.10.7' + COMMON_FLAGS: '-j 2 -v' jobs: validate: @@ -91,7 +92,7 @@ jobs: - name: Set validate inputs run: | - FLAGS="" + FLAGS="${{ env.COMMON_FLAGS }}" if [[ "${{ matrix.cli }}" == "false" ]]; then FLAGS="$FLAGS --lib-only" fi @@ -104,13 +105,13 @@ jobs: echo "FLAGS=$FLAGS" >> $GITHUB_ENV - name: Validate print-config - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s print-config + run: sh validate.sh $FLAGS -s print-config - name: Validate print-tool-versions - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s print-tool-versions + run: sh validate.sh $FLAGS -s print-tool-versions - name: Validate build - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s build + run: sh validate.sh $FLAGS -s build - name: Tar cabal head executable if: matrix.cli != 'false' && matrix.ghc == env.GHC_FOR_RELEASE @@ -139,21 +140,18 @@ jobs: # `rawSystemStdInOut reports text decoding errors` # test does not find ghc without the full path in windows GHCPATH: ${{ steps.setup-haskell.outputs.ghc-exe }} - run: sh validate.sh -j 2 -w $GHCPATH -v $FLAGS -s lib-tests + run: sh validate.sh $FLAGS -s lib-tests - name: Validate lib-suite - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s lib-suite + run: sh validate.sh $FLAGS -s lib-suite - name: Validate cli-tests if: matrix.cli != 'false' - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v $FLAGS -s cli-tests + run: sh validate.sh $FLAGS -s cli-tests - name: Validate cli-suite if: matrix.cli != 'false' - # We have to use `-w ghc` intead `-w ghc-${{ matrix.ghc }}` here to - # workaround the max path limit in windows for ghc <= 8.6.5 - # See https://github.com/haskell/cabal/issues/6271#issuecomment-1065102255 - run: sh validate.sh -j 2 -w ghc -v $FLAGS -s cli-suite + run: sh validate.sh $FLAGS -s cli-suite validate-old-ghcs: name: Validate old ghcs ${{ matrix.extra-ghc }} @@ -216,13 +214,12 @@ jobs: echo "$HOME/.cabal/bin" >> $GITHUB_PATH - name: Validate build - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ matrix.flags }} -s build + run: sh validate.sh ${{ env.COMMON_FLAGS }} -s build - name: "Validate lib-suite-extras --extra-hc ghc-${{ matrix.extra-ghc }}" env: - FLAGS: "--lib-only -s lib-suite-extras" EXTRA_GHC: "/opt/ghc/${{ matrix.extra-ghc }}/bin/ghc-${{ matrix.extra-ghc }}" - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} -v ${{ env.FLAGS }} --extra-hc ${{ env.EXTRA_GHC }} + run: sh validate.sh ${{ env.COMMON_FLAGS }} --lib-only -s lib-suite-extras --extra-hc ${{ env.EXTRA_GHC }} # The previous jobs use a released version of cabal to build cabal HEAD itself # This one uses the cabal HEAD generated executable in the previous step @@ -258,12 +255,12 @@ jobs: run: tar -xf ./cabal-head/cabal-head.tar -C ./cabal-head - name: print-config using cabal HEAD - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} --with-cabal ./cabal-head/cabal -v -s print-config + run: sh validate.sh ${{ env.COMMON_FLAGS }} --with-cabal ./cabal-head/cabal -s print-config # We dont use cache to force a build with a fresh store dir and build dir # This way we check cabal can build all its dependencies - name: Build using cabal HEAD - run: sh validate.sh -j 2 -w ghc-${{ matrix.ghc }} --with-cabal ./cabal-head/cabal -v -s build + run: sh validate.sh ${{ env.COMMON_FLAGS }} --with-cabal ./cabal-head/cabal -s build # We use this job as a resume of the workflow # It will fail if any of the previous jobs does it From 4ff4d3c440fae2ccd96bdd74ddb009edd0ace70d Mon Sep 17 00:00:00 2001 From: Javier Neira Date: Wed, 16 Mar 2022 21:31:31 +0100 Subject: [PATCH 44/47] Rephrasing/corrections --- .github/workflows/validate.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 681578661bb..07cbb67609e 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -24,7 +24,7 @@ env: # We choose a stable ghc version across all os's # which will be used to do the next release GHC_FOR_RELEASE: '8.10.7' - # Ideally the three ghcs should be the used for the release + # Ideally we should use the version about to be released for hackage tests and benchmarks GHC_FOR_SOLVER_BENCHMARKS: '8.10.7' GHC_FOR_COMPLETE_HACKAGE_TESTS: '8.10.7' COMMON_FLAGS: '-j 2 -v' @@ -262,7 +262,7 @@ jobs: - name: Build using cabal HEAD run: sh validate.sh ${{ env.COMMON_FLAGS }} --with-cabal ./cabal-head/cabal -s build - # We use this job as a resume of the workflow + # We use this job as a summary of the workflow # It will fail if any of the previous jobs does it # This way we can use it exclusively in branch protection rules # and abstract away the concrete jobs of the workflow, including their names From 125ee6fb60f3bdef0c9d63db7ad9c049caecf884 Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 16 Mar 2022 22:14:51 +0100 Subject: [PATCH 45/47] Ignore vcs tests to speed up them --- cabal-install/tests/UnitTests/Distribution/Client/VCS.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs b/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs index 3421355d8ef..160076e94a6 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs @@ -50,7 +50,7 @@ import UnitTests.TempTestDir (withTestDir, removeDirectoryRecursiveHack) -- tests :: MTimeChange -> [TestTree] tests mtimeChange = map (localOption $ QuickCheckTests 10) - [ knownBrokenInWindows "See issue #8048" $ + [ ignoreInWindows "See issue #8048" $ testGroup "git" [ testProperty "check VCS test framework" prop_framework_git , testProperty "cloneSourceRepo" prop_cloneRepo_git @@ -81,8 +81,8 @@ tests mtimeChange = map (localOption $ QuickCheckTests 10) ] - where knownBrokenInWindows msg = case buildOS of - Windows -> expectFailBecause msg + where ignoreInWindows msg = case buildOS of + Windows -> ignoreTestBecause msg _ -> id prop_framework_git :: BranchingRepoRecipe 'SubmodulesSupported -> Property From f710e507fab8c0ced07bcef725198b711a8d4a56 Mon Sep 17 00:00:00 2001 From: jneira Date: Thu, 17 Mar 2022 13:46:21 +0100 Subject: [PATCH 46/47] Reduce #ifdef to OpenHandle --- cabal-testsuite/src/Test/Cabal/Server.hs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cabal-testsuite/src/Test/Cabal/Server.hs b/cabal-testsuite/src/Test/Cabal/Server.hs index 8a2fbb981dd..450c6f660c7 100644 --- a/cabal-testsuite/src/Test/Cabal/Server.hs +++ b/cabal-testsuite/src/Test/Cabal/Server.hs @@ -250,19 +250,17 @@ startServer chan senv = do initServer :: Server -> IO Server initServer s0 = do -- NB: withProcessHandle reads an MVar and is interruptible -#if mingw32_HOST_OS + pid <- withProcessHandle (serverProcessHandle s0) $ \ph -> case ph of +#if mingw32_HOST_OS OpenHandle x -> fmap show (Win32.getProcessId x) - -- TODO: handle OpenExtHandle? - _ -> return (serverProcessId s0) #else - pid <- withProcessHandle (serverProcessHandle s0) $ \ph -> - case ph of OpenHandle x -> return (show x) +#endif -- TODO: handle OpenExtHandle? _ -> return (serverProcessId s0) -#endif + let s = s0 { serverProcessId = pid } -- We will read/write a line at a time, including for -- output; our demarcation tokens are an entire line. From cefb538cca24cf7c0e791991e14a97dea81fdcf5 Mon Sep 17 00:00:00 2001 From: jneira Date: Fri, 18 Mar 2022 12:24:18 +0100 Subject: [PATCH 47/47] Workaround bsdtar corrupting binary As suggested here: https://github.com/actions/virtual-environments/issues/2619#issuecomment-788397841 --- .github/workflows/validate.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 07cbb67609e..afae1827682 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -120,8 +120,15 @@ jobs: # We have to tar the executable to preserve executable permissions # see https://github.com/actions/upload-artifact/issues/38 if [[ ${{ runner.os }} == 'Windows' ]]; then + # `cabal-plan` gives us a windows path but tar needs the posix one CABAL_EXEC=$(cygpath $CABAL_EXEC) fi + if [[ "${{ runner.os }}" == "macOS" ]]; then + # Workaround to avoid bsdtar corrupts the executable + # so executing it after untar throws `cannot execute binary file` + # see https://github.com/actions/virtual-environments/issues/2619#issuecomment-788397841 + sudo /usr/sbin/purge + fi tar -cvf cabal-head.tar -C $(dirname "$CABAL_EXEC") $(basename "$CABAL_EXEC") echo "CABAL_EXEC_TAR=cabal-head.tar" >> $GITHUB_ENV