537 lines
15 KiB
YAML
537 lines
15 KiB
YAML
name: Tests / Code Coverage
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ci-${{ github.ref }}-tests
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
split-test-files:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.19.2
|
|
- name: Create a file with all core Cosmos SDK pkgs
|
|
run: go list ./... > pkgs.txt
|
|
- name: Split pkgs into 4 files
|
|
run: split -d -n l/4 pkgs.txt pkgs.txt.part.
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: "${{ github.sha }}-00"
|
|
path: ./pkgs.txt.part.00
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: "${{ github.sha }}-01"
|
|
path: ./pkgs.txt.part.01
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: "${{ github.sha }}-02"
|
|
path: ./pkgs.txt.part.02
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: "${{ github.sha }}-03"
|
|
path: ./pkgs.txt.part.03
|
|
|
|
tests:
|
|
runs-on: ubuntu-latest
|
|
needs: split-test-files
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
part: ["00", "01", "02", "03"]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.19.2
|
|
- uses: technote-space/get-diff-action@v6.1.1
|
|
id: git_diff
|
|
with:
|
|
PATTERNS: |
|
|
**/*.go
|
|
go.mod
|
|
go.sum
|
|
**/go.mod
|
|
**/go.sum
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: "${{ github.sha }}-${{ matrix.part }}"
|
|
- name: test & coverage report creation
|
|
if: env.GIT_DIFF
|
|
run: |
|
|
cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -race -timeout 30m -coverprofile=${{ matrix.part }}profile.out -covermode=atomic -tags='ledger test_ledger_mock'
|
|
- uses: actions/upload-artifact@v3
|
|
if: env.GIT_DIFF
|
|
with:
|
|
name: "${{ github.sha }}-${{ matrix.part }}-coverage"
|
|
path: ./${{ matrix.part }}profile.out
|
|
|
|
tests-legacy:
|
|
runs-on: ubuntu-latest
|
|
needs: split-test-files
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
part: ["00", "01", "02", "03"]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.19.2
|
|
- uses: technote-space/get-diff-action@v6.1.1
|
|
id: git_diff
|
|
with:
|
|
PATTERNS: |
|
|
**/*.go
|
|
go.mod
|
|
go.sum
|
|
**/go.mod
|
|
**/go.sum
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: "${{ github.sha }}-${{ matrix.part }}"
|
|
- name: test app (v1)
|
|
if: env.GIT_DIFF
|
|
run: |
|
|
cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -timeout 30m -tags='app_v1 norace ledger test_ledger_mock'
|
|
|
|
test-integration:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.19.2
|
|
- uses: technote-space/get-diff-action@v6.1.1
|
|
id: git_diff
|
|
with:
|
|
PATTERNS: |
|
|
**/*.go
|
|
go.mod
|
|
go.sum
|
|
**/go.mod
|
|
**/go.sum
|
|
**/Makefile
|
|
Makefile
|
|
- name: integration tests
|
|
if: env.GIT_DIFF
|
|
run: |
|
|
make test-integration-cov
|
|
- uses: actions/upload-artifact@v3
|
|
if: env.GIT_DIFF
|
|
with:
|
|
name: "${{ github.sha }}-integration-coverage"
|
|
path: ./tests/integration-profile.out
|
|
|
|
test-e2e:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.19.2
|
|
- uses: technote-space/get-diff-action@v6.1.1
|
|
id: git_diff
|
|
with:
|
|
PATTERNS: |
|
|
**/*.go
|
|
go.mod
|
|
go.sum
|
|
**/go.mod
|
|
**/go.sum
|
|
**/Makefile
|
|
Makefile
|
|
- name: e2e tests
|
|
if: env.GIT_DIFF
|
|
run: |
|
|
make test-e2e-cov
|
|
- uses: actions/upload-artifact@v3
|
|
if: env.GIT_DIFF
|
|
with:
|
|
name: "${{ github.sha }}-e2e-coverage"
|
|
path: ./tests/e2e-profile.out
|
|
|
|
repo-analysis:
|
|
runs-on: ubuntu-latest
|
|
needs: [tests, test-integration, test-e2e]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: technote-space/get-diff-action@v6.1.1
|
|
id: git_diff
|
|
with:
|
|
PATTERNS: |
|
|
**/*.go
|
|
go.mod
|
|
go.sum
|
|
**/go.mod
|
|
**/go.sum
|
|
- uses: actions/download-artifact@v3
|
|
if: env.GIT_DIFF
|
|
with:
|
|
name: "${{ github.sha }}-00-coverage"
|
|
- uses: actions/download-artifact@v3
|
|
if: env.GIT_DIFF
|
|
with:
|
|
name: "${{ github.sha }}-01-coverage"
|
|
- uses: actions/download-artifact@v3
|
|
if: env.GIT_DIFF
|
|
with:
|
|
name: "${{ github.sha }}-02-coverage"
|
|
- uses: actions/download-artifact@v3
|
|
if: env.GIT_DIFF
|
|
with:
|
|
name: "${{ github.sha }}-03-coverage"
|
|
- uses: actions/download-artifact@v3
|
|
if: env.GIT_DIFF
|
|
with:
|
|
name: "${{ github.sha }}-integration-coverage"
|
|
- uses: actions/download-artifact@v3
|
|
if: env.GIT_DIFF
|
|
with:
|
|
name: "${{ github.sha }}-e2e-coverage"
|
|
continue-on-error: true
|
|
- name: sonarcloud
|
|
if: env.GIT_DIFF
|
|
uses: SonarSource/sonarcloud-github-action@master
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
|
|
liveness-test:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.19.2
|
|
- uses: technote-space/get-diff-action@v6.1.1
|
|
id: git_diff
|
|
with:
|
|
PATTERNS: |
|
|
**/*.go
|
|
go.mod
|
|
go.sum
|
|
**/go.mod
|
|
**/go.sum
|
|
**/Makefile
|
|
Makefile
|
|
- name: start localnet
|
|
if: env.GIT_DIFF
|
|
run: |
|
|
make clean localnet-start
|
|
- name: test liveness
|
|
if: env.GIT_DIFF
|
|
run: |
|
|
./contrib/localnet_liveness.sh 100 5 50 localhost
|
|
|
|
test-sim-nondeterminism:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.19.2
|
|
- uses: technote-space/get-diff-action@v6.1.1
|
|
id: git_diff
|
|
with:
|
|
PATTERNS: |
|
|
**/*.go
|
|
go.mod
|
|
go.sum
|
|
**/go.mod
|
|
**/go.sum
|
|
**/Makefile
|
|
Makefile
|
|
- name: test-sim-nondeterminism
|
|
if: env.GIT_DIFF
|
|
run: |
|
|
make test-sim-nondeterminism
|
|
|
|
##################################
|
|
#### Cosmos SDK Go Submodules ####
|
|
##################################
|
|
|
|
# NOTE: The following jobs are used to test the Cosmos SDK Go submodules.
|
|
# They run when there is a diff in their respective directories.
|
|
|
|
test-clientv2:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.19.2
|
|
- uses: technote-space/get-diff-action@v6.1.1
|
|
id: git_diff
|
|
with:
|
|
PATTERNS: |
|
|
client/v2/**/*.go
|
|
client/v2/go.mod
|
|
client/v2/go.sum
|
|
- name: tests
|
|
if: env.GIT_DIFF
|
|
run: |
|
|
cd client/v2
|
|
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./...
|
|
- name: sonarcloud
|
|
if: env.GIT_DIFF
|
|
uses: SonarSource/sonarcloud-github-action@master
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_CLIENT_V2 }}
|
|
with:
|
|
projectBaseDir: client/v2/
|
|
|
|
test-core:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.19.2
|
|
- uses: technote-space/get-diff-action@v6.1.1
|
|
id: git_diff
|
|
with:
|
|
PATTERNS: |
|
|
core/**/*.go
|
|
core/go.mod
|
|
core/go.sum
|
|
- name: tests
|
|
if: env.GIT_DIFF
|
|
run: |
|
|
cd core
|
|
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./...
|
|
- name: sonarcloud
|
|
if: env.GIT_DIFF
|
|
uses: SonarSource/sonarcloud-github-action@master
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_CORE }}
|
|
with:
|
|
projectBaseDir: core/
|
|
|
|
test-depinject:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.19.2
|
|
- uses: technote-space/get-diff-action@v6.1.1
|
|
id: git_diff
|
|
with:
|
|
PATTERNS: |
|
|
depinject/**/*.go
|
|
depinject/go.mod
|
|
depinject/go.sum
|
|
- name: tests
|
|
if: env.GIT_DIFF
|
|
run: |
|
|
cd depinject
|
|
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./...
|
|
- name: sonarcloud
|
|
if: env.GIT_DIFF
|
|
uses: SonarSource/sonarcloud-github-action@master
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_DEPINJECT }}
|
|
|
|
test-errors:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.19.2
|
|
- uses: technote-space/get-diff-action@v6.1.1
|
|
id: git_diff
|
|
with:
|
|
PATTERNS: |
|
|
errors/**/*.go
|
|
errors/go.mod
|
|
errors/go.sum
|
|
- name: tests
|
|
if: env.GIT_DIFF
|
|
run: |
|
|
cd tests
|
|
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./...
|
|
- name: sonarcloud
|
|
if: env.GIT_DIFF
|
|
uses: SonarSource/sonarcloud-github-action@master
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_ERRORS }}
|
|
with:
|
|
projectBaseDir: errors/
|
|
|
|
test-math:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.19.2
|
|
- uses: technote-space/get-diff-action@v6.1.1
|
|
id: git_diff
|
|
with:
|
|
PATTERNS: |
|
|
math/**/*.go
|
|
math/go.mod
|
|
math/go.sum
|
|
- name: tests
|
|
if: env.GIT_DIFF
|
|
run: |
|
|
cd math
|
|
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./...
|
|
- name: sonarcloud
|
|
if: env.GIT_DIFF
|
|
uses: SonarSource/sonarcloud-github-action@master
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_MATH }}
|
|
with:
|
|
projectBaseDir: math/
|
|
|
|
test-simapp:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.19.2
|
|
- uses: technote-space/get-diff-action@v6.1.1
|
|
id: git_diff
|
|
with:
|
|
PATTERNS: |
|
|
simapp/**/*.go
|
|
simapp/go.mod
|
|
simapp/go.sum
|
|
- name: tests simapp
|
|
if: env.GIT_DIFF
|
|
run: |
|
|
cd simapp
|
|
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./...
|
|
- name: tests simapp v1
|
|
if: env.GIT_DIFF
|
|
run: |
|
|
cd simapp
|
|
go test -mod=readonly -timeout 30m -tags='app_v1 norace ledger test_ledger_mock rocksdb_build' ./...
|
|
- name: sonarcloud
|
|
if: env.GIT_DIFF
|
|
uses: SonarSource/sonarcloud-github-action@master
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_SIMAPP }}
|
|
with:
|
|
projectBaseDir: simapp/
|
|
|
|
test-tx:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.19.2
|
|
- uses: technote-space/get-diff-action@v6.1.1
|
|
id: git_diff
|
|
with:
|
|
PATTERNS: |
|
|
tx/**/*.go
|
|
tx/go.mod
|
|
tx/go.sum
|
|
- name: tests
|
|
if: env.GIT_DIFF
|
|
run: |
|
|
cd tx
|
|
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./...
|
|
- name: sonarcloud
|
|
if: env.GIT_DIFF
|
|
uses: SonarSource/sonarcloud-github-action@master
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_TX }}
|
|
with:
|
|
projectBaseDir: tx/
|
|
|
|
test-rosetta:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.19.2
|
|
- uses: technote-space/get-diff-action@v6.1.1
|
|
id: git_diff
|
|
with:
|
|
PATTERNS: |
|
|
tools/rosetta/**/*.go
|
|
tools/rosetta/go.mod
|
|
tools/rosetta/go.sum
|
|
tools/rosetta/Makefile
|
|
Makefile
|
|
- name: tests
|
|
if: env.GIT_DIFF
|
|
run: |
|
|
make test-rosetta
|
|
cd tools/rosetta
|
|
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./...
|
|
- name: sonarcloud
|
|
if: env.GIT_DIFF
|
|
uses: SonarSource/sonarcloud-github-action@master
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_ROSETTA }}
|
|
with:
|
|
projectBaseDir: tools/rosetta/
|
|
|
|
test-cosmovisor:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.19.2
|
|
- uses: technote-space/get-diff-action@v6.1.1
|
|
id: git_diff
|
|
with:
|
|
PATTERNS: |
|
|
tools/cosmovisor/**/*.go
|
|
tools/cosmovisor/go.mod
|
|
tools/cosmovisor/go.sum
|
|
- name: tests
|
|
if: env.GIT_DIFF
|
|
run: |
|
|
cd tools/cosmovisor
|
|
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./...
|
|
- name: sonarcloud
|
|
if: env.GIT_DIFF
|
|
uses: SonarSource/sonarcloud-github-action@master
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_COSMOVISOR }}
|
|
with:
|
|
projectBaseDir: tools/cosmovisor/
|