diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..e2581a9 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -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 < 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 diff --git a/.travis.yml b/.travis.yml index 72eb31c..af7bc7b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/.travis/deploy b/.travis/deploy index 7e6fd73..783e07f 100755 --- a/.travis/deploy +++ b/.travis/deploy @@ -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 diff --git a/.travis/doctest b/.travis/doctest deleted file mode 100755 index 835667c..0000000 --- a/.travis/doctest +++ /dev/null @@ -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" diff --git a/.travis/lint b/.travis/lint deleted file mode 100755 index d18f9a5..0000000 --- a/.travis/lint +++ /dev/null @@ -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 diff --git a/.travis/lts-9.0.yaml b/.travis/lts-9.0.yaml deleted file mode 100644 index 854fc1a..0000000 --- a/.travis/lts-9.0.yaml +++ /dev/null @@ -1,11 +0,0 @@ -resolver: lts-9.0 - -packages: -- concurrency -- dejafu -- dejafu-tests -- hunit-dejafu -- tasty-dejafu - -extra-deps: -- hedgehog-0.5.2 diff --git a/.travis/setup.sh b/.travis/setup.sh deleted file mode 100644 index 1cece56..0000000 --- a/.travis/setup.sh +++ /dev/null @@ -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 diff --git a/.travis/test b/.travis/test deleted file mode 100755 index 2005143..0000000 --- a/.travis/test +++ /dev/null @@ -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