Use GitHub actions for CI

This commit is contained in:
Michael Walker 2020-05-14 14:29:30 +01:00
parent f3c57ea7f9
commit 85314e4bd7
8 changed files with 96 additions and 102 deletions

87
.github/workflows/ci.yaml vendored Normal file
View File

@ -0,0 +1,87 @@
name: Run tests
on: pull_request
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: mstksg/setup-stack@v1
- name: Setup
run: |
stack --no-terminal install stylish-haskell hlint
- name: Lint
run: |
set -ex
stack --no-terminal exec ./lint.sh
stack --no-terminal exec ./style.sh
git diff --exit-code
doctest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: mstksg/setup-stack@v1
- name: Setup
run: |
set -ex
stack --no-terminal setup
stack --no-terminal install doctest
- name: Build
run: |
stack --no-terminal build
- name: Test
run: |
stack --no-terminal exec -- bash -c "DEJAFU_DOCTEST=y doctest dejafu/Test"
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
resolver:
- lts-9.0 # ghc-8.0
- lts-10.0 # ghc-8.2
- lts-12.0 # ghc-8.4
- lts-13.3 # ghc-8.6
- lts-15.0 # ghc-8.8
steps:
- uses: actions/checkout@v2
- uses: mstksg/setup-stack@v1
- name: Setup
env:
RESOLVER: ${{ matrix.resolver }}
run: |
set -ex
if [[ "$RESOLVER" == "lts-9.0" ]]; then
# need an old stack version to build happy
curl -L https://github.com/commercialhaskell/stack/releases/download/v1.6.1/stack-1.6.1-linux-x86_64.tar.gz | \
tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
# need hedgehog-0.5.2
cat <<EOF > stack.yaml
resolver: lts-9.0
packages:
- concurrency
- dejafu
- dejafu-tests
- hunit-dejafu
- tasty-dejafu
extra-deps:
- hedgehog-0.5.2
EOF
else
stack --no-terminal init --resolver="$RESOLVER" --force
fi
stack --no-terminal setup
- name: Build
run: |
stack --no-terminal build --ghc-options="-Werror -Wno-unused-imports"
- name: Test
run: |
cd dejafu-tests
stack --no-terminal exec -- dejafu-tests +RTS -s

View File

@ -8,13 +8,6 @@ language: c
# commit.
if: tag IS blank
# Cache builds
cache:
directories:
- $HOME/.ghc
- $HOME/.cabal
- $HOME/.stack
addons:
apt:
packages:
@ -27,35 +20,7 @@ env:
script: ./.travis/$MODE
jobs:
allow_failures:
- env: MODE=test RESOLVER=nightly
include:
# don't build the tests for both the commit and the PR
- stage: test
if: type != pull_request
env: MODE=doctest
- stage: test
if: type != pull_request
env: MODE=lint
- stage: test
if: type != pull_request
env: MODE=test RESOLVER=lts-9.0 STACKVER=1.6.1 # GHC 8.0
- stage: test
if: type != pull_request
env: MODE=test RESOLVER=lts-10.0 STACKVER=1.6.1 # GHC 8.2
- stage: test
if: type != pull_request
env: MODE=test RESOLVER=lts-12.0 STACKVER=1.7.1 # GHC 8.4
- stage: test
if: type != pull_request
env: MODE=test RESOLVER=lts-13.3 STACKVER=1.9.3 # GHC 8.6 - .3 because hedgehog and stylish-haskell aren't in .0
- stage: test
if: type != pull_request
env: MODE=test RESOLVER=lts-15.0 STACKVER=2.1.3 # GHC 8.8
- stage: test
if: type != pull_request
env: MODE=test RESOLVER=nightly
- stage: predeploy
if: branch=master
env: MODE=predeploy

View File

@ -1,6 +1,14 @@
#!/usr/bin/env bash
source .travis/setup.sh
export PATH=$HOME/.local/bin:$PATH
stack="stack --no-terminal"
mkdir -p ~/.local/bin
curl -L https://www.stackage.org/stack/linux-x86_64 | \
tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
$stack setup
# do not echo hackage password!
set +x

View File

@ -1,9 +0,0 @@
#!/usr/bin/env bash
source .travis/setup.sh
$stack install doctest
$stack build
$stack exec -- bash -c "DEJAFU_DOCTEST=y doctest dejafu/Test"

View File

@ -1,13 +0,0 @@
#!/usr/bin/env bash
source .travis/setup.sh
$stack install stylish-haskell
$stack build
#curl -sL https://raw.github.com/ndmitchell/weeder/master/misc/travis.sh | sh -s .
curl -sL https://raw.github.com/ndmitchell/hlint/master/misc/travis.sh | sh -s .
$stack exec ./style.sh
git diff --exit-code

View File

@ -1,11 +0,0 @@
resolver: lts-9.0
packages:
- concurrency
- dejafu
- dejafu-tests
- hunit-dejafu
- tasty-dejafu
extra-deps:
- hedgehog-0.5.2

View File

@ -1,25 +0,0 @@
#!/usr/bin/env bash
set -ex
export PATH=$HOME/.local/bin:$PATH
stack="stack --no-terminal"
mkdir -p ~/.local/bin
if [[ -z "$STACKVER" ]]; then
curl -L https://www.stackage.org/stack/linux-x86_64 | \
tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
else
curl -L https://github.com/commercialhaskell/stack/releases/download/v$STACKVER/stack-$STACKVER-linux-x86_64.tar.gz | \
tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
fi
if [[ -e ".travis/$RESOLVER.yaml" ]]; then
mv ".travis/$RESOLVER.yaml" stack.yaml
elif [[ ! -z "$RESOLVER" ]]; then
$stack init --resolver="$RESOLVER" --force
fi
$stack setup

View File

@ -1,8 +0,0 @@
#!/usr/bin/env bash
source .travis/setup.sh
$stack build --ghc-options="-Werror -Wno-unused-imports"
cd dejafu-tests
$stack exec -- dejafu-tests +RTS -s