Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: add GHC pre-release #8754

Merged
merged 3 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/changelogs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
run: |
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
- uses: actions/cache@v1
- uses: actions/cache@v3
with:
path: ~/.cabal/store
key: linux-store-changelogs
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/quick-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
run: |
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
- uses: actions/cache@v1
- uses: actions/cache@v3
with:
path: ~/.cabal/store
key: linux-store-meta
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
- name: Set PATH
run: |
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
- uses: actions/cache@v1
- uses: actions/cache@v3
with:
path: ~/.cabal/store
key: linux-store-doctest
Expand Down
132 changes: 130 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
#
# See https://github.com/haskell/cabal/pull/8739 for why Windows is excluded
- if: ${{ runner.os != 'Windows' }}
uses: actions/cache@v2
uses: actions/cache@v3
with:
# validate.sh uses a special build dir
path: |
Expand Down Expand Up @@ -187,6 +187,134 @@ jobs:
if: matrix.cli != 'false'
run: sh validate.sh $FLAGS -s cli-suite

# The job below is a copy-paste of validate with the necessary tweaks
# to make all work with an upcoming GHC. Those tweaks include:
# - ghcup needs the prerelease channel activated
# - allow-newer for base libraries and Cabal* libraries
# - (sometimes) disabling some parts on Windows because it's hard to figure
# out why they fail
validate-prerelease:
name: Validate ${{ matrix.os }} ghc-prerelease
runs-on: ${{ matrix.os }}
outputs:
GHC_FOR_RELEASE: ${{ format('["{0}"]', env.GHC_FOR_RELEASE) }}
strategy:
matrix:
os: ["ubuntu-20.04", "macos-latest", "windows-latest"]

steps:

- uses: actions/checkout@v3

# See https://github.com/haskell/cabal/pull/8739
- name: Sudo chmod to permit ghcup to update its cache
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
sudo ls -lah /usr/local/.ghcup/cache
sudo mkdir -p /usr/local/.ghcup/cache
sudo ls -lah /usr/local/.ghcup/cache
sudo chown -R $USER /usr/local/.ghcup
sudo chmod -R 777 /usr/local/.ghcup
fi
- name: ghcup
run: |
ghcup --version
ghcup config set cache true
ghcup config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml
ghcup install ghc --set 9.6.0.20230210
ghcup install cabal --set latest
ghc --version
cabal update
# See the following link for a breakdown of the following step
# https://github.com/haskell/actions/issues/7#issuecomment-745697160
#
# See https://github.com/haskell/cabal/pull/8739 for why Windows is excluded
- if: ${{ runner.os != 'Windows' }}
uses: actions/cache@v3
with:
# validate.sh uses a special build dir
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-*
key: ${{ runner.os }}-${{ matrix.ghc }}-20220419-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-20220419-

- name: Work around git problem https://bugs.launchpad.net/ubuntu/+source/git/+bug/1993586 (cabal PR #8546)
run: |
git config --global protocol.file.allow always
# 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' --allow-newer
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
# The tool is not essential to the rest of the test suite. If
# hackage-repo-tool is not present, any test that requires it will
# be skipped.
# We want to keep this in the loop but we don't want to fail if
# hackage-repo-tool breaks or fails to support a newer GHC version.
- name: Install hackage-repo-tool
continue-on-error: true
run: |
cd $(mktemp -d)
cabal install hackage-repo-tool
# Needed by cabal-testsuite/PackageTests/Configure/setup.test.hs
- name: Install Autotools
if: runner.os == 'macOS'
run: |
brew install automake
- name: Allow newer boot libraries
run: |
echo "allow-newer: base, template-haskell, ghc-prim, Cabal-syntax, Cabal-described, Cabal, cabal-install-solver, cabal-install" >> cabal.project.validate
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think each of these should come with a installed constraint:

constraints: base installed
constraints: template-haskell installed
...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the Cabal* libraries? They're certainly not installed? I must confess, i don't really understand the installed constraint. It makes me think of cabal v1-install which is certainly not the same, but I otherwise fail to see where it is installed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it more: I really don't see why you'd want to maintain an additional list (a list of constraints on top of the list in allow-newer)...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the GHC-shipped packets are installed. I guessed you want to pin to the GHC-installed versions in general. But you are right, not for the Cabal packages.

The reason for pinning the GHC-shipped packages is that you want to e.g. make sure that unix-2.8.0.0 is picked and not some older version. But I guess that base, ghc-prim and template-haskell are pinned anyway. And you did not include allow-newer for the other GHC-shipped packages.

