Skip to content

Cabal 3.10 and GHC 9.6 #1186

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

Merged
merged 2 commits into from
Apr 7, 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
222 changes: 222 additions & 0 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
# This GitHub workflow config has been generated by a script via
#
# haskell-ci 'github' 'hackage-server.cabal'
#
# To regenerate the script (for example after adjusting tested-with) run
#
# haskell-ci regenerate
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.15.20230321
#
# REGENDATA ("0.15.20230321",["github","hackage-server.cabal"])
#
name: Haskell-CI
on:
push:
branches:
- master
- ci*
pull_request:
branches:
- master
- ci*
jobs:
linux:
name: Haskell-CI - Linux - ${{ matrix.compiler }}
runs-on: ubuntu-20.04
timeout-minutes:
60
container:
image: buildpack-deps:jammy
continue-on-error: ${{ matrix.allow-failure }}
strategy:
matrix:
include:
- compiler: ghc-9.6.1
compilerKind: ghc
compilerVersion: 9.6.1
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.4.4
compilerKind: ghc
compilerVersion: 9.4.4
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.2.7
compilerKind: ghc
compilerVersion: 9.2.7
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.0.2
compilerKind: ghc
compilerVersion: 9.0.2
setup-method: ghcup
allow-failure: false
- compiler: ghc-8.10.7
compilerKind: ghc
compilerVersion: 8.10.7
setup-method: ghcup
allow-failure: false
- compiler: ghc-8.8.4
compilerKind: ghc
compilerVersion: 8.8.4
setup-method: ghcup
allow-failure: false
fail-fast: false
steps:
- name: apt
run: |
apt-get update
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
apt-get update
apt-get install -y libbrotli-dev libgd-dev
env:
HCKIND: ${{ matrix.compilerKind }}
HCNAME: ${{ matrix.compiler }}
HCVER: ${{ matrix.compilerVersion }}
- name: Set PATH and environment variables
run: |
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
HCDIR=/opt/$HCKIND/$HCVER
HC=$HOME/.ghcup/bin/$HCKIND-$HCVER
echo "HC=$HC" >> "$GITHUB_ENV"
echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
echo "GHCJSARITH=0" >> "$GITHUB_ENV"
env:
HCKIND: ${{ matrix.compilerKind }}
HCNAME: ${{ matrix.compiler }}
HCVER: ${{ matrix.compilerVersion }}
- name: env
run: |
env
- name: write cabal config
run: |
mkdir -p $CABAL_DIR
cat >> $CABAL_CONFIG <<EOF
remote-build-reporting: anonymous
write-ghc-environment-files: never
remote-repo-cache: $CABAL_DIR/packages
logs-dir: $CABAL_DIR/logs
world-file: $CABAL_DIR/world
extra-prog-path: $CABAL_DIR/bin
symlink-bindir: $CABAL_DIR/bin
installdir: $CABAL_DIR/bin
build-summary: $CABAL_DIR/logs/build.log
store-dir: $CABAL_DIR/store
install-dirs user
prefix: $CABAL_DIR
repository hackage.haskell.org
url: http://hackage.haskell.org/
EOF
cat >> $CABAL_CONFIG <<EOF
program-default-options
ghc-options: $GHCJOBS +RTS -M3G -RTS
EOF
cat $CABAL_CONFIG
- name: versions
run: |
$HC --version || true
$HC --print-project-git-commit-id || true
$CABAL --version || true
- name: update cabal index
run: |
$CABAL v2-update -v
- name: install cabal-plan
run: |
mkdir -p $HOME/.cabal/bin
curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > cabal-plan.xz
echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c -
xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan
rm -f cabal-plan.xz
chmod a+x $HOME/.cabal/bin/cabal-plan
cabal-plan --version
- name: checkout
uses: actions/checkout@v3
with:
path: source
- name: initial cabal.project for sdist
run: |
touch cabal.project
echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project
cat cabal.project
- name: sdist
run: |
mkdir -p sdist
$CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist
- name: unpack
run: |
mkdir -p unpacked
find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \;
- name: generate cabal.project
run: |
PKGDIR_hackage_server="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/hackage-server-[0-9.]*')"
echo "PKGDIR_hackage_server=${PKGDIR_hackage_server}" >> "$GITHUB_ENV"
rm -f cabal.project cabal.project.local
touch cabal.project
touch cabal.project.local
echo "packages: ${PKGDIR_hackage_server}" >> cabal.project
echo "package hackage-server" >> cabal.project
echo " ghc-options: -Werror=missing-methods" >> cabal.project
cat >> cabal.project <<EOF
EOF
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(Cabal|Cabal-syntax|hackage-server|parsec|process|text)$/; }' >> cabal.project.local
cat cabal.project
cat cabal.project.local
- name: dump install plan
run: |
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
cabal-plan
- name: restore cache
uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
path: ~/.cabal/store
restore-keys: ${{ runner.os }}-${{ matrix.compiler }}-
- name: install dependencies
run: |
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all
- name: build w/o tests
run: |
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
- name: build
run: |
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always
- name: tests
run: |
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct
- name: cabal check
run: |
cd ${PKGDIR_hackage_server} || false
${CABAL} -vnormal check
- name: haddock
run: |
$CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
- name: unconstrained build
run: |
rm -f cabal.project.local
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
- name: save cache
uses: actions/cache/save@v3
if: always()
with:
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
path: ~/.cabal/store
3 changes: 2 additions & 1 deletion cabal.haskell-ci
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
branches: master ci*

