-
Notifications
You must be signed in to change notification settings - Fork 879
add new storage test panel #3487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cody-littley
wants to merge
4
commits into
main
Choose a base branch
from
cjl/storage-test-panel
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,194 @@ | ||
| name: DB | ||
| 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.25.6' | ||
| GO_TEST_TIMEOUT: 30m | ||
| STATE_DB_PKG_PREFIX: github.com/sei-protocol/sei-chain/sei-db/state_db | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Race Detection | ||
| runs-on: uci-default | ||
| env: | ||
| GOFLAGS: -race -tags=ledger,test_ledger_mock | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 1 | ||
|
|
||
| - uses: actions/setup-go@v6 | ||
| with: | ||
| go-version: ${{ env.GO_VERSION }} | ||
| cache: false | ||
|
|
||
| - name: Login to Docker Hub | ||
| uses: docker/login-action@v3 | ||
| 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: | | ||
| go test \ | ||
| -timeout=${{ env.GO_TEST_TIMEOUT }} \ | ||
| ./sei-db/state_db/... | ||
|
|
||
| coverage: | ||
| name: Coverage | ||
| runs-on: ${{ github.event_name == 'merge_group' && 'ubuntu-latest' || 'uci-default' }} | ||
| # Skip coverage report for merge groups, since the queue is about safety check. The merge to main will run coverage anyway. | ||
| # GitHub does not support setting "Required" CI workflows for merge queue separately from PRs. If we skip the job at top | ||
| # level we then have to work around result not being present. Hence, the repeated if statements per step. | ||
| env: | ||
| GOFLAGS: -tags=ledger,test_ledger_mock | ||
| steps: | ||
| - name: Check trigger | ||
| if: github.event_name == 'merge_group' | ||
| run: echo 'Coverage skipped in merge queue' | ||
|
|
||
| - uses: actions/checkout@v5 | ||
| if: github.event_name != 'merge_group' | ||
| with: | ||
| # Depth 0 for PRs so merge-base diff against the base branch works. | ||
| fetch-depth: ${{ github.event_name == 'pull_request' && '0' || '1' }} | ||
|
|
||
| - uses: actions/setup-go@v6 | ||
| if: github.event_name != 'merge_group' | ||
| with: | ||
| go-version: ${{ env.GO_VERSION }} | ||
| cache: false | ||
|
|
||
| - name: Login to Docker Hub | ||
| uses: docker/login-action@v3 | ||
| if: github.event_name != 'merge_group' && env.DOCKERHUB_USERNAME != '' | ||
| env: | ||
| DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| with: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
|
||
| - name: Download modules | ||
| if: github.event_name != 'merge_group' | ||
| run: go mod download | ||
|
|
||
| - name: Determine coverage packages (PR) | ||
| id: cov-pkgs | ||
| if: github.event_name == 'pull_request' | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| BASE_SHA="${{ github.event.pull_request.base.sha }}" | ||
| HEAD_SHA="${{ github.event.pull_request.head.sha }}" | ||
|
|
||
| # Use explicit SHAs — works regardless of checkout depth. | ||
| CHANGED=$(git diff --name-only "$BASE_SHA"..."$HEAD_SHA") | ||
|
|
||
| # Keep only existing .go files (filters out deletions). | ||
| CHANGED_GO=$(printf "%s\n" "$CHANGED" \ | ||
| | grep -E '\.go$' \ | ||
| | while read -r f; do [ -f "$f" ] && echo "$f"; done \ | ||
| || true) | ||
|
|
||
| if [[ -z "$CHANGED_GO" ]]; then | ||
| echo "skip=true" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Resolve changed directories to Go packages, then keep only | ||
| # the state_db subtree — this workflow exclusively owns those | ||
| # packages, and the main go-test.yml workflow owns the rest. | ||
| DIRECT_PKGS=$(printf "%s\n" "$CHANGED_GO" \ | ||
| | xargs -r -n1 dirname \ | ||
| | sort -u \ | ||
| | while read -r d; do go list "./$d" 2>/dev/null || true; done \ | ||
| | sort -u \ | ||
| | grep "^${STATE_DB_PKG_PREFIX}" || true) | ||
|
|
||
| if [[ -z "$DIRECT_PKGS" ]]; then | ||
| echo "skip=true" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Find one level of reverse dependencies (packages that import | ||
| # the changed packages) so their tests exercise our changes too. | ||
| # Restrict reverse deps to the state_db subtree as well. | ||
| ALL_IMPORTS=$(go list -f '{{.ImportPath}} {{join .Imports " "}} {{join .TestImports " "}}' ./...) | ||
|
|
||
| REV_DEPS=$(awk ' | ||
| NR == FNR { if (NF) targets[$1] = 1; next } | ||
| { | ||
| pkg = $1 | ||
| for (i = 2; i <= NF; i++) { | ||
| if ($i in targets) { print pkg; break } | ||
| } | ||
| } | ||
| ' <(printf "%s\n" "$DIRECT_PKGS") <(printf "%s\n" "$ALL_IMPORTS") \ | ||
| | sort -u \ | ||
| | grep "^${STATE_DB_PKG_PREFIX}" || true) | ||
|
|
||
| # Merge direct + reverse-dep packages, deduplicate. | ||
| TEST_PKGS=$(printf "%s\n%s\n" "$DIRECT_PKGS" "$REV_DEPS" \ | ||
| | awk 'NF && !seen[$0]++ { printf "%s ", $0 }') | ||
| TEST_PKGS="${TEST_PKGS% }" | ||
|
|
||
| # coverpkg stays as the direct changed packages — we want coverage | ||
| # measured on the code that actually changed, but tested via a wider | ||
| # set of packages (including reverse deps). | ||
| COV_PKGS=$(printf "%s\n" "$DIRECT_PKGS" \ | ||
| | awk 'NF { printf "%s%s", sep, $0; sep = "," }') | ||
|
|
||
| echo "test_packages=$TEST_PKGS" >> "$GITHUB_OUTPUT" | ||
| echo "coverpkg=$COV_PKGS" >> "$GITHUB_OUTPUT" | ||
| echo "skip=false" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Go test with coverage (PR fast path) | ||
| if: github.event_name == 'pull_request' && steps.cov-pkgs.outputs.skip != 'true' | ||
| run: | | ||
| go test \ | ||
| -timeout=${{ env.GO_TEST_TIMEOUT }} \ | ||
| -covermode=atomic \ | ||
| -coverprofile=coverage.out \ | ||
| -coverpkg=${{ steps.cov-pkgs.outputs.coverpkg }} \ | ||
| ${{ steps.cov-pkgs.outputs.test_packages }} | ||
|
|
||
| - name: Go test with coverage (full path) | ||
| if: github.event_name != 'merge_group' && github.event_name != 'pull_request' | ||
| run: | | ||
| go test \ | ||
| -timeout=${{ env.GO_TEST_TIMEOUT }} \ | ||
| -covermode=atomic \ | ||
| -coverprofile=coverage.out \ | ||
| -coverpkg=./sei-db/state_db/... \ | ||
| ./sei-db/state_db/... | ||
|
|
||
| - name: Upload coverage to Codecov | ||
| if: github.event_name != 'merge_group' && (github.event_name != 'pull_request' || steps.cov-pkgs.outputs.skip != 'true') | ||
| uses: codecov/codecov-action@v5 | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| # Hard-fail on main (full path); soft on PRs (partial data). | ||
| fail_ci_if_error: ${{ github.event_name != 'pull_request' }} | ||
| disable_search: 'true' | ||
| # PR fast-path coverage is intentionally partial. | ||
| # Upload under a separate flag to avoid apples-to-oranges project comparisons. | ||
| name: ${{ github.event_name == 'pull_request' && 'sei-db-state-db-pr-coverage' || 'sei-db-state-db-coverage' }} | ||
| files: ./coverage.out | ||
| flags: ${{ github.event_name == 'pull_request' && 'sei-db-state-db-pr' || 'sei-db-state-db' }} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about name it
State DB Tests