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

Ghc head #76

Merged
merged 19 commits into from
Dec 18, 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
19 changes: 11 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ env: &env
# Common options
# ------------------------------------------------------------------------
# GHC_OPTIONS: "-Werror"
GHCUPVER: 0.1.20.0
# For updating see: https://downloads.haskell.org/~ghcup/
GHCUP_VERSION: 0.1.20.0
CABAL_REINIT_CONFIG: "y"
LC_ALL: "C.UTF-8"

Expand Down Expand Up @@ -44,6 +45,7 @@ env: &env
# cabal options
# ------------------------------------------------------------------------
CABAL_CHECK_RELAX: "y"
CABAL_HACKAGE_MIRROR: "hackage.haskell.org:http://hackage.fpcomplete.com"
CABAL_PROJECT: "cabal.project"

# ------------------------------------------------------------------------
Expand Down Expand Up @@ -79,20 +81,23 @@ preinstall: &preinstall
# required for https/cache save and restore
apt-get install -y ca-certificates

# NOTE: depends on specific debian version in the deb line below
# For ghc and cabal-install packages from haskell.org
# Alternative way of installing ghc and cabal, directly from
# haskell.org instead of using ghcup. NOTE: this is for Debian
# only and is debian release specific.
# gnupg is required for apt-key to work
#apt-get install -y gnupg
#apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574
#echo "deb http://downloads.haskell.org/debian buster main" >> /etc/apt/sources.list
#apt-get update
#apt-get install -y ghc-8.10.4
#apt-get install -y cabal-install-3.4

# required for outbound https for stack and for stack setup
apt-get install -y netbase xz-utils make
apt-get install -y zlib1g-dev

# For ghcup to install ghc
if test -n "$GHCUPVER"
if test -n "$GHCUP_VERSION"
then
apt-get install -y gcc
apt-get install -y g++
Expand All @@ -115,9 +120,8 @@ preinstall: &preinstall
then
die "PACKCHECK_GITHUB_COMMIT is not specified."
fi
CURL=$(which curl)
PACKCHECK_URL=${PACKCHECK_GITHUB_URL}/${PACKCHECK_GITHUB_COMMIT}/packcheck.sh
$CURL -sL -o "$PACKCHECK" $PACKCHECK_URL
curl --fail -sL -o "$PACKCHECK" $PACKCHECK_URL || exit 1
chmod +x $PACKCHECK
elif test ! -x "$PACKCHECK"
then
Expand All @@ -133,9 +137,8 @@ save: &save
save_cache:
key: v1-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}
paths:
- ~/.cabal
- ~/.ghc
- ~/.local
- ~/.cabal
- ~/.stack
- ~/.ghcup

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/packcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ jobs:
# ------------------------------------------------------------------------
# Selecting tool versions
# ------------------------------------------------------------------------
GHCUPVER: 0.1.20.0
# For updating see: https://downloads.haskell.org/~ghcup/
GHCUP_VERSION: 0.1.20.0
GHCVER: ${{ matrix.ghc_version }}
# RESOLVER: ${{ matrix.stack_resolver }}

Expand All @@ -66,6 +67,7 @@ jobs:
# cabal options
# ------------------------------------------------------------------------
CABAL_CHECK_RELAX: y
CABAL_HACKAGE_MIRROR: "hackage.haskell.org:http://hackage.fpcomplete.com"
CABAL_PROJECT: "cabal.project"

# ------------------------------------------------------------------------
Expand Down Expand Up @@ -126,7 +128,7 @@ jobs:
command: hlint
runner: ubuntu-latest
pack_options: >-
HLINTVER=3.6.1
HLINT_VERSION=3.6.1
HLINT_OPTIONS="lint"
HLINT_TARGETS="src"

Expand All @@ -136,9 +138,8 @@ jobs:
name: Cache common directories
with:
path: |
~/.cabal
~/.ghc
~/.local
~/.cabal
~/.stack
~/.ghcup
key: ${{ matrix.command }}-${{ matrix.ghc_version }}-${{ matrix.runner }}
Expand All @@ -151,9 +152,8 @@ jobs:
then
die "PACKCHECK_GITHUB_COMMIT is not specified."
fi
CURL=$(which curl)
PACKCHECK_URL=${PACKCHECK_GITHUB_URL}/${PACKCHECK_GITHUB_COMMIT}/packcheck.sh
$CURL -sL -o "$PACKCHECK" $PACKCHECK_URL
curl --fail -sL -o "$PACKCHECK" $PACKCHECK_URL || exit 1
chmod +x $PACKCHECK
elif test ! -x "$PACKCHECK"
then
Expand Down
10 changes: 5 additions & 5 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
## 0.7.0 (Dec 2023)

