forked from j-mueller/sc-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
151 lines (133 loc) · 4.83 KB
/
ci-linux.yaml
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
name: ci-linux
on:
pull_request:
push:
paths:
- '.github/workflows/ci-linux.yaml'
- 'cabal.project'
- '*/src/**'
# INFO: The following configuration block ensures that only one build runs per branch,
# which may be desirable for projects with a costly build process.
# Remove this block from the CI workflow to let each CI job run to completion.
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
# install deps.
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libsystemd-dev
# cache libsodium
- name: cache libsodium-1.0.18
id: libsodium
uses: actions/cache@v3
with:
path: ~/libsodium-stable
key: ${{ runner.os }}-libsodium-1.0.18
# install libsodium with cache
- name: Install cache libsodium-1.0.18
if: steps.libsodium.outputs.cache-hit == 'true'
run: cd ~/libsodium-stable && ./configure && make -j2 && sudo make install
# download & install libsodium without cache
- name: Install libsodium
if: steps.libsodium.outputs.cache-hit != 'true'
run: |
wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable.tar.gz
tar -xvzf libsodium-1.0.18-stable.tar.gz -C ~
cd ~/libsodium-stable
./configure
make -j2 && make check
sudo make install
cd -
# cache secp256K1
- name: cache libsecp256k1
id: libsecp256k1
uses: actions/cache@v3
with:
path: ~/secp256k1
key: libsecp256k1
# install libsecp256k1 with cache
- name: Install cache libsecp256k1
if: steps.libsecp256k1.outputs.cache-hit == 'true'
run: |
cd ~/secp256k1
./autogen.sh
./configure --enable-module-schnorrsig --enable-experimental
make
sudo make install
cd -
# download & install secp256k1 without cache
- name: Install libsecp256k1
if: steps.libsecp256k1.outputs.cache-hit != 'true'
run: |
git clone https://github.com/bitcoin-core/secp256k1 ~/secp256k1
cd ~/secp256k1
git checkout ac83be33
./autogen.sh
./configure --enable-module-schnorrsig --enable-experimental
make
sudo make install
cd -
# set up environment variables
- name: Setup environment variables
run: |
echo "LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV
- uses: actions/checkout@v4
- uses: haskell-actions/setup@v2
id: setup
with:
ghc-version: '8.10' # Resolves to the latest point release of GHC 8.10
cabal-version: '3.6.0.0' # Exact version of Cabal
# TODO document why this is after the previous step
- name: Set up cabal.project.local
run: |
echo "package cardano-crypto-praos" > cabal.project.local
echo " flags: -external-libsodium-vrf" >> cabal.project.local
- name: Configure the build
run: |
cabal configure --enable-tests --enable-documentation
# The step generates dist-newstyle/cache/plan.json for the cache key.
cabal build all --dry-run
- name: Restore cached dependencies (todo name)
uses: actions/cache@v3
id: cache
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ hashFiles('**/plan.json') }}
- name: Install dependencies
# If we had an exact cache hit, the dependencies will be up to date.
if: steps.cache.outputs.cache-hit != 'true'
run: cabal build all --only-dependencies
test:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/setup@v2
id: setup
with:
ghc-version: '8.10'
cabal-version: '3.6.0.0'
- name: Configure the build
run: |
cabal configure --enable-tests --enable-documentation
# The step generates dist-newstyle/cache/plan.json for the cache key.
cabal build all --dry-run
- name: cached dependencies
uses: actions/cache@v3
id: cache
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ hashFiles('**/plan.json') }}
- name: Build dependencies for integration test
run: |
cabal install -j cardano-node cardano-cli --overwrite-policy=always
cabal install -j convex-wallet --overwrite-policy=always
echo "/home/runner/.cabal/bin" >> $GITHUB_PATH
- name: Test all
run: cabal test all