...
 
Commits (11)
......@@ -57,6 +57,7 @@ build-master:
extends: .build
variables:
GHC_TARBALL: "https://gitlab.haskell.org/api/v4/projects/1/jobs/artifacts/master/raw/ghc-x86_64-fedora27-linux.tar.xz?job=validate-x86_64-linux-fedora27"
EXTRA_HC_OPTS: "-dcore-lint"
only:
- branches
- merge_requests
......@@ -66,6 +67,7 @@ build-8.8:
extends: .build
variables:
GHC_TARBALL: "https://gitlab.haskell.org/api/v4/projects/1/jobs/artifacts/ghc-8.8/raw/ghc-8.8.1-x86_64-unknown-linux.tar.xz?job=validate-x86_64-linux-fedora27"
EXTRA_HC_OPTS: "-dcore-lint"
only:
- branches
- merge_requests
......@@ -92,23 +94,12 @@ build-8.8:
--argstr url $GHC_TARBALL \
--out-link ghc \
ghcHEAD
- GHC=`pwd`/ghc/bin/ghc
- rm -Rf $HOME/.cabal/pacakages/local tmp; mkdir -p tmp; cd tmp
- |
EXTRA_OPTS="--cabal-option=-j$CPUS" # Use cabal's build parallelism
if [ -n "$EXTRA_HC_OPTS" ]; then
EXTRA_OPTS="$EXTRA_OPTS --ghc-option=\"$EXTRA_HC_OPTS\""
fi
- export GHC=`pwd`/ghc/bin/ghc
- rm -Rf $HOME/.cabal/packages/local ci/run
- nix run -f ./ci -c run-ci
nix eval --raw -f ../ci cabalDepsSrc > deps.cabal.project
nix run -f ../ci -c \
head-hackage-ci \
test-patches \
--extra-cabal-fragment=$(pwd)/deps.cabal.project \
--patches=../patches \
--with-compiler=$GHC \
$EXTRA_OPTS
- nix run -f ../ci -c xz results.json
after_script:
- nix run -f ./ci -c tar -cJf results.tar.xz results.json logs
artifacts:
when: always
......
......@@ -145,40 +145,28 @@ $ nix build -f ./. --arg ghc "(import ghc-from-source.nix {ghc-path=$GHC_TREE;})
### GitLab CI
[GHC's GitLab instance](https://gitlab.haskell.org/ghc/head.hackage) uses
GitLab CI and `nix` to build a subset of the head.hackage package set using GHC
snapshots.
GitLab CI and the `head-hackage-ci` tool (contained in the `ci/` directory)
to test the `head.hackage` patchset against GHC releases and snapshots.
To run a similar build locally simply download a binary distribution from a
`x86_64-fedora27-linux` CI job and run:
To run a similar build locally start by downloading and installing a binary
distribution appropriate for your distribution and then call the `run-ci` script:
```
$ export GHC_TARBALL=./ghc-x86_64-fedora27-linux.tar.xz
# for extra correctness assurance...
$ export EXTRA_HC_OPTS=-dcore-lint
$ scripts/build-nix.sh
$ ./run-ci
```
This will build the set of packages defined by the `testedPackages` list in
`scripts/build-all.nix`.
This will build all packages having patches and produce a textual summary, as
well as a JSON file (`result.json`) describing the outcome.
After building `testedPackages` (allowing for failures) the script job runs
`scripts/summarize.py`, which produces a few artifacts:
* a JSON summary (`summary.json`) which includes the full dependency graph as
well as which package builds failed
* a DOT graph (`summary.dot`) showing the package depedencies and their build
success. This can be rendered with `scripts/render-graph.sh`.
* a directory (`./logs`) of build logs
Note that `build-nix.sh` can also be used to build packages not included in
`testedPackages`:
```
$ scripts/build-nix.sh pandoc
```
### Hackage repository
[GHC's GitLab instance](https://gitlab.haskell.org/ghc/head.hackage) uses
GitLab CI to deploy a Hackage repository with the patches provided by
`head.hackage`. See the [repository]() for usage instructions.
`head.hackage`. See the
[repository](http://ghc.gitlab.haskell.org/head.hackage/) for usage
instructions.
### Travis CI
......
This diff is collapsed.
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Types
( RunResult(..)
, runResultUnits
, TestedPatch(..)
, PackageResult(..)
, BuildInfo(..)
, BuildResult(..)
, LogOutput(..)
) where
import Cabal.Plan
......@@ -29,41 +33,53 @@ data BuildInfo
deriving anyclass (ToJSON, FromJSON)
-- | The result of a unit build.
data BuildResult
= BuildSucceeded { buildLog :: T.Text }
data BuildResult log
= BuildSucceeded { buildLog :: log }
-- ^ the build succeeded.
| BuildPreexisted
-- ^ the unit pre-existed in the global package database.
| BuildFailed { buildLog :: T.Text }
| BuildFailed { buildLog :: log }
-- ^ the build failed
| BuildNotAttempted
-- ^ the build was not attempted either because a dependency failed or it
-- is an executable or testsuite component
deriving stock (Show, Generic)
deriving stock (Show, Generic, Functor, Foldable, Traversable)
deriving anyclass (ToJSON, FromJSON)
-- | The result of an attempt to tested a patch
data PackageResult
data PackageResult log
= PackagePlanningFailed { planningError :: T.Text }
-- ^ Our attempt to build the package resulting in no viable install plan.
| PackageResult { packageBuilt :: Bool
, units :: M.Map UnitId (BuildInfo, BuildResult)
, units :: M.Map UnitId (BuildInfo, BuildResult log)
}
-- ^ We attempted to build the package.
deriving stock (Show, Generic)
deriving stock (Show, Generic, Functor, Foldable, Traversable)
deriving anyclass (ToJSON, FromJSON)
-- | Information about a patch which we tested.
data TestedPatch
data TestedPatch log
= TestedPatch { patchedPackageName :: PkgName
, patchedPackageVersion :: Ver
, patchedPackageResult :: PackageResult
, patchedPackageResult :: PackageResult log
}
deriving stock (Show, Generic)
deriving stock (Show, Generic, Functor, Foldable, Traversable)
deriving anyclass (ToJSON, FromJSON)
-- | The result of a CI run.
data RunResult
= RunResult { testedPatches :: [TestedPatch] }
deriving stock (Show, Generic)
data RunResult log
= RunResult { testedPatches :: [TestedPatch log] }
deriving stock (Show, Generic, Functor, Foldable, Traversable)
deriving anyclass (ToJSON, FromJSON)
runResultUnits :: RunResult log -> M.Map UnitId (BuildInfo, BuildResult log)
runResultUnits runResult = M.unions
[ units
| tpatch <- testedPatches runResult
, PackageResult _ units <- pure $ patchedPackageResult tpatch
]
-- | Logged output from a build.
newtype LogOutput = LogOutput { getLogOutput :: T.Text }
deriving stock (Eq, Ord, Show)
deriving newtype (ToJSON, FromJSON)
# vi: set filetype=sh
# Packages expected not to build due to GHC bugs. This is `source`'d by the CI
# script and the arguments in BROKEN_ARGS are added to the hackage-ci
# command-line.
# Mark the named package as broken.
#
# Usage:
# broken $pkg_name $ghc_ticket_number
#
function broken() {
pkg_name="$1"
ticket="$2"
echo "Marking $pkg_name as broken due to #$ticket"
BROKEN_ARGS="$BROKEN_ARGS --expect-broken=$pkg_name"
}
if [ -z "$GHC" ]; then GHC=ghc; fi
function ghc_version() {
$GHC --version | sed 's/.*version \([0-9]*\.\([0-9]*\.\)*\)/\1/'
}
# ======================================================================
# The lists begin here
#
# For instance:
#
# broken "lens" 17988
version="$(ghc_version)"
echo "Found GHC $version."
case $version in
8.8.*)
;;
8.9.*)
# package ticket
broken "singletons" 17405
broken "vinyl" 17405
;;
*)
echo "No broken packages for GHC $version"
;;
esac
......@@ -48,6 +48,11 @@ let
makeWrapper ${./build-repo.sh} $out/bin/build-repo.sh \
--prefix PATH : ${stdenv.lib.makeBinPath deps}:$out/bin
makeWrapper ${../run-ci} $out/bin/run-ci \
--prefix PATH : ${stdenv.lib.makeBinPath deps}:$out/bin \
--set USE_NIX 1 \
--set BROKEN_LIST ${./broken-packages.sh}
makeWrapper ${xz}/bin/xz $out/bin/xz
'';
in
......
#!/usr/bin/env bash
set -e
cd ci
if [ -z "$GHC" ]; then
echo "The \$GHC variable is un-set. Defaulting to 'ghc'."
GHC="ghc"
fi
if [ -z "$BROKEN_LIST" ]; then
BROKEN_LIST=broken-packages.sh
fi
if [ -f "$BROKEN_LIST" ]; then
source $BROKEN_LIST
EXTRA_OPTS="$EXTRA_OPTS $BROKEN_ARGS"
else
echo "Couldn't find broken package list"
fi
EXTRA_OPTS="$EXTRA_OPTS --cabal-option=-j$CPUS" # Use cabal's build parallelism
if [ -n "$EXTRA_HC_OPTS" ]; then
EXTRA_OPTS="$EXTRA_OPTS --ghc-option=\"$EXTRA_HC_OPTS\""
fi
mkdir -p run
cd run
echo "" > deps.cabal.project
if [ -n "$USE_NIX" ]; then
# Generate native library dependency mapping
nix eval --raw -f ../. cabalDepsSrc >> deps.cabal.project
run="nix run -f ../. -c head-hackage-ci"
else
run="cabal new-run head-hackage-ci --"
fi
set -x
$run \
test-patches \
--extra-cabal-fragment=$(pwd)/deps.cabal.project \
--patches=../../patches \
--with-compiler=$GHC \
$EXTRA_OPTS