ci: upload coverage once (#7690)
This commit is contained in:
parent
e306a852ff
commit
db09e51613
|
@ -7,8 +7,6 @@ coverage:
|
||||||
precision: 2
|
precision: 2
|
||||||
round: down
|
round: down
|
||||||
range: 70...100
|
range: 70...100
|
||||||
notify:
|
|
||||||
after_n_builds: 4
|
|
||||||
|
|
||||||
status:
|
status:
|
||||||
# Learn more at https://docs.codecov.io/docs/commit-status
|
# Learn more at https://docs.codecov.io/docs/commit-status
|
||||||
|
|
|
@ -57,46 +57,41 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-go@v2.1.3
|
|
||||||
with:
|
|
||||||
go-version: 1.15
|
|
||||||
- name: Display go version
|
|
||||||
run: go version
|
|
||||||
- name: Create a file with all the pkgs
|
- name: Create a file with all the pkgs
|
||||||
run: go list ./... > pkgs.txt
|
run: go list ./... > pkgs.txt
|
||||||
- name: Split pkgs into 4 files
|
- name: Split pkgs into 4 files
|
||||||
run: split -n l/4 --additional-suffix=.txt ./pkgs.txt
|
run: split -d -n l/4 pkgs.txt pkgs.txt.part.
|
||||||
# cache multiple
|
# cache multiple
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: "${{ github.sha }}-aa"
|
name: "${{ github.sha }}-00"
|
||||||
path: ./xaa.txt
|
path: ./pkgs.txt.part.00
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: "${{ github.sha }}-ab"
|
name: "${{ github.sha }}-01"
|
||||||
path: ./xab.txt
|
path: ./pkgs.txt.part.01
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: "${{ github.sha }}-ac"
|
name: "${{ github.sha }}-02"
|
||||||
path: ./xac.txt
|
path: ./pkgs.txt.part.02
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: "${{ github.sha }}-ad"
|
name: "${{ github.sha }}-03"
|
||||||
path: ./xad.txt
|
path: ./pkgs.txt.part.03
|
||||||
|
|
||||||
test-coverage-run-1:
|
tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: split-test-files
|
needs: split-test-files
|
||||||
timeout-minutes: 15
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
part: ["00", "01", "02", "03"]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-go@v2.1.3
|
- uses: actions/setup-go@v2.1.3
|
||||||
with:
|
with:
|
||||||
go-version: 1.15
|
go-version: 1.15
|
||||||
- name: Display go version
|
|
||||||
run: go version
|
|
||||||
- uses: technote-space/get-diff-action@v4
|
- uses: technote-space/get-diff-action@v4
|
||||||
id: git_diff
|
|
||||||
with:
|
with:
|
||||||
PATTERNS: |
|
PATTERNS: |
|
||||||
**/**.go
|
**/**.go
|
||||||
|
@ -104,11 +99,46 @@ jobs:
|
||||||
go.sum
|
go.sum
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: "${{ github.sha }}-aa"
|
name: "${{ github.sha }}-${{ matrix.part }}"
|
||||||
if: env.GIT_DIFF
|
if: env.GIT_DIFF
|
||||||
- name: test & coverage report creation
|
- name: test & coverage report creation
|
||||||
run: |
|
run: |
|
||||||
cat xaa.txt | xargs go test -mod=readonly -timeout 15m -coverprofile=coverage.txt -covermode=atomic -tags='norace ledger test_ledger_mock'
|
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'
|
||||||
|
if: env.GIT_DIFF
|
||||||
|
- uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: "${{ github.sha }}-${{ matrix.part }}-coverage"
|
||||||
|
path: ./${{ matrix.part }}profile.out
|
||||||
|
|
||||||
|
upload-coverage-report:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: tests
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: technote-space/get-diff-action@v4
|
||||||
|
with:
|
||||||
|
PATTERNS: |
|
||||||
|
**/**.go
|
||||||
|
go.mod
|
||||||
|
go.sum
|
||||||
|
- uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: "${{ github.sha }}-00-coverage"
|
||||||
|
if: env.GIT_DIFF
|
||||||
|
- uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: "${{ github.sha }}-01-coverage"
|
||||||
|
if: env.GIT_DIFF
|
||||||
|
- uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: "${{ github.sha }}-02-coverage"
|
||||||
|
if: env.GIT_DIFF
|
||||||
|
- uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: "${{ github.sha }}-03-coverage"
|
||||||
|
if: env.GIT_DIFF
|
||||||
|
- run: |
|
||||||
|
cat ./*profile.out | grep -v "mode: atomic" >> coverage.txt
|
||||||
if: env.GIT_DIFF
|
if: env.GIT_DIFF
|
||||||
- name: filter out DONTCOVER
|
- name: filter out DONTCOVER
|
||||||
run: |
|
run: |
|
||||||
|
@ -121,24 +151,24 @@ jobs:
|
||||||
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt
|
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt
|
||||||
done
|
done
|
||||||
if: env.GIT_DIFF
|
if: env.GIT_DIFF
|
||||||
- uses: codecov/codecov-action@v1.0.14
|
- uses: codecov/codecov-action@v1.0.13
|
||||||
with:
|
with:
|
||||||
file: ./coverage.txt
|
file: ./coverage.txt
|
||||||
if: env.GIT_DIFF
|
if: env.GIT_DIFF
|
||||||
|
|
||||||
test-coverage-run-2:
|
test-race:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: split-test-files
|
needs: split-test-files
|
||||||
timeout-minutes: 15
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
part: ["00", "01", "02", "03"]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-go@v2.1.3
|
- uses: actions/setup-go@v2.1.3
|
||||||
with:
|
with:
|
||||||
go-version: 1.15
|
go-version: 1.15
|
||||||
- name: Display go version
|
|
||||||
run: go version
|
|
||||||
- uses: technote-space/get-diff-action@v4
|
- uses: technote-space/get-diff-action@v4
|
||||||
id: git_diff
|
|
||||||
with:
|
with:
|
||||||
PATTERNS: |
|
PATTERNS: |
|
||||||
**/**.go
|
**/**.go
|
||||||
|
@ -146,235 +176,20 @@ jobs:
|
||||||
go.sum
|
go.sum
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: "${{ github.sha }}-ab"
|
name: "${{ github.sha }}-${{ matrix.part }}"
|
||||||
if: env.GIT_DIFF
|
if: env.GIT_DIFF
|
||||||
- name: test & coverage report creation
|
- name: test & coverage report creation
|
||||||
run: |
|
run: |
|
||||||
cat xab.txt | xargs go test -mod=readonly -timeout 15m -coverprofile=coverage.txt -covermode=atomic -tags='norace ledger test_ledger_mock'
|
cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -timeout 30m -race -tags='cgo ledger test_ledger_mock' > ${{ matrix.part }}-race-output.txt
|
||||||
if: env.GIT_DIFF
|
|
||||||
- name: filter out DONTCOVER
|
|
||||||
run: |
|
|
||||||
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER')"
|
|
||||||
excludelist+=" $(find ./ -type f -name '*.pb.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
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
- uses: codecov/codecov-action@v1.0.14
|
|
||||||
with:
|
|
||||||
file: ./coverage.txt
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
|
|
||||||
test-coverage-run-3:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: split-test-files
|
|
||||||
timeout-minutes: 15
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/setup-go@v2.1.3
|
|
||||||
with:
|
|
||||||
go-version: 1.15
|
|
||||||
- name: Display go version
|
|
||||||
run: go version
|
|
||||||
- uses: technote-space/get-diff-action@v4
|
|
||||||
id: git_diff
|
|
||||||
with:
|
|
||||||
PATTERNS: |
|
|
||||||
**/**.go
|
|
||||||
go.mod
|
|
||||||
go.sum
|
|
||||||
- uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: "${{ github.sha }}-ac"
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
- name: test & coverage report creation
|
|
||||||
run: |
|
|
||||||
cat xac.txt | xargs go test -mod=readonly -timeout 15m -coverprofile=coverage.txt -covermode=atomic -tags='norace ledger test_ledger_mock'
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
- name: filter out DONTCOVER
|
|
||||||
run: |
|
|
||||||
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER')"
|
|
||||||
excludelist+=" $(find ./ -type f -name '*.pb.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
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
- uses: codecov/codecov-action@v1.0.14
|
|
||||||
with:
|
|
||||||
file: ./coverage.txt
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
|
|
||||||
test-coverage-run-4:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: split-test-files
|
|
||||||
timeout-minutes: 15
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/setup-go@v2.1.3
|
|
||||||
with:
|
|
||||||
go-version: 1.15
|
|
||||||
- name: Display go version
|
|
||||||
run: go version
|
|
||||||
- uses: technote-space/get-diff-action@v4
|
|
||||||
id: git_diff
|
|
||||||
with:
|
|
||||||
PATTERNS: |
|
|
||||||
**/**.go
|
|
||||||
go.mod
|
|
||||||
go.sum
|
|
||||||
- uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: "${{ github.sha }}-ad"
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
- name: test & coverage report creation
|
|
||||||
run: |
|
|
||||||
cat xad.txt | xargs go test -mod=readonly -timeout 15m -coverprofile=coverage.txt -covermode=atomic -tags='norace ledger test_ledger_mock'
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
- name: filter out DONTCOVER
|
|
||||||
run: |
|
|
||||||
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER')"
|
|
||||||
excludelist+=" $(find ./ -type f -name '*.pb.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
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
- uses: codecov/codecov-action@v1.0.14
|
|
||||||
with:
|
|
||||||
file: ./coverage.txt
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
|
|
||||||
test-race-1:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: split-test-files
|
|
||||||
timeout-minutes: 30
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/setup-go@v2.1.3
|
|
||||||
with:
|
|
||||||
go-version: 1.15
|
|
||||||
- name: Display go version
|
|
||||||
run: go version
|
|
||||||
- uses: technote-space/get-diff-action@v4
|
|
||||||
id: git_diff
|
|
||||||
with:
|
|
||||||
PATTERNS: |
|
|
||||||
**/**.go
|
|
||||||
go.mod
|
|
||||||
go.sum
|
|
||||||
- uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: "${{ github.sha }}-aa"
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
- name: Run tests with race detector
|
|
||||||
run: cat xaa.txt | xargs go test -mod=readonly -json -timeout 30m -race -tags='cgo ledger test_ledger_mock' > xaa-race-output.txt
|
|
||||||
if: env.GIT_DIFF
|
if: env.GIT_DIFF
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: "${{ github.sha }}-aa-race-output"
|
name: "${{ github.sha }}-${{ matrix.part }}-race-output"
|
||||||
path: ./xaa-race-output.txt
|
path: ./${{ matrix.part }}-race-output.txt
|
||||||
|
|
||||||
test-race-2:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: split-test-files
|
|
||||||
timeout-minutes: 30
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/setup-go@v2.1.3
|
|
||||||
with:
|
|
||||||
go-version: 1.15
|
|
||||||
- name: Display go version
|
|
||||||
run: go version
|
|
||||||
- uses: technote-space/get-diff-action@v4
|
|
||||||
id: git_diff
|
|
||||||
with:
|
|
||||||
PATTERNS: |
|
|
||||||
**/**.go
|
|
||||||
go.mod
|
|
||||||
go.sum
|
|
||||||
- uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: "${{ github.sha }}-ab"
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
- name: Run tests with race detector
|
|
||||||
run: cat xab.txt | xargs go test -mod=readonly -json -timeout 30m -race -tags='cgo ledger test_ledger_mock' > xab-race-output.txt
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
- uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: "${{ github.sha }}-ab-race-output"
|
|
||||||
path: ./xab-race-output.txt
|
|
||||||
|
|
||||||
test-race-3:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: split-test-files
|
|
||||||
timeout-minutes: 30
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/setup-go@v2.1.3
|
|
||||||
with:
|
|
||||||
go-version: 1.15
|
|
||||||
- name: Display go version
|
|
||||||
run: go version
|
|
||||||
- uses: technote-space/get-diff-action@v4
|
|
||||||
id: git_diff
|
|
||||||
with:
|
|
||||||
PATTERNS: |
|
|
||||||
**/**.go
|
|
||||||
go.mod
|
|
||||||
go.sum
|
|
||||||
- uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: "${{ github.sha }}-ac"
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
- name: Run tests with race detector
|
|
||||||
run: cat xac.txt | xargs go test -mod=readonly -json -timeout 30m -race -tags='cgo ledger test_ledger_mock' > xac-race-output.txt
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
- uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: "${{ github.sha }}-ac-race-output"
|
|
||||||
path: ./xac-race-output.txt
|
|
||||||
|
|
||||||
test-race-4:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: split-test-files
|
|
||||||
timeout-minutes: 30
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/setup-go@v2.1.3
|
|
||||||
with:
|
|
||||||
go-version: 1.15
|
|
||||||
- name: Display go version
|
|
||||||
run: go version
|
|
||||||
- uses: technote-space/get-diff-action@v4
|
|
||||||
id: git_diff
|
|
||||||
with:
|
|
||||||
PATTERNS: |
|
|
||||||
**/**.go
|
|
||||||
go.mod
|
|
||||||
go.sum
|
|
||||||
- uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: "${{ github.sha }}-ad"
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
- name: Run tests with race detector
|
|
||||||
run: cat xad.txt | xargs go test -mod=readonly -json -timeout 30m -race -tags='cgo ledger test_ledger_mock' > xad-race-output.txt
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
- uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: "${{ github.sha }}-ad-race-output"
|
|
||||||
path: ./xad-race-output.txt
|
|
||||||
|
|
||||||
race-detector-report:
|
race-detector-report:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [test-race-1, test-race-2, test-race-3, test-race-4, install-tparse]
|
needs: [test-race, install-tparse]
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -387,19 +202,19 @@ jobs:
|
||||||
go.sum
|
go.sum
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: "${{ github.sha }}-aa-race-output"
|
name: "${{ github.sha }}-00-race-output"
|
||||||
if: env.GIT_DIFF
|
if: env.GIT_DIFF
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: "${{ github.sha }}-ab-race-output"
|
name: "${{ github.sha }}-01-race-output"
|
||||||
if: env.GIT_DIFF
|
if: env.GIT_DIFF
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: "${{ github.sha }}-ac-race-output"
|
name: "${{ github.sha }}-02-race-output"
|
||||||
if: env.GIT_DIFF
|
if: env.GIT_DIFF
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: "${{ github.sha }}-ad-race-output"
|
name: "${{ github.sha }}-03-race-output"
|
||||||
if: env.GIT_DIFF
|
if: env.GIT_DIFF
|
||||||
- uses: actions/cache@v2.1.2
|
- uses: actions/cache@v2.1.2
|
||||||
with:
|
with:
|
||||||
|
@ -407,7 +222,7 @@ jobs:
|
||||||
key: ${{ runner.os }}-go-tparse-binary
|
key: ${{ runner.os }}-go-tparse-binary
|
||||||
if: env.GIT_DIFF
|
if: env.GIT_DIFF
|
||||||
- name: Generate test report (go test -race)
|
- name: Generate test report (go test -race)
|
||||||
run: cat xa*-race-output.txt | ~/go/bin/tparse
|
run: cat ./*-race-output.txt | ~/go/bin/tparse
|
||||||
if: env.GIT_DIFF
|
if: env.GIT_DIFF
|
||||||
|
|
||||||
liveness-test:
|
liveness-test:
|
||||||
|
|
|
@ -23,8 +23,10 @@ func NewVersionCommand() *cobra.Command {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var bz []byte
|
var (
|
||||||
var err error
|
bz []byte
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
|
||||||
output, _ := cmd.Flags().GetString(cli.OutputFlag)
|
output, _ := cmd.Flags().GetString(cli.OutputFlag)
|
||||||
switch strings.ToLower(output) {
|
switch strings.ToLower(output) {
|
||||||
|
|
Loading…
Reference in New Issue