installed: +all -Cabal -text -parsec -process
installed: +all -Cabal -Cabal-syntax -text -parsec -process

-- Does not work with GHA:
-- -- allow failures with ghc-7.6 and ghc-7.8
Expand All @@ -10,6 +10,7 @@ installed: +all -Cabal -text -parsec -process
distribution: jammy

apt: libbrotli-dev libgd-dev
-- libgd-dev is for gd via hs-captcha

-- Make sure the haddock step is included,
-- even though we don't define any library.
Expand Down
11 changes: 0 additions & 11 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,6 @@ packages: .

allow-newer: rss:time, rss:base

-- Andreas, 2022-10-28: `Cabal-3.8.1.0` wants `process >= 1.6.14`
-- which is too new for the `ghc < 9.4` package that is pulled in
-- by `doctest-parallel`.
-- Since, Cabal-3.8.1.0 has no reason to want such a new version
-- of process, we can solve the conflict here by allowing
-- `Cabal` to use the shipped version of `process`.
-- This workaround can be removed once `Cabal-3.8` drops
-- its (unreasonable) constraint on `process`.
-- See: https://github.com/haskell/cabal/issues/8554
allow-older: Cabal:process

-----------------------------------------------------------------------------
-- Anti-constraints

Expand Down
21 changes: 15 additions & 6 deletions hackage-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ copyright: 2008-2015 Duncan Coutts,
license: BSD-3-Clause
license-file: LICENSE

tested-with: GHC == { 9.4.4, 9.2.6, 9.0.2, 8.10.7, 8.8.4 }
tested-with: GHC == { 9.6.1, 9.4.4, 9.2.7, 9.0.2, 8.10.7, 8.8.4 }

data-dir: datafiles
data-files:
Expand Down Expand Up @@ -91,8 +91,14 @@ flag test-create-user

flag cabal-parsers
description: Enable experimental @cabal-parsers@ checks
manual: True
default: False
manual: True

-- Automatic flag to turn off the DocTests suite if its dependencies are not available.
flag doctests
description: Build DocTests test-suite
-- default: True
-- manual: False

----------------------------------------------------------------------------

