-
Notifications
You must be signed in to change notification settings - Fork 370
239 lines (210 loc) · 7.24 KB
/
ci.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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
env:
# Tag for cache invalidation
CACHE_VERSION: v7
jobs:
build:
name: Build Echidna on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
container: ${{ fromJSON(matrix.container || '{"image":null}') }}
strategy:
matrix:
include:
- os: ubuntu-20.04
shell: bash
container: "{\"image\": \"elopeztob/alpine-haskell-stack-echidna:ghc-9.6.5\", \"options\": \"--user 1001\"}"
- os: macos-13 # x86_64 macOS
shell: bash
- os: windows-latest
shell: msys2 {0}
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Get Packages (macOS)
if: runner.os == 'macOS'
run: brew install automake
- name: Get Packages (Windows)
uses: msys2/setup-msys2@v2
if: runner.os == 'Windows'
with:
msystem: CLANG64
path-type: minimal
update: true
install: >-
base-devel
gmp-devel
openssl-devel
git
unzip
pacboy: >-
cmake:p
ninja:p
clang:p
lld:p
autotools:p
gmp:p
openssl:p
- name: Install Stack
uses: haskell-actions/setup@v2
id: stack
if: matrix.container == ''
with:
ghc-version: '9.6.5'
enable-stack: true
stack-version: 'latest'
- name: Configure Stack environment
run: |
HOME="${{ (runner.os == 'Windows' && '$(cygpath -m ~)') || '$HOME' }}"
mkdir -p "$STACK_ROOT"
{ echo "extra-include-dirs:";
echo "- $HOME/.local/include";
echo "$EXTRA_INCLUDE_WIN";
echo;
echo "extra-lib-dirs:";
echo "- $HOME/.local/lib";
echo "$EXTRA_LIB_WIN";
echo;
echo "ghc-options:";
echo ' "$locals": -Werror'
"$REPLACE_LINKER_WIN" && echo ' "$everything": -pgml=D:/a/_temp/msys64/clang64/bin/clang.exe -pgml-supports-no-pie';
echo;
"$SKIP_MSYS" && echo "skip-msys: true" || true
echo "system-ghc: true";
echo "install-ghc: false";
echo "skip-ghc-check: true";
} >> "$STACK_ROOT/config.yaml"
cat "$STACK_ROOT/config.yaml"
env:
STACK_ROOT: ${{ steps.stack.outputs.stack-root || '/etc/stack' }}
EXTRA_INCLUDE_WIN: ${{ (runner.os == 'Windows' && '- D:/a/_temp/msys64/clang64/include') || '' }}
EXTRA_LIB_WIN: ${{ (runner.os == 'Windows' && '- D:/a/_temp/msys64/clang64/lib') || '' }}
REPLACE_LINKER_WIN: ${{ (runner.os == 'Windows' && 'true') || 'false' }}
SKIP_MSYS: ${{ (runner.os == 'Windows' && 'true') || 'false' }}
- name: Configure Haskell paths (Windows)
if: runner.os == 'Windows'
run: |
HASKELL_PATHS="$(cygpath -u "$GHC_PATH"):$(cygpath -u "$CABAL_PATH"):$(cygpath -u "$STACK_PATH")"
echo "HASKELL_PATHS=$HASKELL_PATHS" >> "$GITHUB_ENV"
env:
GHC_PATH: ${{ steps.stack.outputs.ghc-path }}
CABAL_PATH: ${{ steps.stack.outputs.cabal-path }}
STACK_PATH: ${{ steps.stack.outputs.stack-path }}
- name: Checkout
uses: actions/checkout@v4
- name: Cache Local
uses: actions/cache@v4
with:
path: |
~/.local
D:\a\_temp\msys64\home\runneradmin\.local
key: ${{ runner.os }}-local-${{ env.CACHE_VERSION }}-${{ hashFiles('.github/scripts/install-*') }}
- name: Configure static build flags
run: |
printf "\nflags:\n hevm:\n static-secp256k1: true\n echidna:\n static: true\n" >> stack.yaml
- name: Cache Stack & Cabal
uses: actions/cache@v4
with:
path: |
.stack-work
${{ steps.stack.outputs.cabal-store || '~/.cabal' }}/*
${{ steps.stack.outputs.stack-root || '~/.stack' }}/*
!${{ steps.stack.outputs.stack-root || '~/.stack' }}/pantry/hackage/*.tar
!${{ steps.stack.outputs.stack-root || '~/.stack' }}/pantry/hackage/*.tar.gz
!${{ steps.stack.outputs.stack-root || '~/.stack' }}/config.yaml
key: ${{ runner.os }}-stack-${{ env.CACHE_VERSION }}-${{ hashFiles('package.yaml', 'stack.yaml') }}
- name: Build Libraries
run: |
.github/scripts/install-libsecp256k1.sh
.github/scripts/install-libff.sh
env:
HOST_OS: ${{ runner.os }}
- name: Build Dependencies
run: |
export PATH="$HASKELL_PATHS:$PATH"
stack build --ghc-options="-Werror" --only-dependencies
- name: Build and install echidna
run: |
export PATH="$HASKELL_PATHS:$PATH"
stack install --ghc-options="-Werror"
- name: Amend and compress binaries (macOS)
if: runner.os == 'macOS'
run: .github/scripts/build-macos-release.sh
- name: Compress binary (Linux)
if: runner.os == 'Linux'
run: GZIP=-9 tar -czf echidna.tar.gz -C $HOME/.local/bin/ echidna
- name: Compress binary (Windows)
if: runner.os == 'Windows'
run: GZIP=-9 tar -czf echidna.tar.gz -C $APPDATA/local/bin/ echidna.exe
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: echidna-${{ runner.os }}
path: echidna.tar.gz
- name: Build and copy test suite
if: runner.os != 'macOS'
run: |
export PATH="$HASKELL_PATHS:$PATH"
stack build --test --no-run-tests --ghc-options="-Werror"
cp "$(find "$PWD" -name 'echidna-testsuite*' -type f)" .
- name: Upload testsuite
if: runner.os != 'macOS'
uses: actions/upload-artifact@v4
with:
name: echidna-testsuite-${{ runner.os }}
path: echidna-testsuite*
test:
name: Test with solc ${{ matrix.solc }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: build
continue-on-error: ${{ matrix.experimental || false }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
solc:
- "0.4.25"
- "0.5.7"
- "0.6.12"
- "0.7.5"
include:
- solc: "0.6.12"
experimental: true
- solc: "0.7.5"
experimental: true
- os: windows-latest
experimental: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install dependencies
shell: bash
run: |
.github/scripts/install-solc.sh
.github/scripts/install-crytic-compile.sh
.github/scripts/install-z3.sh
env:
HOST_OS: ${{ runner.os }}
SOLC_VER: ${{ matrix.solc }}
- name: Download testsuite
uses: actions/download-artifact@v4
with:
name: echidna-testsuite-${{ runner.os }}
- name: Test
run: |
solc-select use ${{ matrix.solc }}
chmod +x echidna-testsuite*
./echidna-testsuite*