-
Notifications
You must be signed in to change notification settings - Fork 156
150 lines (118 loc) · 4.24 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
name: Haskell CI
on: [push]
jobs:
build:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
ghc: ["8.10.4"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v1
- name: Install pkgconfiglite (Windows)
if: matrix.os == 'windows-latest'
run: choco install -y pkgconfiglite
- name: Set up Ruby 2.6
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6
- name: Install cbor-diag and cddl
run: |
gem install cddl -v 0.8.15
gem install cbor-diag
- name: Install libsodium (MacOS)
if: matrix.os == 'macos-latest'
run: brew install libsodium
- name: Install libsodium (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get -y install libsodium23 libsodium-dev
sudo apt-get -y remove --purge software-properties-common
sudo apt-get -y autoremove
- name: Install libsodium (Windows)
if: matrix.os == 'windows-latest'
run: |
curl -Ls https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-mingw.tar.gz -o libsodium-1.0.18-mingw.tar.gz
tar zxvf libsodium-1.0.18-mingw.tar.gz
sed -i "s|/d/a/1/s/|D:/a/cardano-node/cardano-node/|g" libsodium-win64/lib/pkgconfig/libsodium.pc
export PKG_CONFIG_PATH="$(readlink -f libsodium-win64/lib/pkgconfig)"
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV
export LIBSODIUM_PATH="$(readlink -f libsodium-win64/bin | sed 's|^/d|D:|g' | tr / '\\')"
echo "LIBSODIUM_PATH=$LIBSODIUM_PATH"
echo "$LIBSODIUM_PATH" >> $GITHUB_PATH
- uses: haskell/actions/setup@v1
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: 3.4.0.0
- name: Patch GHC 8.10.2 linker
if: matrix.os == 'windows-latest'
run: |
sed -i \
's|C:/GitLabRunner/builds/2WeHDSFP/0/ghc/ghc/inplace/mingw/bin/ld.exe|C:/ProgramData/chocolatey/lib/ghc.8.10.2/tools/ghc-8.10.2/mingw/bin/ld.exe|g' \
C:/ProgramData/chocolatey/lib/ghc.8.10.2/tools/ghc-8.10.2/lib/settings
- name: Configure to use libsodium
run: |
cat >> cabal.project <<EOF
package cardano-crypto-praos
flags: -external-libsodium-vrf
EOF
- name: Cabal update
run: cabal update
- name: Cabal Configure
run: cabal configure --enable-tests --enable-benchmarks --write-ghc-environment-files=always
- uses: actions/cache@v2
if: matrix.os != 'macos-latest'
name: Cache cabal store
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist
key: cache-${{ runner.os }}-${{ matrix.ghc }}-v1-${{ hashFiles('cabal-cache.cabal') }}-${{ github.sha }}
restore-keys: cache-${{ runner.os }}-${{ matrix.ghc }}-v1-${{ hashFiles('cabal-cache.cabal') }}-
- name: Install cabal-docspec
run: |
git clone https://github.com/phadej/cabal-extras
( cd cabal-extras
grep -v with-compiler cabal.project > cabal.project.out
mv cabal.project.out cabal.project
cd cabal-docspec
cabal install cabal-docspec
)
rm -rf cabal-extras
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
- name: Install dependencies
run: cabal build all --only-dependencies
- name: Build
run: cabal build all
- name: Run doctests
run: cabal-docspec
- name: Git clone
run: git clone https://github.com/input-output-hk/cardano-mainnet-mirror
- name: Run tests
run: |
export CARDANO_MAINNET_MIRROR="$(pwd)/cardano-mainnet-mirror/epochs"
cabal test all
ormolu:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v1
- name: Install ormolu
run: |
mkdir -p "$HOME/.local/bin"
curl -sL https://github.com/tweag/ormolu/releases/download/0.1.4.1/ormolu-Linux -o "$HOME/.local/bin/ormolu"
chmod a+x "$HOME/.local/bin/ormolu"
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Run ormolu
run: ./scripts/ormolise.sh