So I retract my suggestion.

You could consider to pin all the other GHC-shipped packages, though, and add allow-newer for them, if you truly want to test against the coming GHC-shipped libraries.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right, thank you for the clarification. Let's leave it for future work: most likely, this code will need updates every prerelease...

- name: Set validate inputs
run: |
FLAGS="${{ env.COMMON_FLAGS }}"
if [[ "${{ matrix.cli }}" == "false" ]]; then
FLAGS="$FLAGS --lib-only"
fi
echo "FLAGS=$FLAGS" >> $GITHUB_ENV
- name: Validate print-config
run: sh validate.sh $FLAGS -s print-config

- name: Validate print-tool-versions
run: sh validate.sh $FLAGS -s print-tool-versions

- name: Validate build
run: sh validate.sh $FLAGS -s build

- name: Validate 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 $FLAGS -s lib-tests

- name: Validate lib-suite
# see https://github.com/haskell/cabal/pull/8754#issuecomment-1435025848
# for discussion about the trouble on Windows
if: ${{ runner.os != 'Windows' }}
run: sh validate.sh $FLAGS -s lib-suite

- name: Validate cli-tests
if: matrix.cli != 'false'
run: sh validate.sh $FLAGS -s cli-tests

- name: Validate cli-suite
# see https://github.com/haskell/cabal/pull/8754#issuecomment-1435025848
# for discussion about the trouble on Windows
if: ( runner.os != 'Windows' ) && ( matrix.cli != 'false' )
run: sh validate.sh $FLAGS -s cli-suite

validate-old-ghcs:
name: Validate old ghcs ${{ matrix.extra-ghc }}
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -234,7 +362,7 @@ jobs:
# 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
- uses: actions/cache@v3
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
Expand Down
1 change: 0 additions & 1 deletion Cabal-syntax/src/Distribution/Utils/Structured.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE TypeInType #-}
-- |
--
-- Copyright: (c) 2019 Oleg Grenrus
Expand Down
4 changes: 4 additions & 0 deletions cabal-install/src/Distribution/Client/VCS.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE NamedFieldPuns, RecordWildCards, RankNTypes #-}
Expand Down Expand Up @@ -53,8 +54,11 @@ import Distribution.Version
( mkVersion )
import qualified Distribution.PackageDescription as PD

#if !MIN_VERSION_base(4,18,0)
import Control.Applicative
( liftA2 )
#endif

import Control.Exception
( throw, try )
import Control.Monad.Trans
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Test.Cabal.Prelude
main = setupAndCabalTest $ do
skipUnlessGhcVersion ">= 8.1"
ghc <- isGhcVersion "== 9.0.2 || == 9.2.* || == 9.4.*"
ghc <- isGhcVersion "== 9.0.2 || == 9.2.* || == 9.4.* || == 9.6.*"
expectBrokenIf ghc 7987 $ do
withPackageDb $ do
withDirectory "mylib" $ setup_install_with_docs ["--ipid", "mylib-0.1.0.0"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Test.Cabal.Prelude
main = setupTest $ do
-- No cabal test because per-component is broken with it
skipUnlessGhcVersion ">= 8.1"
ghc <- isGhcVersion "== 9.0.2 || == 9.2.* || == 9.4.*"
ghc <- isGhcVersion "== 9.0.2 || == 9.2.* || == 9.4.* || == 9.6.*"
expectBrokenIf ghc 7987 $
withPackageDb $ do
let setup_install' args = setup_install_with_docs (["--cabal-file", "Includes2.cabal"] ++ args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Data.List
import qualified Data.Char as Char
main = setupAndCabalTest $ do
skipUnlessGhcVersion ">= 8.1"
ghc <- isGhcVersion "== 9.0.2 || == 9.2.* || == 9.4.*"
ghc <- isGhcVersion "== 9.0.2 || == 9.2.* || == 9.4.* || == 9.6.*"
expectBrokenIf ghc 7987 $
withPackageDb $ do
containers_id <- getIPID "containers"
Expand Down
1 change: 1 addition & 0 deletions cabal-testsuite/PackageTests/JS/JsSources/js-arch.test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Test.Cabal.Prelude
main = setupAndCabalTest $ do
skipUnlessGhcVersion ">= 9.6"
skipUnlessJavaScript
skipIfWindows

res <- cabal' "v2-run" ["demo"]
assertOutputContains "Hello JS!" res