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
Changes from 1 commit
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
Prev Previous commit
CI: add validation against GHC pre-release (currently: 9.6alpha3)
Had to block lib/cli-suite tests on Windows, see discussion starting here:

- #8754 (comment)
ulysses4ever authored and mergify[bot] committed Feb 23, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 9e9a8658b245aa4baf8983bbeab656a6e4692213
128 changes: 128 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -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