### Enhancements
* Now supports using ghcup to install ghc automatically if GHCUPVER env var is
specified.
* Supports using ghcup to install ghc automatically if `GHCUP_VERSION`
env var is specified.
* Supports running cabal-docspec (doctest) in `cabal` build using the
`ENABLE_DOCSPEC` option (Linux only).
* `HLINT_VERSION` env var can be used to install a specific version of hlint

### Breaking Changes

* Explicit `hlint` command was added. Use
`packcheck hlint HLINT_OPTIONS="lint" ...` instead of
`packcheck cabal-v2 HLINT_OPTIONS="lint" ...` to run hlint on the package.
* `HLINTVER` env var can be used to install a specific version of hlint instead
of using one in PATH.
* Removed GHCJS, coveralls support
* Removed `CABAL_HACKAGE_MIRROR` env var

## 0.6.0

Expand Down
56 changes: 31 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ are used in CI files to run the exact same tests locally. Usage is as simple
as:
```
$ packcheck.sh cabal
$ packcheck.sh cabal GHCUPVER=0.1.20.0 GHCVER=9.8.1
$ packcheck.sh cabal GHCUP_VERSION=0.1.20.0 GHCVER=9.8.1
$ packcheck.sh stack GHCVER=9.4
```

Expand Down Expand Up @@ -96,7 +96,7 @@ The script can be easily adapted to any CI with a single line build command.
line or environment variables, including tool options or whether to enable
benchmarks, haddock, coverage, test etc.
* _Picking GHC:_ Right GHC is picked up automatically from PATH or installed
using ghcup by specifying GHCUPVER and GHCVER env vars. Stack
using ghcup by specifying GHCUP_VERSION and GHCVER env vars. Stack
installed GHC binaries can be picked automatically when available.
* _Test source distribution:_ `packcheck` creates the source distribution and
builds the package from the generated tarball to make sure that you build
Expand Down Expand Up @@ -154,7 +154,7 @@ You can run these commands on your local machine as well as inside a CI script.
You can try these commands in the `packcheck` package itself:
```
$ cd packcheck
$ ./packcheck.sh cabal GHCUPVER=0.1.20.0 GHCVER=9.8.1
$ ./packcheck.sh cabal GHCUP_VERSION=0.1.20.0 GHCVER=9.8.1
```

