Skip to content

Commit 10f76a7

Browse files
hdgarroodpaf31
authored andcommitted
Switch to stack for CI, resolves purescript#1974 (purescript#2099)
* Switch to stack for CI, resolves purescript#1974 * Remove the stack-nightly.yaml, since it always needs updating. Instead, we pass --resolver=nightly in one of the build jobs to ensure we always have the latest nightly. As an added bonus we no longer have to set the STACK_YAML environment variable on Windows, because stack.yaml is no longer a symlink. * Remove use of cabal-install, which drastically simplifies the CI scripts :) * Use the 'compiler' key in the build matrix as a hack to ensure each build job gets a separate cache. * Add OSX tests. * Add haddock tests, on a separate build job (for speed). * Use separate build jobs for sdist tests (for speed). * Fix binary bundle uploading on Travis * Add binary bundle uploading for OSX. * Update appveyor CI * No longer need to set STACK_YAML on AppVeyor * We should not attempt to run 'strip' on Windows executables * Fix path to bundle creation script
1 parent 73746d9 commit 10f76a7

File tree

12 files changed

+151
-130
lines changed

12 files changed

+151
-130
lines changed

.travis.yml

Lines changed: 66 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,80 @@
11
language: c
2-
dist: trusty
2+
dist: trusty # because of perf issues
33
sudo: required
44
matrix:
55
include:
6-
- env: GHCVER=7.10.3 CABALVER=1.22 STACKAGE=lts-5.4 RUNSDISTTESTS=YES
7-
compiler: ": #GHC 7.10.3 lts-5.4"
8-
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,happy-1.19.5,alex-3.1.4], sources: [hvr-ghc]}}
9-
- env: GHCVER=7.10.3 CABALVER=1.22 STACKAGE=nightly-2016-02-25
10-
compiler: ": #GHC 7.10.3 nightly-2016-02-25"
11-
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,happy-1.19.5,alex-3.1.4], sources: [hvr-ghc]}}
12-
- env: GHCVER=7.10.3 CABALVER=1.22 DEPLOY=yes
13-
compiler: ": #GHC 7.10.3"
14-
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,happy-1.19.5,alex-3.1.4], sources: [hvr-ghc]}}
15-
before_install:
16-
- unset CC
17-
- export PATH="/opt/ghc/$GHCVER/bin:$PATH"
18-
- export PATH="/opt/cabal/$CABALVER/bin:$PATH"
19-
- export PATH="$HOME/.cabal/bin:$PATH"
20-
- export PATH="/opt/happy/1.19.5/bin:/$PATH"
21-
- export PATH="/opt/alex/3.1.4/bin:/$PATH"
22-
- export PATH="$HOME/build/purescript/purescript/dist/build/psc:/$PATH"
23-
- export PATH="$HOME/build/purescript/purescript/dist/build/psc-ide-server:/$PATH"
24-
- export PATH="$HOME/build/purescript/purescript/dist/build/psc-ide-client:/$PATH"
6+
# The 'compiler' key is a hack to get Travis to use different caches for
7+
# each job in a build, in order to avoid the separate jobs stomping on each
8+
# other's caches. See https://github.com/travis-ci/travis-ci/issues/4393
9+
#
10+
# We use trusty boxes because they seem to be a bit faster.
11+
- compiler: cc-linux-lts-normal
12+
os: linux
13+
dist: trusty
14+
sudo: required
15+
env: BUILD_TYPE=normal COVERAGE=true DEPLOY=true
16+
17+
- compiler: cc-linux-nightly-normal
18+
os: linux
19+
dist: trusty
20+
sudo: required
21+
env: BUILD_TYPE=normal STACKAGE_NIGHTLY=true
22+
allow_failures: true
23+
24+
- compiler: cc-linux-lts-sdist
25+
os: linux
26+
dist: trusty
27+
sudo: required
28+
env: BUILD_TYPE=sdist
29+
30+
- compiler: cc-linux-lts-haddock
31+
os: linux
32+
dist: trusty
33+
sudo: required
34+
env: BUILD_TYPE=haddock
35+
36+
- compiler: cc-osx-lts-normal
37+
os: osx
38+
env: BUILD_TYPE=normal DEPLOY=true
39+
40+
- compiler: cc-osx-lts-sdist
41+
os: osx
42+
env: BUILD_TYPE=sdist
43+
addons:
44+
apt:
45+
packages:
46+
- libgmp-dev
47+
cache:
48+
directories:
49+
- $HOME/.local/bin
50+
- $HOME/.stack
2551
install:
26-
- cabal --version
27-
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
28-
- travis_retry cabal update
29-
# Run sequentially
30-
# Travis container infrastructure seems to expose all host CPUs (16?), thus
31-
# cabal and ghc tries to use them all. Which is bad idea on a shared box.
32-
# See also: https://ghc.haskell.org/trac/ghc/ticket/9221
33-
- sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
34-
# Cache sandboxes in ~/cabal-sandboxes
35-
# Move right sandbox to .cabal-sandbox if exists
36-
- if [ -d ~/cabal-sandboxes/$GHCVER-${STACKAGE:-none} ]; then
37-
mv ~/cabal-sandboxes/$GHCVER-${STACKAGE:-none} .cabal-sandbox;
38-
fi
39-
- mkdir -p .cabal-sandbox
40-
- cabal sandbox init --sandbox .cabal-sandbox
41-
# Download stackage cabal.config. Filter this package and 'extra deps'
42-
- if [ -n "$STACKAGE" ]; then curl https://www.stackage.org/$STACKAGE/cabal.config | egrep -v 'purescript|language-javascript|bower-json' > cabal.config; fi
43-
- cabal install --only-dependencies --enable-tests
44-
- cabal install hpc-coveralls
45-
# Snapshot state of the sandbox now, so we don't need to make new one for test install
46-
- rm -rf ~/cabal-sandboxes/$GHCVER-${STACKAGE:-none}
47-
- cp -r .cabal-sandbox ~/cabal-sandboxes/$GHCVER-${STACKAGE:-none}
48-
# Install bower globally (for psc-docs/psc-publish tests)
49-
- npm install -g bower
52+
- | # Install stack.
53+
if test ! -f "$HOME/.local/bin/stack"
54+
then
55+
URL="https://www.stackage.org/stack/$TRAVIS_OS_NAME-x86_64"
56+
curl --location "$URL" > stack.tar.gz
57+
gunzip stack.tar.gz
58+
tar -x -f stack.tar --strip-components 1
59+
mkdir -p "$HOME/.local/bin"
60+
mv stack "$HOME/.local/bin/"
61+
fi
62+
- npm install -g bower # for psc-docs / psc-publish tests
63+
# Fix the CC environment variable, because Travis changes it
64+
- export CC=gcc
65+
- export OS_NAME=$(./travis/convert-os-name.sh)
5066
script:
51-
- ./travis/configure.sh
52-
- cabal build --ghc-options="-Werror"
53-
- cabal test
54-
- ./travis/test-install.sh
55-
after_script:
56-
- ./travis/after.sh
57-
notifications:
58-
email: true
59-
before_deploy: "./bundle/build.sh linux64"
67+
- travis/build.sh
68+
before_deploy:
69+
- ./bundle/build.sh $OS_NAME
6070
deploy:
6171
provider: releases
6272
api_key: $RELEASE_KEY
6373
file:
64-
- bundle/linux64.tar.gz
65-
- bundle/linux64.sha
74+
- bundle/$OS_NAME.tar.gz
75+
- bundle/$OS_NAME.sha
6676
skip_cleanup: true
6777
on:
6878
all_branches: true
6979
tags: true
70-
condition: "$DEPLOY = yes"
71-
cache:
72-
directories:
73-
- ~/cabal-sandboxes
80+
condition: "$DEPLOY = true"

