-
Notifications
You must be signed in to change notification settings - Fork 1.1k
217 lines (194 loc) · 8.53 KB
/
test-kurtosis-assertoor.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: Kurtosis Assertoor GitHub Action
env:
APPLICATION: "erigon"
BUILDER_IMAGE: "golang:1.22-bookworm"
APP_REPO: "erigontech/erigon"
PACKAGE: "github.com/erigontech/erigon"
TARGET_BASE_IMAGE: "debian:12.7-slim"
LABEL_DESCRIPTION: "[docker image built on a last commit id from the ref branch] Erigon is an implementation of Ethereum (execution layer with embeddable consensus layer), on the efficiency frontier. Archive Node by default."
KEEP_IMAGES: 100
on:
push:
branches:
- 'release/2.61'
paths-ignore:
- '.github/**'
workflow_dispatch:
jobs:
define_matrix:
runs-on: ubuntu-latest
outputs:
os: ${{ steps.os.outputs.os }}
steps:
- name: Define os
id: os
run: echo 'os=ubuntu-latest' >> "$GITHUB_OUTPUT"
Build_and_test:
needs: define_matrix
runs-on: ${{ needs.define_matrix.outputs.os }}
steps:
- name: Fast checkout git repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 ## 4.1.7 release
with:
repository: ${{ env.APP_REPO }}
fetch-depth: 1
ref: ${{ github.ref_name }}
path: 'erigon'
- name: Setup go env and cache
uses: actions/setup-go@v5
with:
go-version: '>=1.22'
go-version-file: 'erigon/go.mod'
cache-dependency-path: |
erigon/go.sum
- name: Get commit id
id: getCommitId
run: |
cd erigon
echo "id=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "short_commit_id=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT
echo "week_of_the_year=$(/bin/date -u "+%Y-%W")" >> $GITHUB_OUTPUT
cd ..
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf ## v3.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db ## v3.6.1
- name: Setup GO build and pkg cache for one week only
id: cache
uses: actions/cache@v4
with:
key: cache-year-week-${{ steps.getCommitId.outputs.week_of_the_year }}-go.mod-hash:${{ hashFiles('erigon/go.mod') }}
path: |
~/go/pkg
~/.cache
# Runs a Docker container for compiling Erigon for the Linux/amd64 architecture
# docker run --platform linux/amd64
# # Automatically removes the container upon completion
# --rm
# # Mounts the 'erigon' directory from the Git repository into the container in read-only mode
# -v $(pwd)/erigon:/erigon:ro
# # Mounts a directory in the GitHub Actions workspace to collect the compilation output files
# -v ${GITHUB_WORKSPACE}/build-amd64:/erigon-build
# # Mounts the host system cache inside the container to improve compilation performance
# -v ${HOME}/.cache:/root/.cache
# # Mounts the Go dependencies cache inside the container
# -v ${HOME}/go/pkg/mod:/go/pkg/mod
# # Sets the working directory inside the container
# -w /erigon --entrypoint /bin/bash
# # Uses the Docker image defined in the BUILDER_IMAGE environment variable (in this case "golang:1.22-bookworm")
# ${{ env.BUILDER_IMAGE }}
# -c "
# # Configures Git to allow modifying files in the '/erigon' directory
# git config --global --add safe.directory /erigon;
# # Compiles the various Erigon components for the amd64 architecture
# make GOARCH=amd64 GOAMD64=v1 GOBIN=/erigon-build BUILD_TAGS=nosqlite,noboltdb
# erigon downloader devnet evm caplin diag integration rpcdaemon sentry txpool;
# # Manually installs the libsilkworm_capi.so library required by Erigon
# find / -name libsilkworm_capi.so -exec install {} /erigon-build \;"
- name: Build for linux/amd64
run: >
docker run --platform linux/amd64
--rm
-v $(pwd)/erigon:/erigon:ro
-v ${GITHUB_WORKSPACE}/build-amd64:/erigon-build
-v ${HOME}/.cache:/root/.cache
-v ${HOME}/go/pkg/mod:/go/pkg/mod
-w /erigon --entrypoint /bin/bash
${{ env.BUILDER_IMAGE }}
-c "
git config --global --add safe.directory /erigon;
make GOARCH=amd64 GOAMD64=v1 GOBIN=/erigon-build BUILD_TAGS=nosqlite,noboltdb
erigon downloader devnet evm caplin diag integration rpcdaemon sentry txpool;
find / -name libsilkworm_capi.so -exec install {} /erigon-build \;"
- name: Create archives and checksums
env:
RELEASE_VERSION: "local-${{ steps.getCommitId.outputs.short_commit_id }}"
run: |
cd ${GITHUB_WORKSPACE}
mkdir $GITHUB_WORKSPACE/release
for dir in build-*; do
cd $dir
echo Current directory is $(pwd). Checksum file and archive will be created for this directory
tar czvf $GITHUB_WORKSPACE/release/${APPLICATION}_${RELEASE_VERSION}_linux_$(echo $dir | sed 's,build-,,').tar.gz \
--transform "s,^./,${APPLICATION}_${RELEASE_VERSION}_linux_$(echo $dir | sed 's,build-,,')/," .
cd -
done
cd $GITHUB_WORKSPACE/release
sha256sum * > ${APPLICATION}_${RELEASE_VERSION}_checksums.txt
echo Content of release directory:
find . -type f -ls
- name: Build multi-platform docker image based on the commit id ${{ steps.getCommitId.outputs.short_commit_id }} in the ref branch
env:
BUILD_VERSION: "local-${{ steps.getCommitId.outputs.short_commit_id }}"
DOCKERFILE_PATH: Dockerfile.release
run: |
cd ${GITHUB_WORKSPACE}/release
echo "Current directory is $(pwd) ."
docker build \
--file ${{ github.workspace }}/erigon/${{ env.DOCKERFILE_PATH }} \
--build-arg RELEASE_DOCKER_BASE_IMAGE=${{ env.TARGET_BASE_IMAGE }} \
--build-arg VERSION=${{ env.BUILD_VERSION }} \
--build-arg APPLICATION=${{ env.APPLICATION }} \
--tag ${{ env.APPLICATION }}:${{ env.BUILD_VERSION }} \
--tag ${{ env.APPLICATION }}:latest \
--tag ${{ env.APPLICATION }} \
--target release .
- name: Cleanup some space
run: |
df -h
sudo rm -drf \
/usr/share/dotnet \
/usr/share/swift \
/usr/local/julia* \
/opt/google/chrome \
/opt/microsoft/msedge \
/opt/microsoft/powershell \
/usr/lib/mono \
/usr/local/lib/android \
/usr/local/share/chromium
echo DEBUG current list of docker images
docker image ls
echo DEBUG Removing legacy node:1 matching docker images
sudo docker image rm $(docker image ls --filter=reference='node:1*' -q)
echo DEBUG new disk free output
df -h
- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: sudo apt update && sudo apt install build-essential
- name: download kurtosis config - with pectra
env:
BUILD_VERSION: local-${{ steps.getCommitId.outputs.short_commit_id }}
# TODO: update the path to the config file with main branch before PR is merged
run: |
wget -O kurtosis_config_with_p.yaml https://raw.githubusercontent.com/erigontech/erigon/feat/assertor-testing/.github/workflows/kurtosis/config-pectra.properties
sed 's#<<ERIGON_IMAGE_PLACEHOLDER>>#${{ env.APPLICATION }}:${{ env.BUILD_VERSION }}#g' kurtosis_config_with_p.yaml > kurtosis_config.yaml
- name: Create logs directory
run: mkdir -p logs
- name: Run Kurtosis + assertoor tests
id: kurtosis-test
continue-on-error: true
uses: ethpandaops/kurtosis-assertoor-github-action@v1
with:
enclave_name: "kurtosis-run-${{ github.run_id }}"
ethereum_package_args: "./kurtosis_config.yaml"
#kurtosis_extra_args: --verbosity detailed --cli-log-level trace
enclave_dump: false
- name: Save Kurtosis test output
if: always()
shell: bash
run: |
mkdir -p logs
echo '${{ toJSON(steps.kurtosis-test.outputs) }}' > logs/kurtosis-outputs.json
- name: Save Kurtosis test logs
if: always()
uses: actions/upload-artifact@v4
with:
name: kurtosis-test-logs
path: |
logs/kurtosis-outputs.json
./**/*.log
kurtosis-logs/**
retention-days: 14
- name: Check test result
if: steps.kurtosis-test.outcome != 'success'
run: exit 1