-
Notifications
You must be signed in to change notification settings - Fork 19
217 lines (211 loc) · 8 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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
name: Haskell CI
on:
workflow_call:
secrets:
MAESTRO_CONFIG:
description: 'Maestro config.'
required: true
BLOCKFROST_CONFIG:
description: 'Blockfrost config.'
required: true
PREPROD_SUBMIT_TEST_WALLET_SKEY:
description: 'Signing key for testing.'
required: true
outputs:
ATLAS_VERSION:
description: "ATLAS_VERSION"
value: ${{ jobs.build.outputs.ATLAS_VERSION }}
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-22.04
outputs:
ATLAS_VERSION: ${{ steps.get_atlas_version.outputs.ATLAS_VERSION }}
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Install dependencies (apt-get)
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
autoconf \
automake \
build-essential \
ca-certificates \
chrony \
dpkg-dev \
gcc \
gnupg \
g++ \
hlint \
libc6-dev \
libncursesw5 \
libffi-dev \
libgmp-dev \
liblzma-dev \
libnuma-dev \
libpq-dev \
libssl-dev \
libsystemd-dev \
libtinfo-dev \
libtool \
netbase \
pkg-config \
procps \
tmux \
xz-utils \
zlib1g-dev
- name: Validate code (run pre-commit hooks)
uses: pre-commit/[email protected]
with:
extra_args: --verbose --all-files
- name: Prepare config files
env:
MAESTRO_CONFIG: ${{secrets.MAESTRO_CONFIG}}
BLOCKFROST_CONFIG: ${{secrets.BLOCKFROST_CONFIG}}
PREPROD_SUBMIT_TEST_WALLET_SKEY: ${{secrets.PREPROD_SUBMIT_TEST_WALLET_SKEY}}
run: |
# MAESTRO_CONFIG ----------------------------------
echo "Creating maestro-config.json from MAESTRO_CONFIG env var..."
echo "$MAESTRO_CONFIG" >> maestro-config.json
if [[ -f maestro-config.json ]] ; then
echo "[OK] maestro-config.json has been created."
else
echo "[ERROR] maestro-config.json is missing."
exit 1
fi
# BLOCKFROST_CONFIG ----------------------------------
echo "Creating blockfrost-config.json from BLOCKFROST_CONFIG env var..."
echo "$BLOCKFROST_CONFIG" >> blockfrost-config.json
if [[ -f blockfrost-config.json ]] ; then
echo "[OK] blockfrost-config.json has been created."
else
echo "[ERROR] blockfrost-config.json is missing."
exit 1
fi
# PREPROD_SUBMIT_TEST_WALLET_SKEY ----------------------------------
echo "Creating preprod-submit-test-wallet.skey from PREPROD_SUBMIT_TEST_WALLET_SKEY env var..."
echo "$PREPROD_SUBMIT_TEST_WALLET_SKEY" >> preprod-submit-test-wallet.skey
if [[ -f preprod-submit-test-wallet.skey ]] ; then
echo "[OK] preprod-submit-test-wallet.skey has been created."
else
echo "[ERROR] preprod-submit-test-wallet.skey is missing."
exit 1
fi
stat maestro-config.json
stat blockfrost-config.json
stat preprod-submit-test-wallet.skey
- name: Setup haskell tooling
uses: haskell/actions/setup@v2
with:
ghc-version: '9.6.5'
cabal-version: '3.10.1.0'
enable-stack: true
stack-version: '2.9'
- name: Setup cache
uses: actions/cache@v3
env:
cache-name: cache-cabal
with:
path: ~/.cabal
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install LIBSODIUM
run: |
git clone https://github.com/input-output-hk/libsodium
cd libsodium
git checkout dbb48cc
./autogen.sh
./configure
make
sudo make install
sudo ldconfig
- name: Install SEPC256K1
run: |
git clone https://github.com/bitcoin-core/secp256k1
cd secp256k1
git checkout ac83be33d0956faf6b7f61a60ab524ef7d6a473a
./autogen.sh
./configure --prefix=/usr --enable-module-schnorrsig --enable-experimental
make
sudo make install
sudo ldconfig
- name: Install BLST
run: |
: ${BLST_VERSION:='v0.3.11'}
git clone --depth 1 --branch ${BLST_VERSION} https://github.com/supranational/blst
cd blst
./build.sh
cat > libblst.pc << EOF
prefix=/usr/local
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
includedir=\${prefix}/include
Name: libblst
Description: Multilingual BLS12-381 signature library
URL: https://github.com/supranational/blst
Version: ${BLST_VERSION#v}
Cflags: -I\${includedir}
Libs: -L\${libdir} -lblst
EOF
sudo cp libblst.pc /usr/local/lib/pkgconfig/
sudo cp bindings/blst_aux.h bindings/blst.h bindings/blst.hpp /usr/local/include/
sudo cp libblst.a /usr/local/lib
sudo chmod u=rw,go=r /usr/local/{lib/{libblst.a,pkgconfig/libblst.pc},include/{blst.{h,hpp},blst_aux.h}}
- name: Update dependencies (cabal)
run: cabal update
- name: Build dependencies (cabal)
run: cabal build --only-dependencies --enable-tests --enable-benchmarks
- name: Build all targets (cabal)
run: cabal build --enable-tests --enable-benchmarks all
- name: Install fourmolu
run: cabal install fourmolu --overwrite-policy=always
- name: Run checks (fourmolu)
run: git ls-files -z '*.hs' | xargs -P 12 -0 fourmolu --mode check
- name: Symlink cardano-node binaries
run: cabal install --package-env=$(pwd) --overwrite-policy=always cardano-cli cardano-node
- name: Run unified tests
run: cabal run atlas-unified-tests -- -j1 --hide-successes
- name: Run privnet tests
run: cabal run atlas-privnet-tests -- -j1 --hide-successes
# - name: Run all tests (cabal)
# run: cabal run atlas-tests -- -j1 --hide-successes
- name: Run doctest (docspec)
run: |
# Install docspec and run doctests.
echo "=========================[ INSTALL DOCSPEC ]========================"
echo " -> Started at $(date --iso-8601=seconds --utc)."
curl -sL https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20230517/cabal-docspec-0.0.0.20230517-x86_64-linux.xz > ./cabal-docspec.xz
xz -d < ./cabal-docspec.xz > ./cabal-docspec
rm -f ./cabal-docspec.xz
chmod a+x ./cabal-docspec
echo " -> Docspec has been installed."
echo "===========================[ RUN DOCSPEC ]==========================="
./cabal-docspec -q --ignore-trailing-space
echo " ============================[ FINISHED ]============================"
- name: Run checks (cabal)
run: cabal check
- name: Create source distribution file (cabal)
run: cabal sdist
- name: Identify atlas version (cabal)
id: get_atlas_version
run: |
export ATLAS_VERSION=$(cabal info . | awk '{print $2 ;exit}') ;
echo "ATLAS_VERSION: $ATLAS_VERSION"
echo "ATLAS_VERSION=${ATLAS_VERSION}" >> $GITHUB_ENV
echo "ATLAS_VERSION=${ATLAS_VERSION}" >> $GITHUB_OUTPUT
- name: Generate documentation (cabal haddock)
run: cabal haddock --html --hyperlink-source --haddock-options="--use-unicode" --haddock-quickjump
- name: Upload haddock documentation
uses: actions/[email protected]
with:
path: ./dist-newstyle/build/x86_64-linux/ghc-9.6.5/${{env.ATLAS_VERSION}}/doc/html/atlas-cardano/
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: source-distribution-file
path: ./dist-newstyle/sdist/${{env.ATLAS_VERSION}}.tar.gz