forked from ethereum/hevm
-
Notifications
You must be signed in to change notification settings - Fork 0
236 lines (212 loc) · 7.67 KB
/
build.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
name: "Build"
on:
pull_request:
push:
branches:
dev-windows-tests-3
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
nix-build:
strategy:
matrix:
runtime: [ linux-x64, osx-x64, osx-arm64 ]
include:
- runtime: linux-x64
os: ubuntu-latest
- runtime: osx-x64
os: macos-13
- runtime: osx-arm64
os: macos-14
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: build hevm
run: nix build .#ci -L
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: hevm-${{ matrix.runtime }}
path: result/bin/hevm
extra-tests:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
include:
- os: ubuntu-latest
- os: macos-latest
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
# cabal complains if we don't do this...
- name: cabal update
run: nix-shell --pure --command "cabal update"
# can't be run in nix build due to network usage
- name: run rpc tests
run: nix-shell --pure --command "cabal --active-repositories=:none run rpc-tests"
# if we run this in nix build we often get killed due to oom in ci
- name: run ethereum tests
run: nix-shell --pure --command "cabal --active-repositories=:none run ethereum-tests"
build-windows-bitwuzla:
name: bitwuzla-build (win64 target)
uses: ./.github/workflows/bitwuzla-windows.yml
build-windows:
name: build (windows-latest)
needs: [build-windows-bitwuzla]
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: foundry-rs/foundry-toolchain@v1
- uses: msys2/setup-msys2@v2
with:
msystem: CLANG64
path-type: minimal
update: true
install: >-
base-devel
gmp-devel
openssl-devel
git
unzip
bash
pacboy: >-
cmake:p
ninja:p
clang:p
lld:p
autotools:p
gmp:p
openssl:p
z3:p
go:p
- uses: haskell-actions/setup@v2.7.0
id: setup
with:
ghc-version: '9.4.7'
- name: Extract GHC & Cabal paths
run: |
HASKELL_PATHS="$(cygpath -u "$GHC_PATH"):$(cygpath -u "$CABAL_PATH")"
echo "HASKELL_PATHS=$HASKELL_PATHS" >> "$GITHUB_ENV"
env:
GHC_PATH: ${{ steps.setup.outputs.ghc-path }}
CABAL_PATH: ${{ steps.setup.outputs.cabal-path }}
- name: build and install c dependencies
run: |
echo "::group::Installing libsecp256k1"
./.github/scripts/install-libsecp256k1.sh
echo "::endgroup::"
echo "::group::Installing libff"
./.github/scripts/install-libff.sh
echo "::endgroup::"
- name: Configure the build
run: |
export PATH="$HASKELL_PATHS:$PATH"
cabal configure --disable-documentation --enable-executable-static --enable-executable-stripping \
--extra-include-dirs="$HOME/.local/include" --extra-lib-dirs="$HOME/.local/lib" \
--extra-include-dirs="D:/a/_temp/msys64/clang64/include" --extra-lib-dirs="D:/a/_temp/msys64/clang64/lib" \
--ghc-options=-pgml=D:/a/_temp/msys64/clang64/bin/clang.exe
cabal build --dry-run
# The last step generates dist-newstyle/cache/plan.json for the cache key.
- name: Restore cached dependencies
uses: actions/cache/restore@v4
id: cache
env:
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ env.key }}-
- name: Install haskell dependencies
run: |
export PATH="$HASKELL_PATHS:$PATH"
cabal build all --only-dependencies
# Cache dependencies already, so that we do not have to rebuild them should the subsequent steps fail.
- name: Save cached dependencies
uses: actions/cache/save@v4
# Caches are immutable, trying to save with the same key would error.
if: ${{ steps.cache.outputs.cache-primary-key != steps.cache.outputs.cache-matched-key }}
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: build hevm
run: |
export PATH="$HASKELL_PATHS:$PATH"
cabal build
mkdir result && cp "$(cabal list-bin hevm)" result/hevm.exe
strip result/hevm.exe
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: hevm-windows-x64
path: result/hevm.exe
- uses: actions/checkout@v4
with:
repository: ethereum/solidity
ref: 1c8745c54a239d20b6fb0f79a8bd2628d779b27e
path: ethereum-solidity
- uses: actions/checkout@v4
with:
repository: ethereum/tests
ref: v12.2
path: ethereum-tests
- uses: actions/checkout@v4
with:
repository: foundry-rs/forge-std
path: forge-std
- name: download bitwuzla
uses: actions/download-artifact@v4
with:
name: bitwuzla-win64
path: bitwuzla-win64
- name: prepare test dependencies
run: |
# bitwuzla
echo BITWUZLA_PATH="$PWD/bitwuzla-win64/bin" >> "$GITHUB_ENV"
# evm
go install github.com/ethereum/go-ethereum/cmd/evm@latest
echo EVM_PATH="$(cygpath -u "$(go env GOPATH)/bin")" >> "$GITHUB_ENV"
# cvc5
curl --retry 5 -fsSL https://github.com/cvc5/cvc5/releases/download/cvc5-1.1.2/cvc5-Win64-static.zip -o cvc5.zip
unzip cvc5.zip && rm cvc5.zip
echo CVC5_PATH="$PWD/cvc5-Win64-static/bin" >> "$GITHUB_ENV"
# solc
mkdir solc
curl --retry 5 -fsSL https://github.com/ethereum/solidity/releases/download/v0.8.21/solc-windows.exe -o solc/solc.exe
echo DAPP_SOLC="$PWD/solc/solc.exe" >> "$GITHUB_ENV"
echo DAPP_SOLC_PATH="$PWD/solc/" >> "$GITHUB_ENV"
# repos
echo HEVM_SOLIDITY_REPO="$PWD/ethereum-solidity" >> "$GITHUB_ENV"
echo HEVM_ETHEREUM_TESTS_REPO="$PWD/ethereum-tests" >> "$GITHUB_ENV"
echo HEVM_FORGE_STD_REPO="$PWD/forge-std" >> "$GITHUB_ENV"
# environment
echo HEVM_SYSTEM_SHELL="$(which bash)" >> "$GITHUB_ENV"
- name: run tests
run: |
export PATH="$EVM_PATH:$CVC5_PATH:$BITWUZLA_PATH:$DAPP_SOLC_PATH:$HASKELL_PATHS:$PATH"
cabal run test
- name: run rpc tests
run: |
export PATH="$HASKELL_PATHS:$PATH"
cabal run rpc-tests
- name: run ethereum tests
run: |
export PATH="$HASKELL_PATHS:$PATH"
cabal run ethereum-tests
cabal-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: run cabal check
run: nix develop -c cabal check --verbose=3