forked from IntersectMBO/cardano-ledger
-
Notifications
You must be signed in to change notification settings - Fork 0
192 lines (152 loc) · 4.97 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: Haskell CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "**" ]
schedule:
# "Nightly" builds: Every day at 06:00 UTC
- cron: '0 6 * * *'
jobs:
build:
runs-on: ${{ matrix.os }}
env:
# Modify this value to "invalidate" the cabal cache.
CABAL_CACHE_VERSION: "2023-02-14"
# current ref from: 27.02.2022
SECP256K1_REF: ac83be33d0956faf6b7f61a60ab524ef7d6a473a
SECP_CACHE_VERSION: "2022-12-30"
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
ghc: ["8.10.7", "9.2.6"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Set NIGHTLY environment variable if the job was triggered by the scheduler
if: ${{ github.event_name == 'schedule' }}
run: |
echo "NIGHTLY=true" >> $GITHUB_ENV
- name: Set up Ruby 2.7
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Install cbor-diag and cddl
run: |
gem install cddl -v 0.8.15
gem install cbor-diag
- name: Install libsodium
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
# Workaround the issue on GA Ubuntu images:
# https://github.com/actions/runner-images/issues/7061
- name: Fixup ghcup
run: |
rm -f /usr/local/.ghcup/cache/ghcup-0.0.7.yaml*
sudo chown -R $USER /usr/local/.ghcup
- name: Install Haskell
uses: input-output-hk/setup-haskell@v1
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: latest
- name: Install secp256k1
uses: input-output-hk/setup-secp256k1@v1
with:
git-ref: ${{ env.SECP256K1_REF }}
cache-version: ${{ env.SECP_CACHE_VERSION }}
- 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@v3
if: matrix.os != 'macos-latest'
name: Cache cabal store
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
# cache is invalidated upon a change to cabal.project (and/or cabal.project.local), a bump to
# CABAL_CACHE_VERSION or after a week of inactivity
key: cache-${{ runner.os }}-${{ matrix.ghc }}-${{ env.CABAL_CACHE_VERSION }}-${{ hashFiles('cabal.project*') }}
# Restoring attempts are from current branch then master
restore-keys: |
cache-${{ runner.os }}-${{ matrix.ghc }}-${{ env.CABAL_CACHE_VERSION }}-${{ hashFiles('cabal.project*') }}
- name: Install dependencies
run: cabal build all --only-dependencies
- name: Build
run: cabal build all
- name: Download Mainnet Mirror
run: |
REF=a31ac75
curl -L https://github.com/input-output-hk/cardano-mainnet-mirror/tarball/$REF -o mainnet-mirror.tgz
tar -xzf mainnet-mirror.tgz
mv input-output-hk-cardano-mainnet-mirror-$REF/epochs .
- name: Run tests
run: |
export CARDANO_MAINNET_MIRROR="$(pwd)/epochs"
cabal test all
fourmolu:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Install fourmolu
run: |
mkdir -p "$HOME/.local/bin"
curl -sL https://github.com/fourmolu/fourmolu/releases/download/v0.10.1.0/fourmolu-0.10.1.0-linux-x86_64 -o "$HOME/.local/bin/fourmolu"
chmod a+x "$HOME/.local/bin/fourmolu"
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Run fourmolu
run: ./scripts/fourmolize.sh
cabal-format:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Format all cabal files
run: ./scripts/cabal-format.sh
gen-hie:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
steps:
- name: Cache implicit-hie executable (gen-hie)
id: cache-gen-hie
uses: actions/cache@v3
with:
path: |
~/.cabal/bin/gen-hie
key: ${{ runner.os }}-cache-gen-hie
- name: Install gen-hie if not cached
if: steps.cache-gen-hie.outputs.cache-hit != 'true'
run: cabal update && cabal install implicit-hie --install-method=copy --overwrite-policy=always
- name: Add cabal-bin to PATH
run: echo "$HOME/.cabal/bin" >> $GITHUB_PATH
- uses: actions/checkout@v3
- name: Regenerate hie.yaml and confirm that it is in sync
run: ./scripts/gen-hie.sh