forked from purescript/spago
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
168 lines (138 loc) · 5.29 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
sudo: required
language: generic
dist: bionic
cache:
directories:
- $HOME/.ghc
- $HOME/.cabal
- $HOME/.stack
- $TRAVIS_BUILD_DIR/.stack-work
services:
- docker
matrix:
include:
# Build on Linux with docker
- env: BUILD=stack ARGS="" PURS_OS="linux64" IMAGE_TAG=lts-12
compiler: ": #stack default"
# Build on macOS natively
- env: BUILD=stack ARGS="" PURS_OS="macos"
compiler: ": #stack default osx"
os: osx
# Build only master and release tags
branches:
only:
- master
- /^\d+\.\d+\.\d+(\.\d+)?$/
before_install:
# Using compiler above sets CC to an invalid value, so unset it
- unset CC
# We want to always allow newer versions of packages when building on GHC HEAD
- CABALARGS=""
- if [ "x$GHCVER" = "xhead" ]; then CABALARGS=--allow-newer; fi
- |
echo "Running before_install"
if [ `uname` = "Darwin" ]
then
# Download and unpack the stack executable
export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:/opt/alex/$ALEXVER/bin:/opt/happy/$HAPPYVER/bin:$HOME/.cabal/bin:$PATH
mkdir -p ~/.local/bin
travis_retry curl --insecure -L https://get.haskellstack.org/stable/osx-x86_64.tar.gz | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
# Use the more reliable S3 mirror of Hackage
mkdir -p $HOME/.cabal
echo 'remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/' > $HOME/.cabal/config
echo 'remote-repo-cache: $HOME/.cabal/packages' >> $HOME/.cabal/config
else
docker pull "nilrecurring/haskell-lavello:${IMAGE_TAG}"
docker run --mount src="$(pwd)",target=/home/ubuntu/spago,type=bind "nilrecurring/haskell-lavello:${IMAGE_TAG}" /bin/bash -c "sudo chown -R ubuntu spago; cd spago; stack build --haddock --no-haddock-deps"
fi
install:
- |
echo "Running install"
if [ `uname` = "Darwin" ]
then
echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
if [ -f configure.ac ]; then autoreconf -i; fi
set -ex
stack --no-terminal --install-ghc $ARGS test --bench --only-dependencies
set +ex
else
echo "Skipping install on Linux"
fi
script:
- |
echo "Running tests"
export PATH="${PATH}:$(pwd)/artifacts"
if [ `uname` = "Darwin" ]
then
stack build --test --no-run-tests --copy-bins --local-bin-path ./artifacts --haddock --no-haddock-deps;
else
docker run --mount src="$(pwd)",target=/home/ubuntu/spago,type=bind \
"nilrecurring/haskell-lavello:${IMAGE_TAG}" /bin/bash -c \
'cd spago && stack build --test --no-run-tests --flag spago:static --haddock --no-haddock-deps'
docker run --mount src="$(pwd)",target=/home/ubuntu/spago,type=bind \
"nilrecurring/haskell-lavello:${IMAGE_TAG}" /bin/bash -c \
'cd spago && stack build --test --no-run-tests --copy-bins --local-bin-path ./artifacts --haddock --no-haddock-deps'
fi
nvm install 10 && nvm use 10
npm install -g psc-package@3.0.1 bower@1.8.8
# get purescript from github releases
TAG="v0.13.6"
wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/$PURS_OS.tar.gz
tar -xvf $HOME/purescript.tar.gz -C $HOME/
chmod a+x $HOME/purescript
PATH=$HOME/purescript:$PATH
# run the test suite executable
./.stack-work/dist/*/*/build/spec/spec
before_deploy:
- |
echo "Running before_deploy"
# We have to check on this condition so we run the before_deploy job only once
if ! [ "$BEFORE_DEPLOY_RUN" ]; then
export BEFORE_DEPLOY_RUN=1;
mkdir uploads
if [ `uname` = "Darwin" ]
then
stack build --copy-bins --local-bin-path ./artifacts;
sed -e "s/NPM_VERSION/$(./scripts/get-version)/g" -i "" npm/package.json ;
sed -e "s/PACKAGE_VERSION/$(./scripts/get-version)/g" -i "" npm/install.js ;
else
# We first build the static version
docker run --mount src="$(pwd)",target=/home/ubuntu/spago,type=bind "nilrecurring/haskell-lavello:${IMAGE_TAG}" /bin/bash -c "cd spago; stack build --copy-bins --flag spago:static --local-bin-path ./artifacts"
cp artifacts/spago spago
tar -zcvf "${TRAVIS_OS_NAME}-static.tar.gz" spago
# Then the dynamic one
docker run --mount src="$(pwd)",target=/home/ubuntu/spago,type=bind "nilrecurring/haskell-lavello:${IMAGE_TAG}" /bin/bash -c "cd spago; stack build --copy-bins --local-bin-path ./artifacts"
sed -e "s/NPM_VERSION/$(./scripts/get-version)/g" -i npm/package.json ;
sed -e "s/PACKAGE_VERSION/$(./scripts/get-version)/g" -i npm/install.js ;
fi
cp artifacts/spago spago
tar -zcvf "${TRAVIS_OS_NAME}.tar.gz" spago
for f in *.tar.gz; do mv "$f" uploads/; done
## Get ready to publish npm
cd npm
cp ../README.md ./README.md
cp ../CONTRIBUTING.md ./CONTRIBUTING.md
cp ../LICENSE ./LICENSE
fi
deploy:
- provider: releases
api_key: $API_KEY
target_commitish: master
file_glob: true
file: ../uploads/*
skip_cleanup: true
edge: true
on:
tags: true
script:
- echo 'done'
- provider: npm
email: "$NPM_EMAIL"
api_key: "$NPM_TOKEN"
skip_cleanup: true
edge: true
on:
condition: $TRAVIS_OS_NAME = osx
tags: true
script:
- echo 'done'