Backport: Remove the params store key and transient store key from the app: #2189. #7382
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: Tests / Code Coverage | |
# Tests / Code Coverage workflow runs unit tests and uploads a code coverage report | |
# This workflow is run on pushes to master & every Pull Request, | |
# if no *.go, go.mod or go.sum file is changed it will pass without running as these are required checks | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
# Set concurrency for this workflow to cancel in-progress jobs if retriggered. | |
# The github.ref is only available when triggered by a PR so fall back to github.run_id for other cases. | |
# The github.run_id is unique for each run, giving each such invocation it's own unique concurrency group. | |
# Basically, if you push to a PR branch, jobs that are still running for that PR will be cancelled. | |
# But jobs started because of a merge to main or a release tag push are not cancelled. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
setup-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: technote-space/[email protected] | |
with: | |
PATTERNS: | | |
**/**.go | |
go.mod | |
go.sum | |
.github/workflows/test.yml | |
- name: Define Variables | |
id: def-vars | |
run: | | |
file_prefix="${GITHUB_SHA:0:7}-${GITHUB_RUN_ATTEMPT}" | |
echo "Setting output: file-prefix=$file_prefix" | |
echo "file-prefix=$file_prefix" >> "$GITHUB_OUTPUT" | |
- name: Create a file with all the pkgs | |
run: go list ./... > pkgs.txt | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: "${{ steps.def-vars.outputs.file-prefix }}-pkgs.txt" | |
path: ./pkgs.txt | |
- name: Split pkgs into parts | |
# The sanction and quarantine simulation race test takes about 6 minutes. | |
# So we'll split everything else 3 ways, and make those part 03 and 04 | |
run: | | |
grep -vF \ | |
-e 'github.com/provenance-io/provenance/x/quarantine/simulation' \ | |
-e 'github.com/provenance-io/provenance/x/sanction/simulation' \ | |
pkgs.txt > pkgs.txt.tmp | |
split -d -n l/3 pkgs.txt.tmp pkgs.txt.part. | |
printf '%s\n' \ | |
'github.com/provenance-io/provenance/x/quarantine/simulation' \ | |
>> pkgs.txt.part.03 | |
printf '%s\n' \ | |
'github.com/provenance-io/provenance/x/sanction/simulation' \ | |
>> pkgs.txt.part.04 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: "${{ steps.def-vars.outputs.file-prefix }}-pkgs.txt.part.00" | |
path: ./pkgs.txt.part.00 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: "${{ steps.def-vars.outputs.file-prefix }}-pkgs.txt.part.01" | |
path: ./pkgs.txt.part.01 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: "${{ steps.def-vars.outputs.file-prefix }}-pkgs.txt.part.02" | |
path: ./pkgs.txt.part.02 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: "${{ steps.def-vars.outputs.file-prefix }}-pkgs.txt.part.03" | |
path: ./pkgs.txt.part.03 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: "${{ steps.def-vars.outputs.file-prefix }}-pkgs.txt.part.04" | |
path: ./pkgs.txt.part.04 | |
outputs: | |
should-run: ${{ env.GIT_DIFF }} | |
file-prefix: ${{ steps.def-vars.outputs.file-prefix }} | |
tests: | |
needs: setup-tests | |
# Note: There's a required check on this, and it must pass. A skip doesn't count as a pass. | |
# So instead of a job-level if: needs.setup-tests.outputs.should-run on this job, | |
# it's in the steps below (except the checkout step). | |
strategy: | |
fail-fast: false | |
matrix: | |
part: ["00", "01", "02", "03", "04"] | |
runs-on: ubuntu-latest | |
env: | |
LD_LIBRARY_PATH: /usr/local/lib:/usr/local/lib/x86_64-linux-gnu | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# CodeCov requires fetch-depth > 1 | |
fetch-depth: 2 | |
- uses: actions/setup-go@v5 | |
if: needs.setup-tests.outputs.should-run | |
with: | |
go-version-file: 'go.mod' | |
- uses: actions/download-artifact@v4 | |
if: needs.setup-tests.outputs.should-run | |
with: | |
name: "${{ needs.setup-tests.outputs.file-prefix }}-pkgs.txt.part.${{ matrix.part }}" | |
- name: test & coverage report creation | |
if: needs.setup-tests.outputs.should-run | |
run: | | |
cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -timeout 30m -coverprofile=${{ matrix.part }}profile.out -covermode=atomic -tags='norace ledger test_ledger_mock' | |
- uses: actions/upload-artifact@v4 | |
if: needs.setup-tests.outputs.should-run | |
with: | |
name: "${{ needs.setup-tests.outputs.file-prefix }}-${{ matrix.part }}-coverage" | |
path: ./${{ matrix.part }}profile.out | |
# This action performs a code coverage assessment but filters out generated code from proto based types | |
# and grpc services | |
upload-coverage-report: | |
needs: [setup-tests, tests] | |
# Note: There's a required check on this, and it must pass. A skip doesn't count as a pass. | |
# So instead of a job-level if: needs.setup-tests.outputs.should-run on this job, | |
# it's in the steps below (except the checkout step). | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# CodeCov requires fetch-depth > 1 | |
fetch-depth: 2 | |
- uses: actions/download-artifact@v4 | |
if: needs.setup-tests.outputs.should-run | |
with: | |
name: "${{ needs.setup-tests.outputs.file-prefix }}-00-coverage" | |
- uses: actions/download-artifact@v4 | |
if: needs.setup-tests.outputs.should-run | |
with: | |
name: "${{ needs.setup-tests.outputs.file-prefix }}-01-coverage" | |
- uses: actions/download-artifact@v4 | |
if: needs.setup-tests.outputs.should-run | |
with: | |
name: "${{ needs.setup-tests.outputs.file-prefix }}-02-coverage" | |
- uses: actions/download-artifact@v4 | |
if: needs.setup-tests.outputs.should-run | |
with: | |
name: "${{ needs.setup-tests.outputs.file-prefix }}-03-coverage" | |
- uses: actions/download-artifact@v4 | |
if: needs.setup-tests.outputs.should-run | |
with: | |
name: "${{ needs.setup-tests.outputs.file-prefix }}-04-coverage" | |
- name: Combine profiles | |
if: needs.setup-tests.outputs.should-run | |
run: | | |
cat ./*profile.out | grep -v "mode: atomic" >> coverage.txt | |
- name: filter out DONTCOVER | |
if: needs.setup-tests.outputs.should-run | |
run: | | |
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER')" | |
excludelist+=" $(find ./ -type f -name '*.pb.go')" | |
excludelist+=" $(find ./ -type f -name '*.pb.gw.go')" | |
excludelist+=" $(find ./ -type f -path './tests/mocks/*.go')" | |
for filename in ${excludelist}; do | |
filename=$(echo $filename | sed 's/^./github.com\/cosmos\/cosmos-sdk/g') | |
echo "Excluding ${filename} from coverage report..." | |
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt | |
done | |
- uses: codecov/codecov-action@v4 | |
if: needs.setup-tests.outputs.should-run | |
with: | |
file: ./coverage.txt | |
test-race: | |
needs: setup-tests | |
# Note: There's a required check on this, and it must pass. A skip doesn't count as a pass. | |
# So instead of a job-level if: needs.setup-tests.outputs.should-run on this job, | |
# it's in the steps below (except the checkout step). | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
part: ["00", "01", "02", "03", "04"] | |
env: | |
LD_LIBRARY_PATH: /usr/local/lib:/usr/local/lib/x86_64-linux-gnu | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
if: needs.setup-tests.outputs.should-run | |
with: | |
go-version-file: 'go.mod' | |
- uses: actions/download-artifact@v4 | |
if: needs.setup-tests.outputs.should-run | |
with: | |
name: "${{ needs.setup-tests.outputs.file-prefix }}-pkgs.txt.part.${{ matrix.part }}" | |
- name: test & coverage report creation | |
if: needs.setup-tests.outputs.should-run | |
run: | | |
xargs --arg-file=pkgs.txt.part.${{ matrix.part }} go test -mod=readonly -timeout 30m -race -tags='cgo ledger test_ledger_mock' | tee ${{ matrix.part }}-race-output.txt | |
exit "${PIPESTATUS[0]}" | |
- uses: actions/upload-artifact@v4 | |
if: needs.setup-tests.outputs.should-run | |
with: | |
name: "${{ needs.setup-tests.outputs.file-prefix }}-${{ matrix.part }}-race-output" | |
path: ./${{ matrix.part }}-race-output.txt |