ci: improve test skipping mechanism (#13987)

This commit is contained in:
Julien Robert 2022-11-23 14:39:43 +01:00 committed by GitHub
parent fe5b0ff4a5
commit 2849050e1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 105 additions and 146 deletions

View File

@ -1,18 +0,0 @@
name: Build SimApp
# This workflow allows to skip the build step if the PR does not contain any changes to the code
# See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
on:
pull_request:
paths-ignore:
- "**/*.go"
- "go.mod"
- "go.sum"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-arch: ["amd64", "arm", "arm64"]
steps:
- run: 'echo "No build required"'

View File

@ -2,18 +2,10 @@ name: Build SimApp
# This workflow is run on pushes to main & every Pull Requests where a .go, .mod, .sum have been changed
on:
pull_request:
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
push:
branches:
- main
- release/**
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
permissions:
contents: read
@ -32,9 +24,23 @@ jobs:
- 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: Build
if: env.GIT_DIFF
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make build
- name: Build Legacy
if: env.GIT_DIFF
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false COSMOS_BUILD_OPTIONS=legacy make build
- name: Build Cosmovisor
if: env.GIT_DIFF
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make cosmovisor

View File

@ -1,111 +0,0 @@
name: Tests / Code Coverage
# This workflow allows to skip the test step if the PR does not contain any changes to the code
# See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
on:
pull_request:
paths-ignore:
- "**/*.go"
- "go.mod"
- "go.sum"
concurrency:
group: ci-${{ github.ref }}-tests
cancel-in-progress: true
jobs:
test-submodules:
runs-on: ubuntu-latest
steps:
- run: 'echo "No tests required"'
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
part: ["00", "01", "02", "03"]
steps:
- run: 'echo "No tests required"'
tests-legacy:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
part: ["00", "01", "02", "03"]
steps:
- run: 'echo "No tests required"'
test-integration:
runs-on: ubuntu-latest
steps:
- run: 'echo "No tests required"'
test-e2e:
runs-on: ubuntu-latest
steps:
- run: 'echo "No tests required"'
repo-analysis:
runs-on: ubuntu-latest
steps:
- run: 'echo "No tests required"'
liveness-test:
runs-on: ubuntu-latest
steps:
- run: 'echo "No tests required"'
test-sim-nondeterminism:
runs-on: ubuntu-latest
steps:
- run: 'echo "No tests required"'
##################################
#### Cosmos SDK Go Submodules ####
##################################
test-clientv2:
runs-on: ubuntu-latest
steps:
- run: 'echo "No tests required"'
test-core:
runs-on: ubuntu-latest
steps:
- run: 'echo "No tests required"'
test-depinject:
runs-on: ubuntu-latest
steps:
- run: 'echo "No tests required"'
test-errors:
runs-on: ubuntu-latest
steps:
- run: 'echo "No tests required"'
test-math:
runs-on: ubuntu-latest
steps:
- run: 'echo "No tests required"'
test-simapp:
runs-on: ubuntu-latest
steps:
- run: 'echo "No tests required"'
test-tx:
runs-on: ubuntu-latest
steps:
- run: 'echo "No tests required"'
test-rosetta:
runs-on: ubuntu-latest
steps:
- run: 'echo "No tests required"'
test-cosmovisor:
runs-on: ubuntu-latest
steps:
- run: 'echo "No tests required"'

View File

@ -1,17 +1,9 @@
name: Tests / Code Coverage
on:
pull_request:
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
push:
branches:
- main
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
permissions:
contents: read
@ -61,13 +53,24 @@ jobs:
- 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
@ -84,10 +87,20 @@ jobs:
- 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'
@ -98,10 +111,23 @@ jobs:
- 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
@ -113,41 +139,70 @@ jobs:
- 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, tests-integration, tests-e2e]
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 }}
@ -161,10 +216,23 @@ jobs:
- 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
@ -175,7 +243,19 @@ jobs:
- 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
@ -410,6 +490,8 @@ jobs:
tools/rosetta/**/*.go
tools/rosetta/go.mod
tools/rosetta/go.sum
tools/rosetta/Makefile
Makefile
- name: tests
if: env.GIT_DIFF
run: |