summaryrefslogtreecommitdiff
path: root/.github/workflows/main.yml
blob: 4e2b7c35f68dbb562100687cc7073d0a28db00b4 (plain)
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
# This Github Actions workflow is modified from
# https://kodimensional.dev/github-actions
name: 'CI'

# Trigger the workflow on push or pull request, but only for the master branch
on: [push, pull_request]

jobs:
  build:

    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]

    env:
      ARGS: --no-terminal --fast
      
    name: ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    
    steps:
    - uses: actions/checkout@v2
      if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'

    # https://github.com/actions/setup-haskell
    - uses: actions/setup-haskell@v1.1
      name: Setup Haskell Stack
      with:
        stack-version: "latest"
        enable-stack: true
        stack-no-global: true
    
    # https://github.com/actions/cache
    - uses: actions/cache@v2
      name: Cache ~/.stack
      with:
        path: ~/.stack
        key: ${{ runner.os }}-${{ hashFiles('stack.yaml') }}

    # There are strange problems with CI on Windows, where builds with GHC 8.8.*
    # always fail. Therefore, we distinguish between builds on Ubuntu and Windows
    # and use an older compiler on Windows.
    # See here for bug reports:
    #   https://gitlab.haskell.org/ghc/ghc/issues/17599
    #   https://gitlab.haskell.org/ghc/ghc/issues/17926
    
    - name: Test (Ubuntu)
      run: |
        stack test $ARGS --stack-yaml stack.yaml
      if: ${{ runner.os == 'Linux' }}

    - name: Test (Windows)
      run: |
        stack test $ARGS --stack-yaml stack.yaml --compiler ghc-8.6.5
      if: ${{ runner.os == 'Windows' }}