Expand All @@ -105,7 +111,7 @@ common defaults
-- see `cabal.project.local-ghc-${VERSION}` files
build-depends:
, array >= 0.5 && < 0.6
, base >= 4.13 && < 4.18
, base >= 4.13 && < 4.19
, binary >= 0.8 && < 0.9
, bytestring >= 0.10 && < 0.12
, containers ^>= 0.6.0
Expand All @@ -119,13 +125,13 @@ common defaults
, text ^>= 1.2.5.0 || ^>= 2.0
, time >= 1.9 && < 1.13
, transformers >= 0.5 && < 0.7
, unix >= 2.7 && < 2.8
, unix >= 2.7 && < 2.9
, scientific
-- other dependencies shared by most components
build-depends:
, aeson ^>= 2.0.3.0 || ^>= 2.1.0.0
, Cabal ^>= 3.8.1.0
, Cabal-syntax ^>= 3.8.1.0
, Cabal ^>= 3.10.1.0
, Cabal-syntax ^>= 3.10.1.0
-- Cabal-syntax needs to be bound to constrain hackage-security
-- see https://github.com/haskell/hackage-server/issues/1130
, fail ^>= 4.9.0
Expand Down Expand Up @@ -649,3 +655,6 @@ test-suite DocTests
, lib-server
, doctest-parallel ^>= 0.3.0
-- doctest-parallel-0.2.2 is the first to filter out autogen-modules

if !flag(doctests)
buildable: False
14 changes: 11 additions & 3 deletions src/Distribution/Server/Framework/BlobStorage.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{-# LANGUAGE DeriveDataTypeable, GeneralizedNewtypeDeriving,
ScopedTypeVariables, TypeFamilies, CPP,
RecordWildCards #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}

-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Server.BlobStorage
Expand Down Expand Up @@ -199,7 +203,11 @@ withIncoming' store file blobId action = do
if commit
then do
#ifndef mingw32_HOST_OS
#if !MIN_VERSION_unix(2,8,0)
fd <- openFd (directory store blobId) ReadOnly Nothing defaultFileFlags
#else
fd <- openFd (directory store blobId) ReadOnly defaultFileFlags
#endif
#endif
-- TODO: if the target already exists then there is no need to overwrite
-- it since it will have the same content. Checking and then renaming
Expand Down
20 changes: 15 additions & 5 deletions src/Distribution/Server/Packages/Unpack.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
-- Unpack a tarball containing a Cabal package
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}

-- | Unpack a tarball containing a Cabal package

module Distribution.Server.Packages.Unpack (
CombinedTarErrs(..),
checkEntries,
Expand Down Expand Up @@ -32,7 +35,11 @@ import Distribution.PackageDescription.Configuration
( flattenPackageDescription )
import Distribution.PackageDescription.Check
( PackageCheck(..), checkPackage, CheckPackageContentOps(..)
, checkPackageContent )
, checkPackageContent
#if MIN_VERSION_Cabal(3,9,0)
, ppPackageCheck
#endif
)
import Distribution.Parsec
( showPError, showPWarning )
import Distribution.Text
Expand Down Expand Up @@ -293,8 +300,11 @@ extraChecks genPkgDesc pkgId tarIndex = do
isDistError (PackageDistSuspiciousWarn {}) = False -- just a warning
isDistError _ = True
(errors, warnings) = partition isDistError checks
mapM_ (throwError . explanation) errors
mapM_ (warn . explanation) warnings
#if !MIN_VERSION_Cabal(3,9,0)
ppPackageCheck = explanation
#endif
mapM_ (throwError . ppPackageCheck) errors
mapM_ (warn . ppPackageCheck) warnings

-- Proprietary License check (only active in central-server branch)
unless (allowAllRightsReserved || isAcceptableLicense pkgDesc) $
Expand Down
6 changes: 5 additions & 1 deletion src/Distribution/Server/Util/CabalRevisions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,16 @@ checkCabalFileRevision checkXRevision old new = do
newwarns -> fail $ "New parse warning: "
++ unlines (map (showPWarning filename) newwarns)

checkPackageChecks :: Check GenericPackageDescription
checkPackageChecks pkg pkg' =
let checks = checkPackage pkg Nothing
checks' = checkPackage pkg' Nothing
in case checks' \\ checks of
[] -> return ()
newchecks -> fail $ unlines (map explanation newchecks)
newchecks -> fail $ unlines (map ppPackageCheck newchecks)
#if !MIN_VERSION_Cabal(3,9,0)
where ppPackageCheck = explanation
#endif

checkGenericPackageDescription :: Bool -> Check GenericPackageDescription
checkGenericPackageDescription checkXRevision
Expand Down