Go tests CI triggered from @Sneh1999 of full-node-with-espresso-finality #1072
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go tests CI | |
run-name: Go tests CI triggered from @${{ github.actor }} of ${{ github.head_ref }} | |
on: | |
workflow_dispatch: | |
merge_group: | |
pull_request: | |
push: | |
branches: | |
- master | |
- develop | |
- integration | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: Go Tests | |
runs-on: ubuntu-latest | |
# Creates a redis container for redis tests | |
services: | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
strategy: | |
fail-fast: false | |
matrix: | |
test-mode: [defaults, race, challenge, stylus, long, redis] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: cargo-bins/cargo-binstall@main | |
- name: Make more disk space available on public runner | |
run: | | |
# rmz seems to be faster at deleting files than rm | |
cargo binstall -y rmz | |
sudo mv /home/runner/.cargo/bin/rmz /usr/local/bin/rmz | |
echo "Available storage before:" | |
sudo df -h | |
echo | |
sudo rmz -f /usr/share/dotnet | |
sudo rmz -f /usr/share/swift | |
sudo rmz -f /usr/share/gradle-* | |
sudo rmz -f /usr/share/az_* | |
sudo rmz -f /usr/local/lib/android | |
sudo rmz -f /opt/ghc | |
sudo rmz -f /opt/az | |
sudo rmz -f /opt/pipx | |
sudo rmz -f /opt/google | |
sudo rmz -f /opt/microsoft | |
echo "Available storage after:" | |
sudo df -h | |
echo | |
- name: Install dependencies | |
run: > | |
sudo apt update && sudo apt install -y wabt gotestsum | |
cmake build-essential bison golang clang make wabt | |
- name: Setup nodejs | |
if: false # fails to find yarn.lock when running in symlinked directory, doesn't seem to be needed | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
cache-dependency-path: '**/yarn.lock' | |
- name: Install go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21.x | |
- name: Install wasm-ld | |
run: | | |
sudo apt-get update && sudo apt-get install -y lld-14 | |
sudo ln -s /usr/bin/wasm-ld-14 /usr/local/bin/wasm-ld | |
- name: Install rust stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: 'wasm32-unknown-unknown, wasm32-wasi' | |
- name: Install cbindgen | |
run: cargo install cbindgen | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: Install rust nightly | |
uses: actions-rs/toolchain@v1 | |
id: install-rust-nightly | |
with: | |
profile: minimal | |
toolchain: "nightly" | |
- name: Install rust wasm targets | |
run: rustup target add wasm32-wasi wasm32-unknown-unknown | |
- name: Install nightly wasm targets | |
run: | | |
rustup component add rust-src --toolchain nightly | |
rustup target add wasm32-unknown-unknown --toolchain nightly | |
- name: Cache Build Products | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: v1-${{ runner.os }}-go-${{ hashFiles('go.sum') }}-${{ matrix.test-mode }} | |
restore-keys: v1-${{ runner.os }}-go- | |
- name: Cache Rust Build Products | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry/ | |
~/.cargo/git/ | |
arbitrator/**/target/ | |
arbitrator/wasm-libraries/target/ | |
arbitrator/wasm-libraries/soft-float/SoftFloat/build | |
target/etc/initial-machine-cache/ | |
key: v2-${{ runner.os }}-cargo-${{ steps.install-rust.outputs.rustc_hash }}-min-${{ hashFiles('arbitrator/Cargo.lock') }}-${{ matrix.test-mode }} | |
restore-keys: v1-${{ runner.os }}-cargo-${{ steps.install-rust.outputs.rustc_hash }}- | |
- name: Cache cbrotli | |
uses: actions/cache@v3 | |
id: cache-cbrotli | |
with: | |
path: | | |
target/include/brotli/ | |
target/lib-wasm/ | |
target/lib/libbrotlicommon-static.a | |
target/lib/libbrotlienc-static.a | |
target/lib/libbrotlidec-static.a | |
key: v1-${{ runner.os }}-brotli-${{ hashFiles('scripts/build-brotli.sh') }}-${{ hashFiles('.github/workflows/arbitrator-ci.yaml') }}-${{ matrix.test-mode }} | |
restore-keys: v1-${{ runner.os }}-brotli- | |
- name: Build cbrotli-local | |
if: steps.cache-cbrotli.outputs.cache-hit != 'true' | |
run: ./scripts/build-brotli.sh -l | |
- name: Build cbrotli-wasm in docker | |
if: steps.cache-cbrotli.outputs.cache-hit != 'true' | |
run: ./scripts/build-brotli.sh -w -d | |
- name: Build | |
run: make build -j | |
- name: test-go-deps | |
run: make --debug test-go-deps | |
- name: Build all lint dependencies | |
run: make -j build-node-deps | |
- name: Lint | |
if: matrix.test-mode == 'defaults' | |
uses: golangci/golangci-lint-action@v5 | |
with: | |
version: v1.59.1 | |
skip-cache: true | |
- name: Custom Lint | |
if: matrix.test-mode == 'defaults' | |
run: | | |
go run ./linters ./... | |
- name: Set environment variables | |
run: | | |
echo "GOMEMLIMIT=6GiB" >> "$GITHUB_ENV" | |
echo "GOGC=80" >> "$GITHUB_ENV" | |
- name: run tests without race detection | |
if: matrix.test-mode == 'defaults' | |
shell: bash | |
run: | | |
skip_tests=`grep -vE '^\s*#|^\s*$' ci_skip_tests | sed 's/.*/^&$/g' | tr '\n' '|' | sed 's/|$//'` | |
packages=`go list ./...` | |
stdbuf -oL gotestsum --format short-verbose --packages="$packages" --rerun-fails=1 --no-color=false -- ./... -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,./go-ethereum/... -timeout 35m -skip "$skip_tests" > >(stdbuf -oL tee full.log | grep -vE "INFO|seal") | |
- name: run tests with race detection | |
if: matrix.test-mode == 'race' | |
shell: bash | |
run: | | |
skip_tests=`grep -vE '^\s*#|^\s*$' ci_skip_tests | sed 's/.*/^&$/g' | tr '\n' '|' | sed 's/|$//'` | |
packages=`go list ./...` | |
stdbuf -oL gotestsum --format short-verbose --packages="$packages" --rerun-fails=1 --no-color=false -- ./... -race -skip "$skip_tests" -timeout=40m > >(stdbuf -oL tee full.log | grep -vE "INFO|seal") | |
- name: run redis tests | |
if: matrix.test-mode == 'redis' | |
run: TEST_REDIS=redis://localhost:6379/0 gotestsum --format short-verbose -- -timeout 20m -p 1 -run TestRedis ./arbnode/... ./system_tests/... -coverprofile=coverage-redis.txt -covermode=atomic -coverpkg=./... | |
- name: run challenge tests | |
if: matrix.test-mode == 'challenge' | |
shell: bash | |
run: | | |
skip_tests=`grep -vE '^\s*#|^\s*$' ci_skip_tests | sed 's/.*/^&$/g' | tr '\n' '|' | sed 's/|$//'` | |
packages=`go list ./...` | |
stdbuf -oL gotestsum --format short-verbose --packages="$packages" --rerun-fails=1 --no-color=false -- ./... -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,./go-ethereum/... -tags=challengetest -run=TestChallenge -skip "$skip_tests"> >(stdbuf -oL tee full.log | grep -vE "INFO|seal") | |
- name: run stylus tests | |
if: matrix.test-mode == 'stylus' | |
shell: bash | |
run: | | |
skip_tests=`grep -vE '^\s*#|^\s*$' ci_skip_tests | sed 's/.*/^&$/g' | tr '\n' '|' | sed 's/|$//'` | |
packages=`go list ./...` | |
stdbuf -oL gotestsum --format short-verbose --packages="$packages" --rerun-fails=1 --no-color=false -- ./... -timeout 60m -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,./go-ethereum/... -parallel=8 -tags=stylustest -run="TestProgramArbitrator" -skip "$skip_tests"> >(stdbuf -oL tee full.log | grep -vE "INFO|seal") | |
- name: run long stylus tests | |
if: matrix.test-mode == 'long' | |
shell: bash | |
run: | | |
skip_tests=`grep -vE '^\s*#|^\s*$' ci_skip_tests | sed 's/.*/^&$/g' | tr '\n' '|' | sed 's/|$//'` | |
packages=`go list ./...` | |
stdbuf -oL gotestsum --format short-verbose --packages="$packages" --rerun-fails=1 --no-color=false -- ./... -timeout 60m -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,./go-ethereum/... -parallel=8 -tags=stylustest -run="TestProgramLong" -skip "$skip_tests"> >(stdbuf -oL tee full.log | grep -vE "INFO|seal") | |
- name: Archive detailed run log | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.test-mode }}-full.log | |
path: full.log | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v2 | |
if: false | |
with: | |
fail_ci_if_error: false | |
files: ./coverage.txt,./coverage-redis.txt | |
verbose: false | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Check available space after CI run | |
if: '!cancelled()' | |
run: | | |
sudo df -h |