appveyor.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ environment:
55
STACK_ROOT: c:\s
66
# Appveyor does not seem to be able to cope with the symbolic link
77
# stack.yaml, so this is a workaround.
8-
STACK_YAML: stack-lts-5.yaml
98
RELEASE_USER: purescript
109
RELEASE_REPO: purescript
1110
cache:
@@ -31,9 +30,6 @@ build_script:
3130
test_script:
3231
- stack -j1 --no-terminal test --pedantic
3332
on_success:
34-
# this seems to be necessary; if omitted, the bash script fails to find the
35-
# tool 'strip'.
36-
- copy C:\MinGW\bin\strip.exe C:\tools\strip.exe
3733
- ps: |
3834
function UploadFile
3935
{
@@ -42,7 +38,7 @@ on_success:
4238
4339
if ($env:APPVEYOR_REPO_TAG_NAME)
4440
{
45-
bash ./bundle/build-stack.sh win64
41+
bash ./bundle/build.sh win64
4642
4743
(New-Object Net.WebClient).DownloadFile('https://github.com/aktau/github-release/releases/download/v0.6.2/windows-amd64-github-release.zip', 'c:\tools\github-release.zip')
4844
pushd c:\tools
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ mkdir -p bundle/build/purescript
2929
for BIN in psc psci psc-docs psc-publish psc-bundle psc-ide-server psc-ide-client
3030
do
3131
FULL_BIN="$LOCAL_INSTALL_ROOT/bin/${BIN}${BIN_EXT}"
32-
strip "$FULL_BIN" || true # not the end of the world if this fails, and
33-
# AppVeyor can't seem to handle it for some reason
32+
if [ "$OS" != "win64" ]
33+
then
34+
strip "$FULL_BIN"
35+
fi
3436
cp "$FULL_BIN" bundle/build/purescript
3537
done
3638

purescript.cabal

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ extra-source-files: examples/passing/*.purs
7777
, tests/support/pscide/src/*.js
7878
, tests/support/pscide/src/*.fail
7979
, stack.yaml
80-
, stack-lts-5.yaml
81-
, stack-nightly.yaml
8280
, README.md
8381
, INSTALL.md
8482
, CONTRIBUTORS.md

stack-lts-5.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

stack-nightly.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

stack.yaml

Lines changed: 0 additions & 1 deletion
This file was deleted.

stack.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
resolver: lts-5.4
2+
packages:
3+
- '.'
4+
extra-deps:
5+
- bower-json-0.8.0
6+
- language-javascript-0.6.0.4
7+
flags: {}

travis/after.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

travis/build.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
set -e
3+
4+
STACK="stack --no-terminal --jobs=1"
5+
$STACK setup
6+
7+
# Set up configuration
8+
STACK_EXTRA_FLAGS=""
9+
if [ -z "$TRAVIS_TAG" ]
10+
then
11+
# On non-release builds, disable optimizations.
12+
STACK_EXTRA_FLAGS="--fast"
13+
fi
14+
15+
if [ "$STACKAGE_NIGHTLY" = "true" ]
16+
then
17+
STACK_EXTRA_FLAGS="$STACK_EXTRA_FLAGS --resolver=nightly"
18+
fi
19+
20+
if [ "$COVERAGE" = "true" ]
21+
then
22+
STACK_EXTRA_FLAGS="$STACK_EXTRA_FLAGS --coverage"
23+
fi
24+
25+
echo "STACK_EXTRA_FLAGS=\"$STACK_EXTRA_FLAGS\""
26+
BUILD_COMMAND="$STACK build --pedantic --test $STACK_EXTRA_FLAGS"
27+
28+
if [ "$BUILD_TYPE" = "normal" ]
29+
then
30+
echo ">>> Building & testing..."
31+
echo "> $BUILD_COMMAND"
32+
$BUILD_COMMAND
33+
34+
elif [ "$BUILD_TYPE" = "sdist" ]
35+
then
36+
echo ">>> Testing the source distribution..."
37+
$STACK sdist
38+
mkdir sdist-test
39+
tar -xzf $(stack path --dist-dir)/purescript-*.tar.gz -C sdist-test --strip-components=1
40+
pushd sdist-test
41+
echo "> $BUILD_COMMAND"
42+
$BUILD_COMMAND
43+
popd
44+
45+
elif [ "$BUILD_TYPE" = "haddock" ]
46+
then
47+
echo ">>> Checking haddock documentation..."
48+
$STACK haddock
49+
else
50+
echo "Unrecognised BUILD_TYPE: $BUILD_TYPE"
51+
exit 1
52+
fi
53+
54+
if [ "$COVERAGE" = "true" ]
55+
then
56+
echo ">>> Uploading test coverage report..."
57+
which shc || $STACK install stack-hpc-coveralls
58+
shc purescript tests || echo "Failed to upload coverage"
59+
fi

0 commit comments

Comments
 (0)