Skip to content

Commit 751227f

Browse files
authored
Merge pull request #86 from jswebtools/travis
Add Travis build
2 parents aad931e + 19610eb commit 751227f

7 files changed

Lines changed: 50 additions & 162 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
*.class
55
.DS_Store
66
/webbits
7+
dist*
8+
*~
9+
result

.travis.yml

Lines changed: 11 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -1,160 +1,17 @@
1-
# New travis config by FPComplete/Michael Snoyman
1+
language: nix
22

3-
# Use new container infrastructure to enable caching
4-
sudo: false
5-
6-
# Choose a lightweight base image; we provide our own build tools.
7-
language: c
8-
9-
# Caching so the next build will be fast too.
10-
cache:
11-
directories:
12-
- $HOME/.ghc
13-
- $HOME/.cabal
14-
- $HOME/.stack
15-
16-
# The different configurations we want to test. We have BUILD=cabal which uses
17-
# cabal-install, and BUILD=stack which uses Stack. More documentation on each
18-
# of those below.
19-
#
20-
# We set the compiler values here to tell Travis to use a different
21-
# cache file per set of arguments.
22-
#
23-
# If you need to have different apt packages for each combination in the
24-
# matrix, you can use a line such as:
25-
# addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
263
matrix:
4+
fast_finish: true
275
include:
28-
# We grab the appropriate GHC and cabal-install versions from hvr's PPA. See:
29-
# https://github.com/hvr/multi-ghc-travis
30-
# - env: BUILD=cabal GHCVER=7.0.4 CABALVER=1.16
31-
# compiler: ": #GHC 7.0.4"
32-
# addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.4], sources: [hvr-ghc]}}
33-
# - env: BUILD=cabal GHCVER=7.2.2 CABALVER=1.16
34-
# compiler: ": #GHC 7.2.2"
35-
# addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.2], sources: [hvr-ghc]}}
36-
- env: BUILD=cabal GHCVER=7.4.2 CABALVER=1.16
37-
compiler: ": #GHC 7.4.2"
38-
addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2], sources: [hvr-ghc]}}
39-
- env: BUILD=cabal GHCVER=7.6.3 CABALVER=1.16
40-
compiler: ": #GHC 7.6.3"
41-
addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3], sources: [hvr-ghc]}}
42-
- env: BUILD=cabal GHCVER=7.8.4 CABALVER=1.18
43-
compiler: ": #GHC 7.8.4"
44-
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
45-
- env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22
46-
compiler: ": #GHC 7.10.3"
47-
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}}
48-
- env: BUILD=cabal GHCVER=8.0.2 CABALVER=1.24
49-
compiler: ": #GHC 8.0.2"
50-
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2], sources: [hvr-ghc]}}
51-
52-
# Build with the newest GHC and cabal-install. This is an accepted failure,
53-
# see below.
54-
- env: BUILD=cabal GHCVER=head CABALVER=head
55-
compiler: ": #GHC HEAD"
56-
addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}}
57-
58-
# The Stack builds. We can pass in arbitrary Stack arguments via the ARGS
59-
# variable, such as using --stack-yaml to point to a different file.
60-
# - env: BUILD=stack ARGS="--resolver lts-2"
61-
# compiler: ": #stack 7.8.4"
62-
# addons: {apt: {packages: [ghc-7.8.4], sources: [hvr-ghc]}}
63-
64-
# - env: BUILD=stack ARGS="--resolver lts-3"
65-
# compiler: ": #stack 7.10.2"
66-
# addons: {apt: {packages: [ghc-7.10.2], sources: [hvr-ghc]}}
67-
68-
- env: BUILD=stack ARGS="--resolver lts-5"
69-
compiler: ": #stack 7.10.3"
70-
addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}}
71-
72-
- env: BUILD=stack ARGS="--resolver lts-6"
73-
compiler: ": #stack 7.10.3"
74-
addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}}
75-
76-
- env: BUILD=stack ARGS="--resolver lts-7"
77-
compiler: ": #stack 8.0.1"
78-
addons: {apt: {packages: [ghc-8.0.1], sources: [hvr-ghc]}}
79-
80-
- env: BUILD=stack ARGS="--resolver lts-8"
81-
compiler: ": #stack 8.0.2"
82-
addons: {apt: {packages: [ghc-8.0.2], sources: [hvr-ghc]}}
83-
84-
# Nightly builds are allowed to fail
85-
- env: BUILD=stack ARGS="--resolver nightly"
86-
compiler: ": #stack nightly"
87-
addons: {apt: {packages: [libgmp-dev]}}
88-
89-
# Build on OS X in addition to Linux
90-
# - env: BUILD=stack ARGS="--resolver lts-2"
91-
# compiler: ": #stack 7.8.4 osx"
92-
# os: osx
93-
94-
# - env: BUILD=stack ARGS="--resolver lts-3"
95-
# compiler: ": #stack 7.10.2 osx"
96-
# os: osx
97-
98-
- env: BUILD=stack ARGS="--resolver lts-5"
99-
compiler: ": #stack 7.10.3 osx"
100-
os: osx
101-
102-
- env: BUILD=stack ARGS="--resolver nightly"
103-
compiler: ": #stack nightly osx"
104-
os: osx
105-
6+
- env: GHCVER=ghc844
7+
- env: GHCVER=ghc865
8+
- env: GHCVER=ghc881
9+
- env: GHCVER=ghc882
10+
- env: GHCVER=ghc8101
11+
- env: GHCVER=ghcHEAD
10612
allow_failures:
107-
- env: BUILD=cabal GHCVER=head CABALVER=head
108-
- env: BUILD=stack ARGS="--resolver nightly"
109-
110-
before_install:
111-
# Using compiler above sets CC to an invalid value, so unset it
112-
- unset CC
113-
114-
# We want to always allow newer versions of packages when building on GHC HEAD
115-
- CABALARGS=""
116-
- if [ "x$GHCVER" = "xhead" ]; then CABALARGS=--allow-newer; fi
117-
118-
# Download and unpack the stack executable
119-
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:$PATH
120-
- mkdir -p ~/.local/bin
121-
- |
122-
if [ `uname` = "Darwin" ]
123-
then
124-
curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
125-
else
126-
curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
127-
fi
128-
129-
install:
130-
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
131-
- if [ -f configure.ac ]; then autoreconf -i; fi
132-
- |
133-
case "$BUILD" in
134-
stack)
135-
stack --no-terminal --install-ghc $ARGS build --only-dependencies --test
136-
;;
137-
cabal)
138-
cabal --version
139-
travis_retry cabal update
140-
cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS
141-
;;
142-
esac
13+
- env: GHCVER=ghc8101
14+
- env: GHCVER=ghcHEAD
14315

