forked from commercialhaskell/stack
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (98 loc) · 2.89 KB
/
unit-tests.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
name: Unit tests
on:
pull_request:
push:
branches:
- master
- stable
- rc/**
workflow_dispatch:
jobs:
style:
name: Style
runs-on: ubuntu-latest
steps:
- name: Clone project
uses: actions/checkout@v2
- name: hlint
run: |
set -ex
./etc/scripts/get-hlint.sh
export PATH="$(pwd)"/hlint:$PATH
hlint src/
hlint src/ --cpp-define=WINDOWS=1
hlint test/ --cpp-simple
pedantic:
name: Pedantic
runs-on: ubuntu-latest
steps:
- name: Clone project
uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.stack
key: ${{ runner.os }}-${{ hashFiles('stack.yaml') }}
restore-keys: |
${{ runner.os }}-
- name: Pedantic build
run: stack --system-ghc build --pedantic
unit-tests:
name: Unit tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
stack-yaml: stack-ghc-88.yaml
extra-suffix: ""
stack-args: ""
- os: ubuntu-latest
stack-yaml: stack-ghc-810.yaml
extra-suffix: ""
stack-args: ""
- os: ubuntu-latest
stack-yaml: stack-nightly.yaml
extra-suffix: ""
stack-args: ""
- os: ubuntu-latest
stack-yaml: stack.yaml
extra-suffix: "alpine"
stack-args: "--docker --system-ghc --no-install-ghc --flag stack:static"
- os: windows-latest
stack-yaml: stack.yaml
extra-suffix: ""
stack-args: ""
- os: macos-latest
stack-yaml: stack.yaml
extra-suffix: ""
stack-args: ""
steps:
- name: Clone project
uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.stack
key: ${{ runner.os }}-${{ hashFiles( matrix.stack-yaml ) }}-${{ matrix.extra-suffix }}
- shell: bash
run: |
set -ex
stack upgrade || curl -sSL https://get.haskellstack.org/ | sh -s - -f
stack test ${{ matrix.stack-args }} --haddock --no-haddock-deps --ghc-options="-Werror" --copy-bins --local-bin-path bin
# Get output about whether the exe is dynamically linked
if [[ "${{ matrix.os }}" == "macos-latest" ]]
then
echo "Skipping ldd check on Mac"
elif [[ "${{ matrix.os }}" == "windows-latest" ]]
then
echo "Skipping ldd check on Windows"
elif [[ "${{ matrix.extra-suffix }}" == "alpine" ]]
then
# ldd returns exit code 1 if it's static, so failure is success
(ldd ./bin/stack && exit 1) || true
else
ldd ./bin/stack
fi
./bin/stack --version