Go tests CI triggered from @magicxyyz of dont-save-every-state #9095
Workflow file for this run
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: | |
pull_request: | |
push: | |
branches: | |
- master | |
- develop | |
jobs: | |
test: | |
name: Go Tests | |
runs-on: ubuntu-8 | |
# Creates a redis container for redis tests | |
services: | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
strategy: | |
fail-fast: false | |
matrix: | |
test-mode: [defaults, race, challenge] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install dependencies | |
run: sudo apt update && sudo apt install -y wabt gotestsum | |
- name: Setup nodejs | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
cache: 'yarn' | |
cache-dependency-path: '**/yarn.lock' | |
- name: Install go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.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 wasm32-unknown-unknown | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: "stable" | |
target: wasm32-unknown-unknown | |
- name: Install rust wasm32-wasi | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: "stable" | |
target: wasm32-wasi | |
- name: Install rust stable | |
uses: actions-rs/toolchain@v1 | |
id: install-rust | |
with: | |
profile: minimal | |
toolchain: "stable" | |
override: true | |
- 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/registry/ | |
~/.cargo/git/ | |
arbitrator/target/ | |
arbitrator/wasm-libraries/target/ | |
arbitrator/wasm-libraries/soft-float/SoftFloat/build | |
target/etc/initial-machine-cache/ | |
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@v2 | |
with: | |
version: latest | |
skip-go-installation: true | |
skip-pkg-cache: true | |
- name: Custom Lint | |
run: | | |
go run ./linter/koanf ./... | |
go run ./linter/pointercheck ./... | |
- 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" | |
- name: run tests without race detection | |
if: matrix.test-mode == 'defaults' | |
run: | | |
packages=`go list ./...` | |
gotestsum --format short-verbose --packages="$packages" --rerun-fails=1 -- -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,./go-ethereum/... | |
- name: run tests with race detection | |
if: matrix.test-mode == 'race' | |
run: | | |
packages=`go list ./...` | |
gotestsum --format short-verbose --packages="$packages" --rerun-fails=1 -- -race | |
- name: run redis tests | |
if: matrix.test-mode == 'defaults' | |
run: TEST_REDIS=redis://localhost:6379/0 gotestsum --format short-verbose -- -p 1 -run TestRedis ./arbnode/... ./system_tests/... -coverprofile=coverage-redis.txt -covermode=atomic -coverpkg=./... | |
- name: run challenge tests | |
if: matrix.test-mode == 'challenge' | |
run: | | |
packages=`go list ./...` | |
gotestsum --format short-verbose --packages="$packages" --rerun-fails=1 -- ./... -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,./go-ethereum/... -tags=challengetest -run=TestChallenge | |
- 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 }} | |