Skip to content

Go tests CI triggered from @Sneh1999 of #1629

Go tests CI triggered from @Sneh1999 of

Go tests CI triggered from @Sneh1999 of #1629

Workflow file for this run

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
- celestia-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]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- 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
- name: Setup nodejs
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.23.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:
toolchain: '1.81.0'
targets: 'wasm32-wasi, wasm32-unknown-unknown'
components: 'llvm-tools-preview, rustfmt, clippy'
- name: Install rust nightly
uses: dtolnay/rust-toolchain@nightly
id: install-rust-nightly
with:
toolchain: 'nightly-2024-10-06'
targets: 'wasm32-wasi, wasm32-unknown-unknown'
components: 'rust-src, rustfmt, clippy'
- name: Install cbindgen
run: cargo install cbindgen
- name: Set STYLUS_NIGHTLY_VER environment variable
run: echo "STYLUS_NIGHTLY_VER=+$(rustup toolchain list | grep '^nightly' | head -n1 | cut -d' ' -f1)" >> "$GITHUB_ENV"
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Cache Build Products
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-${{ matrix.test-mode }}
restore-keys: ${{ runner.os }}-go-
- name: Cache Rust Build Products
uses: actions/cache@v3
with:
path: |
~/.cargo/
arbitrator/target/
arbitrator/wasm-libraries/target/
arbitrator/wasm-libraries/soft-float/
target/etc/initial-machine-cache/
/home/runner/.rustup/toolchains/
key: ${{ runner.os }}-cargo-${{ steps.install-rust.outputs.rustc_hash }}-min-${{ hashFiles('arbitrator/Cargo.lock') }}-${{ matrix.test-mode }}
restore-keys: ${{ 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: ${{ runner.os }}-brotli-${{ hashFiles('scripts/build-brotli.sh') }}-${{ hashFiles('.github/workflows/arbitrator-ci.yaml') }}-${{ matrix.test-mode }}
restore-keys: ${{ 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 test-go-deps -j
- name: Build all lint dependencies
run: make -j build-node-deps
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
skip-pkg-cache: true
- name: Custom Lint
run: |
go run ./linters ./...
- name: Set environment variables
run: |
mkdir -p target/tmp/deadbeefbee
echo "TMPDIR=$(pwd)/target/tmp/deadbeefbee" >> "$GITHUB_ENV"
echo "GOMEMLIMIT=6GiB" >> "$GITHUB_ENV"
echo "GOGC=80" >> "$GITHUB_ENV"
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> "$GITHUB_ENV"
- name: run tests without race detection and path state scheme
if: matrix.test-mode == 'defaults'
shell: bash
env:
TEST_STATE_SCHEME: path
run: |
echo "Running tests with Path Scheme" >> full.log
${{ github.workspace }}/scripts/espresso-run-test-ci
- name: run tests without race detection and hash state scheme
if: matrix.test-mode == 'defaults'
shell: bash
env:
TEST_STATE_SCHEME: hash
run: |
echo "Running tests with Hash Scheme" >> full.log
${{ github.workspace }}/scripts/espresso-run-test-ci
- name: run tests with race detection and hash state scheme
if: matrix.test-mode == 'race'
shell: bash
env:
TEST_STATE_SCHEME: hash
run: |
echo "Running tests with Hash Scheme" >> full.log
${{ github.workspace }}/scripts/espresso-run-test-ci -race
- name: run redis tests
if: matrix.test-mode == 'defaults'
shell: bash
run: |
echo "Running redis tests" >> full.log
TEST_REDIS=redis://localhost:6379/0 ${{ github.workspace }}/scripts/espresso-run-test-ci -p 1 -run TestRedis ./arbnode/... ./system_tests/...
- name: create block input json file
if: matrix.test-mode == 'defaults'
run: |
gotestsum --format short-verbose -- -run TestProgramStorage$ ./system_tests/... --count 1 --recordBlockInputs.WithBaseDir="${{ github.workspace }}/target" --recordBlockInputs.WithTimestampDirEnabled=false --recordBlockInputs.WithBlockIdInFileNameEnabled=false
- name: run arbitrator prover on block input json
if: matrix.test-mode == 'defaults'
run: |
make build-prover-bin
target/bin/prover target/machines/latest/machine.wavm.br -b --json-inputs="${{ github.workspace }}/target/TestProgramStorage/block_inputs.json"
- name: run jit prover on block input json
if: matrix.test-mode == 'defaults'
run: |
make build-jit
if [ -n "$(target/bin/jit --binary target/machines/latest/replay.wasm --cranelift --json-inputs='${{ github.workspace }}/target/TestProgramStorage/block_inputs.json')" ]; then
echo "Error: Command produced output."
exit 1
fi
- name: run challenge tests
if: matrix.test-mode == 'challenge'
shell: bash
run: |
scripts/espresso-run-test-ci -run=TestChallenge -tags=challengetest
- name: run stylus tests
if: matrix.test-mode == 'stylus'
run: ${{ github.workspace }}/.github/workflows/gotestsum.sh --tags stylustest --run TestProgramArbitrator --timeout 60m --cover
- name: run long stylus tests
if: matrix.test-mode == 'long'
shell: bash
run: |
scripts/espresso-run-test-ci -tags=stylustest -run=TestProgramArbitrator
- name: Archive detailed run log
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.test-mode }}-full.log
path: full.log
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
if: matrix.test-mode == 'defaults'
with:
fail_ci_if_error: false
files: ./coverage.txt,./coverage-redis.txt
verbose: false
token: ${{ secrets.CODECOV_TOKEN }}