Skip to content

feat(evmonly): serve staking's bonded set as the validator set #14948

feat(evmonly): serve staking's bonded set as the validator set

feat(evmonly): serve staking's bonded set as the validator set #14948

Workflow file for this run

name: Go Test
on:
workflow_call:
pull_request:
merge_group:
push:
branches:
- main
- release/**
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
env:
GO_VERSION: '1.27.4'
GO_TEST_TIMEOUT: 30m
# state_db tests run in their own workflow (sei-db-tests.yml); exclude
# that subtree everywhere in this workflow to avoid double-running them.
STATE_DB_PKG_PREFIX: github.com/sei-protocol/sei-chain/sei-db/state_db
jobs:
# The race run fans out over the shard matrix. The shards and the upgrade
# tests all roll up into the `Race Detection` job below, which is the single
# check name branch protection and the merge queue require.
race-shard:
name: Race Detection (shard ${{ matrix.shard }})
runs-on: uci-default
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3]
env:
GOFLAGS: -race -tags=ledger,test_ledger_mock
steps:
# See: https://github.com/actions/checkout/releases/tag/v7.0.0
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
- uses: actions/setup-go@v7
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: Login to Docker Hub
# See: https://github.com/docker/login-action/releases/tag/v4.2.0
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee
if: env.DOCKERHUB_USERNAME != ''
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Download modules
run: go mod download
- name: Go test
run: |
set -euo pipefail
# Round-robin over the sorted package list: neighbouring packages
# (sei-db/*, sei-cosmos/x/*) are the slow ones, so contiguous slices
# would leave one shard with most of the test time.
go list ./... \
| grep -v "^${STATE_DB_PKG_PREFIX}" \
| LC_ALL=C sort \
| awk -v n="${{ strategy.job-total }}" -v s="${{ matrix.shard }}" '(NR - 1) % n == s' > packages.txt
[[ -s packages.txt ]] || { echo "shard ${{ matrix.shard }} received no packages"; exit 1; }
echo "Shard ${{ matrix.shard }}/${{ strategy.job-total }}: $(wc -l < packages.txt) packages"
# Build covdata into the cache once. Packages without tests run it in
# parallel, and on a cold cache one run can exec it while another is
# still writing it ("text file busy").
go tool -n covdata > /dev/null
xargs -r go test -timeout=${{ env.GO_TEST_TIMEOUT }} -coverprofile=coverage.out < packages.txt
- name: Upload coverage to Codecov
if: github.event_name != 'merge_group'
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: ${{ github.event_name != 'pull_request' }}
disable_search: 'true'
name: sei-chain-coverage-${{ matrix.shard }}
files: ./coverage.out
flags: sei-chain
upgrade-test:
name: Upgrade tests
runs-on: uci-default
env:
GOFLAGS: -race -tags=ledger,test_ledger_mock
steps:
# See: https://github.com/actions/checkout/releases/tag/v7.0.0
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
# upgrade-test-vet resolves historical offline phases from release
# branches, so checkout must include their remote refs.
fetch-depth: 0
- uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: Download modules
run: go mod download
# The file describing the upgrade being shipped sits behind a build tag,
# so the shards above compile none of it. The target derives the tag from
# app/upgradenames/tags rather than taking one from here, which is what stops this step
# from going on running an upgrade that already shipped.
- name: Minor upgrade test
run: make upgrade-test
# Files for upgrades that already shipped are no longer run, but they have
# to keep compiling. The run above and golangci-lint both skip them.
- name: Minor upgrade tests compile
run: make upgrade-test-vet
test:
name: Race Detection
runs-on: ubuntu-latest
needs: [ race-shard, upgrade-test ]
if: always()
steps:
- name: Verify race shards and upgrade tests succeeded
run: |
if [[ "${{ needs.race-shard.result }}" != "success" ]]; then
echo "race shards did not succeed (${{ needs.race-shard.result }})"
exit 1
fi
if [[ "${{ needs.upgrade-test.result }}" != "success" ]]; then
echo "upgrade tests did not succeed (${{ needs.upgrade-test.result }})"
exit 1
fi
echo "All race shards and upgrade tests passed."