Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: update test workflow #1449

Merged
merged 2 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 0 additions & 72 deletions .github/workflows/automated-tests.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/build.yml

This file was deleted.

239 changes: 239 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
name: Test
on:
workflow_call:
pull_request:
push:
branches:
- main
- release/v*
- feat/*

permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}-tests
cancel-in-progress: true

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.20"
check-latest: true
cache: true
cache-dependency-path: go.sum
- uses: technote-space/[email protected]
id: git_diff
with:
PATTERNS: |
**/*.proto
**/*.go
go.mod
go.sum
**/go.mod
**/go.sum
**/Makefile
Makefile
- uses: actions/[email protected]
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.mod') }}
restore-keys: |
${{ runner.os }}-go-
- name: proto check
run: make proto-check
- name: test & coverage report creation
if: env.GIT_DIFF
run: |
make test-unit-cov
- uses: actions/upload-artifact@v3
if: env.GIT_DIFF
with:
name: "${{ github.sha }}-coverage"
path: ./profile.out

test-integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.20"
check-latest: true
cache: true
cache-dependency-path: go.sum
- uses: technote-space/[email protected]
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: ./integration-profile.out

test-difference:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.20"
check-latest: true
cache: true
cache-dependency-path: go.sum
- uses: technote-space/[email protected]
id: git_diff
with:
PATTERNS: |
**/*.go
go.mod
go.sum
**/go.mod
**/go.sum
**/Makefile
Makefile
- name: difference tests
if: env.GIT_DIFF
run: |
make test-difference-cov
- uses: actions/upload-artifact@v3
if: env.GIT_DIFF
with:
name: "${{ github.sha }}-difference-coverage"
path: ./difference-profile.out

repo-analysis:
runs-on: ubuntu-latest
needs: [tests, test-integration, test-difference]
steps:
- uses: actions/checkout@v4
- uses: technote-space/[email protected]
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 }}-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 }}-difference-coverage"
continue-on-error: true
- name: sonarcloud
if: ${{ env.GIT_DIFF && !github.event.pull_request.draft }}
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

test-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: checkout LFS objects
run: git lfs checkout
- uses: actions/setup-go@v4
with:
go-version: "1.20"
check-latest: true
cache: true
cache-dependency-path: go.sum
- uses: technote-space/[email protected]
id: git_diff
with:
PATTERNS: |
**/*.go
go.mod
go.sum
**/go.mod
**/go.sum
**/Makefile
Makefile
- name: e2e tests
run: make test-e2e-short

test-cometmock:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: checkout LFS objects
run: git lfs checkout
- uses: actions/setup-go@v4
with:
go-version: "1.20"
check-latest: true
cache: true
cache-dependency-path: go.sum
- uses: technote-space/[email protected]
id: git_diff
with:
PATTERNS: |
**/*.go
go.mod
go.sum
**/go.mod
**/go.sum
**/Makefile
Makefile
- name: cometmock tests
run: make test-e2e-short-cometmock

test-trace:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: checkout LFS objects
run: git lfs checkout
- uses: actions/setup-go@v4
with:
go-version: "1.20"
check-latest: true
cache: true
cache-dependency-path: go.sum
- uses: technote-space/[email protected]
id: git_diff
with:
PATTERNS: |
**/*.go
go.mod
go.sum
**/go.mod
**/go.sum
**/Makefile
Makefile
- name: trace-e2e tests
run: make test-trace
31 changes: 21 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,36 @@ install: go.sum
go install $(BUILD_FLAGS) ./cmd/interchain-security-sd

# run all tests: unit, integration, diff, and E2E
test:
go test ./... && go run ./tests/e2e/...
test: test-unit test-integration test-difference test-e2e

# run all unit tests
# shortcut for local development
test-dev: test-unit test-integration test-difference

# run unit tests
test-unit:
go test ./...
go test ./x/... ./app/...

test-unit-cov:
go test ./x/... ./app/... -coverpkg=./... -coverprofile=profile.out -covermode=atomic

# run unit and integration tests
test-short:
go test ./x/... ./app/... ./tests/integration/...
test-integration:
go test ./tests/integration/... -timeout 30m

test-integration-cov:
go test ./tests/integration/... -timeout 30m -coverpkg=./... -coverprofile=integration-profile.out -covermode=atomic

# run difference tests
test-difference:
go test ./tests/difference/... -timeout 30m

test-difference-cov:
go test ./tests/difference/... -timeout 30m -coverpkg=./... -coverprofile=difference-profile.out -covermode=atomic

# run E2E tests
test-e2e:
go run ./tests/e2e/...

# run difference tests
test-diff:
go test ./tests/difference/...

# run only happy path E2E tests
test-e2e-short:
go run ./tests/e2e/... --tc happy-path
Expand Down
Loading
Loading