14416
script:
145-
- |
146-
case "$BUILD" in
147-
stack)
148-
stack --no-terminal $ARGS test --haddock --no-haddock-deps
149-
;;
150-
cabal)
151-
cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options="-O0 -Werror"
152-
cabal build
153-
cabal check || [ "$CABALVER" == "1.16" ]
154-
cabal test
155-
cabal sdist
156-
cabal copy
157-
SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && \
158-
(cd dist && cabal install --force-reinstalls "$SRC_TGZ")
159-
;;
160-
esac
17+
- nix-build -A language-ecmascript --argstr compiler $GHCVER

default.nix

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
with (builtins.fromJSON (builtins.readFile ./nixpkgs.json));
2+
{ pkgs ? import (builtins.fetchTarball {
3+
url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
4+
inherit sha256;
5+
}) {}
6+
, compiler ? "ghc881"
7+
}:
8+
let
9+
overrides = self: super: { Diff = self.Diff_0_4_0; };
10+
ghc = pkgs.haskell.packages.${compiler}.override { inherit overrides; };
11+
language-ecmascript = ghc.callCabal2nix "language-ecmascript" ./. {};
12+
in
13+
{
14+
inherit language-ecmascript;
15+
inherit pkgs;
16+
}

language-ecmascript.cabal

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ Test-Suite test
7272
Type: exitcode-stdio-1.0
7373
Main-Is: TestMain.hs
7474
Other-Modules:
75-
Language.ECMAScript3.Lexer
76-
Language.ECMAScript3.Parser
77-
Language.ECMAScript3.Parser.State
78-
Language.ECMAScript3.Parser.Type
79-
Language.ECMAScript3.PrettyPrint
80-
Language.ECMAScript3.SourceDiff
81-
Language.ECMAScript3.Syntax
82-
Language.ECMAScript3.Syntax.Annotations
75+
Language.ECMAScript3.Lexer
76+
Language.ECMAScript3.Parser
77+
Language.ECMAScript3.Parser.State
78+
Language.ECMAScript3.Parser.Type
79+
Language.ECMAScript3.PrettyPrint
80+
Language.ECMAScript3.SourceDiff
81+
Language.ECMAScript3.Syntax
82+
Language.ECMAScript3.Syntax.Annotations
8383
Language.ECMAScript3.Syntax.Arbitrary
8484
Test.Diff
8585
Test.Unit

nixpkgs.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{ "rev" : "8130f3c1c2bb0e533b5e150c39911d6e61dcecc2"
2+
, "sha256" : "154nrhmm3dk5kmga2w5f7a2l6j79dvizrg4wzbrcwlbvdvapdgkb"
3+
}

shell.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(import ./default.nix {}).language-ecmascript.env

upload.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
with (import ./default.nix {});
2+
with pkgs.haskell.lib;
3+
let
4+
tarball = sdistTarball language-ecmascript;
5+
in
6+
pkgs.writeScriptBin "upload" ''
7+
${pkgs.cabal-install}/bin/cabal upload ${tarball}/*.tar.gz --publish
8+
''

0 commit comments

Comments
 (0)