-
Notifications
You must be signed in to change notification settings - Fork 6
164 lines (137 loc) · 5.36 KB
/
haskell.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Haskell CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
hlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run hlint
run: curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s -- -r src mem bench test
shell: bash
build-cabal:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, macOS, windows]
builder: ['cabal 3.6.2.0 ghc 8.10.7', 'cabal 3.6.2.0 ghc 9.0.1', 'stack 2.7.3']
include:
- os: windows
shell: msys2 {0}
- os: ubuntu
shell: bash
- os: macOS
shell: bash
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- uses: actions/checkout@v2
- if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
update: true
install: >-
gawk
base-devel
bzip2
ca-certificates
curl
git
gzip
make
mingw-w64-x86_64-pkgconf
wget
xz
# this action is broken shite: https://github.com/msys2/setup-msys2/issues/104
path-type: inherit
- id: get
run: |
builder=$(echo ${{ matrix.builder }} | awk '{ print $1 }')
builder_version=$(echo ${{ matrix.builder }} | awk '{ print $2 }')
ghc_version=$(echo ${{ matrix.builder }} | awk '{ print $4 }')
echo "::set-output name=builder::$builder"
echo "::set-output name=builder_version::$builder_version"
echo "::set-output name=ghc_version::$ghc_version"
shell: bash
- if: matrix.os == 'windows'
name: Install ghcup on windows
run: |
Set-Location -Path "$env:temp"
curl.exe -O "https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1"
.\bootstrap-haskell.ps1 -Minimal -InBash -ExistingMsys2Dir C:\msys64 -InstallDir C:\
shell: pwsh
- if: matrix.os != 'windows'
name: Install ghcup on Linux/macOS
run: curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_MINIMAL=1 sh
- if: matrix.os == 'windows'
name: Add ghcup to PATH on windows
run: echo "/c/ghcup/bin" >> $GITHUB_PATH
- name: Install ghc/cabal
run: |
[ -n "${{ steps.get.outputs.ghc_version }}" ] && ghcup install ghc ${{ steps.get-ghc-ver.outputs.id }}
[ -n "${{ steps.get.outputs.ghc_version }}" ] && ghcup set ghc ${{ steps.get-ghc-ver.outputs.id }}
ghcup install ${{ steps.get.outputs.builder }} ${{ steps.get.outputs.builder_version }}
- name: Cache
uses: actions/cache@v1
env:
cache-name: ${{ steps.get.outputs.builder }}
with:
path: ~/.${{ steps.get.outputs.builder }}
key: ${{ matrix.os }}-${{ matrix.builder }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.builder }}-build-${{ env.cache-name }}-
${{ matrix.os }}-${{ matrix.builder }}-build-
${{ matrix.os }}-${{ matrix.builder }}-
${{ matrix.os }}-
- name: Update cabal/stack index
run: |
if [ "${{ steps.get.outputs.builder }}" = "stack" ] ; then
mkdir -p ~/.stack
echo 'skip-msys: true' >> ~/.stack/config.yaml
echo -e 'extra-include-dirs:\n- "/c/msys64/mingw64/include"' >> ~/.stack/config.yaml
echo -e 'extra-lib-dirs:\n- "/c/msys64/mingw64/lib"' >> ~/.stack/config.yaml
echo -e 'extra-path:\n- "/c/msys64/usr/bin"\n- "/c/msys64/mingw64/bin"' >> ~/.stack/config.yaml
fi
${{ steps.get.outputs.builder }} update
- if: matrix.os == 'linux' && steps.get.outputs.builder == 'cabal'
name: Install cabal-docspec
run: |
mkdir -p "$HOME/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
curl -sL https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20210111/cabal-docspec-0.0.0.20210111.xz > cabal-docspec.xz
echo '0829bd034fba901cbcfe491d98ed8b28fd54f9cb5c91fa8e1ac62dc4413c9562 cabal-docspec.xz' | sha256sum -c -
xz -d < cabal-docspec.xz > "$HOME/.local/bin/cabal-docspec"
rm -f cabal-docspec.xz
chmod a+x "$HOME/.local/bin/cabal-docspec"
- if: matrix.os == 'windows'
name: Set cabal.project.local
run: |
echo -e 'package libarchive\n flags: -system-libarchive -no-exe' >> cabal.project.local
- if: matrix.os != 'windows'
name: Set cabal.project.local
run: |
echo -e 'package libarchive\n flags: -no-exe' >> cabal.project.local
- name: Build
run: ${{ steps.get.outputs.builder }} build
- name: Run tests
run: ${{ steps.get.outputs.builder }} test
- if: matrix.os == 'linux' && steps.get.outputs.builder == 'cabal'
name: Run doctests
run: cabal-docspec -XCPP -XTypeSynonymInstances -XOverloadedStrings
- name: Download benchmark files
run: make -j1 setup
- name: Run benches
run: ${{ steps.get.outputs.builder }} bench
- name: Build haddock
run: ${{ steps.get.outputs.builder }} haddock
continue-on-error: true
- if: always()
uses: actions/upload-artifact@v2
with:
name: plan.json
path: ./dist-newstyle/cache/plan.json