mirror of
https://github.com/tendermint/tendermint.git
synced 2025-12-23 06:15:19 +00:00
ci: tests (#5577)
- use matrix builds to run multiple test jobs - upload code coverage once not 4 times (produce more accurate codecov reports)
This commit is contained in:
93
.github/workflows/coverage.yml
vendored
93
.github/workflows/coverage.yml
vendored
@@ -14,28 +14,32 @@ jobs:
|
|||||||
- 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-part-1:
|
tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: split-test-files
|
needs: split-test-files
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
part: ["00", "01", "02", "03"]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: technote-space/get-diff-action@v4
|
- uses: technote-space/get-diff-action@v4
|
||||||
@@ -46,20 +50,20 @@ 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 8m -race -coverprofile=coverage.txt -covermode=atomic
|
cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -timeout 8m -race -coverprofile=${{ matrix.part }}profile.out -covermode=atomic
|
||||||
if: env.GIT_DIFF
|
if: env.GIT_DIFF
|
||||||
- uses: codecov/codecov-action@v1.0.13
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
file: ./coverage.txt
|
name: "${{ github.sha }}-${{ matrix.part }}-coverage"
|
||||||
if: env.GIT_DIFF
|
path: ./${{ matrix.part }}profile.out
|
||||||
|
|
||||||
test-coverage-part-2:
|
upload-coverage-report:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: split-test-files
|
needs: tests
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: technote-space/get-diff-action@v4
|
- uses: technote-space/get-diff-action@v4
|
||||||
@@ -70,59 +74,22 @@ jobs:
|
|||||||
go.sum
|
go.sum
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: "${{ github.sha }}-ab"
|
name: "${{ github.sha }}-00-coverage"
|
||||||
if: env.GIT_DIFF
|
if: env.GIT_DIFF
|
||||||
- name: test & coverage report creation
|
|
||||||
run: |
|
|
||||||
cat xab.txt | xargs go test -mod=readonly -timeout 5m -race -coverprofile=coverage.txt -covermode=atomic
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
- uses: codecov/codecov-action@v1.0.13
|
|
||||||
with:
|
|
||||||
file: ./coverage.txt
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
|
|
||||||
test-coverage-part-3:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: split-test-files
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: technote-space/get-diff-action@v4
|
|
||||||
with:
|
|
||||||
PATTERNS: |
|
|
||||||
**/**.go
|
|
||||||
go.mod
|
|
||||||
go.sum
|
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: "${{ github.sha }}-ac"
|
name: "${{ github.sha }}-01-coverage"
|
||||||
if: env.GIT_DIFF
|
if: env.GIT_DIFF
|
||||||
- name: test & coverage report creation
|
|
||||||
run: |
|
|
||||||
cat xac.txt | xargs go test -mod=readonly -timeout 10m -race -coverprofile=coverage.txt -covermode=atomic
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
- uses: codecov/codecov-action@v1.0.13
|
|
||||||
with:
|
|
||||||
file: ./coverage.txt
|
|
||||||
if: env.GIT_DIFF
|
|
||||||
|
|
||||||
test-coverage-part-4:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: split-test-files
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: technote-space/get-diff-action@v4
|
|
||||||
with:
|
|
||||||
PATTERNS: |
|
|
||||||
**/**.go
|
|
||||||
go.mod
|
|
||||||
go.sum
|
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: "${{ github.sha }}-ad"
|
name: "${{ github.sha }}-02-coverage"
|
||||||
if: env.GIT_DIFF
|
if: env.GIT_DIFF
|
||||||
- name: test & coverage report creation
|
- uses: actions/download-artifact@v2
|
||||||
run: |
|
with:
|
||||||
cat xad.txt | xargs go test -mod=readonly -timeout 5m -race -coverprofile=coverage.txt -covermode=atomic
|
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
|
||||||
- uses: codecov/codecov-action@v1.0.13
|
- uses: codecov/codecov-action@v1.0.13
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ coverage:
|
|||||||
precision: 2
|
precision: 2
|
||||||
round: down
|
round: down
|
||||||
range: "70...100"
|
range: "70...100"
|
||||||
notify:
|
github_checks:
|
||||||
after_n_builds: 4
|
annotations: false
|
||||||
|
|
||||||
status:
|
status:
|
||||||
project:
|
project:
|
||||||
|
|||||||
Reference in New Issue
Block a user