```
Expand Down Expand Up @@ -184,12 +184,16 @@ When `GHCVER` parameter is not specified, `packcheck` looks for a binary named
`ghc` in your `PATH` environment variable. It uses first such binary found in
`PATH`.

When `GHCVER` parameter is specified, it looks for `ghc` in the `PATH` and if
`GHCVER` is a PREFIX of the actual version of `ghc` binary found then that
`ghc` binary is used. Otherwise, `packcheck` tries to look for another `ghc`
binary in the next PATH components until it finds a matching `ghc` version.
When `GHCVER` parameter is specified and is not set to `head`, it looks
for `ghc` in the `PATH` and if `GHCVER` is a PREFIX of the actual
version of `ghc` binary found then that `ghc` binary is used. Otherwise,
`packcheck` tries to look for another `ghc` binary in the next PATH
components until it finds a matching `ghc` version.

If `GHCUPVER` is specified packcheck tries to use the existing `ghcup`
If `GHCVER` is set to `head`, packcheck looks for `ghc-head` as the
compiler and does not check the numeric version of the compiler.

If `GHCUP_VERSION` is specified packcheck tries to use the existing `ghcup`
to install the ghc, if `ghcup` is not found it installs the requested
version and then installs the `GHCVER` using it.

Expand Down Expand Up @@ -274,8 +278,7 @@ n|N|no|No|NO|false|False|FALSE|off|Off|OFF or empty for a negative value.
--------------------------------------------------
Commands and flags
--------------------------------------------------
cabal-v2 : build using cabal v2-build
cabal : alias for cabal-v2
cabal : build using cabal
stack : build using stack
hlint : run hlint
clean : remove the .packcheck directory
Expand All @@ -286,12 +289,14 @@ help | --help | -h : show this help message
--------------------------------------------------
Selecting tool versions
--------------------------------------------------
GHCUPVER : [a.b.c.d] GHCUP version to install GHCVER if needed
GHCVER : [a.b.c] GHC version prefix (may not be enforced when using stack)
GHCUP_VERSION : [a.b.c.d] GHCUP version to install GHCVER if needed
GHCVER : [a.b.c | head] GHC version prefix (may not be enforced when using stack)
CABALVER : [a.b.c.d] Cabal version (prefix) to use
RESOLVER : Stack resolver to use for stack builds or cabal builds using stack
STACKVER : [a.b.c.d] Stack version (prefix) to use
STACK_UPGRADE : [y] DESTRUCTIVE! Upgrades stack to latest version
RESOLVER : Stack resolver to use for stack builds or cabal builds using stack
HLINT_VERSION : Download a specific version binary of hlint instead of using one in PATH
DOCSPEC_URL : cabal-docspec release URL to install at ~/.local/bin/cabal-docspec (see https://github.com/phadej/cabal-extras/releases/)

--------------------------------------------------
Where to find the required tools
Expand All @@ -301,50 +306,51 @@ PATH : [path] Set PATH explicitly for predictable builds
--------------------------------------------------
Specifying common tool options
--------------------------------------------------
GHCUP_GHC_OPTIONS : Used as in "ghcup install ghc <GHCUP_GHC_OPTIONS> <version>"
GHC_OPTIONS : Specify GHC options to use
SDIST_OPTIONS : Arguments to stack/cabal sdist command
CABAL_REINIT_CONFIG : [y] DESTRUCTIVE! Remove old config to avoid incompatibility issues

--------------------------------------------------
Specifying what to build
--------------------------------------------------
DISABLE_BENCH : [y] Do not build benchmarks, default is to build but not run
DISABLE_TEST : [y] Do not run tests, default is to run tests
DISABLE_DOCS : [y] Do not build haddocks, default is to build docs
ENABLE_DOCSPEC : [y] Run cabal-docspec after the cabal build
DISABLE_SDIST_BUILD : [y] Do not build from source distribution
DISABLE_SDIST_PROJECT_CHECK: [y] Ignore project file and continue
DISABLE_SDIST_GIT_CHECK : [y] Do not compare source distribution with git repo
DISABLE_DIST_CHECKS : [y] Do not perform source distribution checks

--------------------------------------------------
stack options
--------------------------------------------------
STACK_YAML : Alternative stack config file path relative to project root
STACK_OPTIONS : ADDITIONAL stack global options (e.g. -v) to append
STACK_BUILD_OPTIONS : ADDITIONAL stack build command options to append

--------------------------------------------------
cabal options
--------------------------------------------------
CABAL_REINIT_CONFIG : [y] DESTRUCTIVE! Remove old config to avoid incompatibility issues
CABAL_PROJECT : Alternative cabal project file, path relative to project root
CABAL_BUILD_OPTIONS : ADDITIONAL cabal v2-build options to append to defaults
CABAL_DISABLE_DEPS : [y] Do not install dependencies, do not do cabal update
CABAL_BUILD_TARGETS : cabal v2-build targets, default is 'all'
CABAL_CHECK_RELAX : [y] Do not fail if cabal check fails on the package.
CABAL_HACKAGE_MIRROR : DESTRUCTIVE! Specify an alternative mirror, modifies the cabal config file.

--------------------------------------------------
Coverage options
stack options
--------------------------------------------------
COVERAGE : [y] Just generate coverage information
STACK_YAML : Alternative stack config file path relative to project root
STACK_OPTIONS : ADDITIONAL stack global options (e.g. -v) to append
STACK_BUILD_OPTIONS : ADDITIONAL stack build command options to append

--------------------------------------------------
hlint options
--------------------------------------------------
HLINTVER : Download a specific version binary of hlint instead of using one in PATH
HLINT_BUILD : Build latest hlint from hackage source
HLINT_OPTIONS : hlint arguments e.g.'--datadir=. lint'
HLINT_TARGETS : target directories to run hlint on e.g. 'src test'

--------------------------------------------------
Coverage options
--------------------------------------------------
COVERAGE : [y] Just generate coverage information

--------------------------------------------------
Diagnostics options
--------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ environment:
# cabal options
# ------------------------------------------------------------------------
CABAL_CHECK_RELAX: "y"
CABAL_HACKAGE_MIRROR: "hackage.haskell.org:http://hackage.fpcomplete.com"
CABAL_PROJECT: "cabal.project"

# ------------------------------------------------------------------------
Expand Down
Loading
Loading