-
Notifications
You must be signed in to change notification settings - Fork 11
163 lines (135 loc) · 4.67 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Test
on:
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
- ready_for_review
push:
branches:
- main
release:
types:
- created
env:
TAR_PATH: heighliner.tar
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-test-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.21.5"
- uses: actions/checkout@v4
- name: Unit Tests
run: |
make test
env:
TEST_TARGET: "./x/..."
TEST_ARGS: "-timeout 10m -race -coverprofile=./coverage.out -covermode=atomic -v"
- 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 -name '*.pb.gw.go')"
excludelist+=" $(find ./ -type f -path './tests/mocks/*.go')"
excludelist+=" $(find ./ -type f -path './x/lscosmos/*')"
excludelist+=" $(find ./ -type f -path './x/liquidstake/client/*')"
excludelist+=" $(find ./ -type f -path './x/liquidstakeibc/client/*')"
excludelist+=" $(find ./ -type f -path './x/ratesync/client/*')"
for filename in ${excludelist}; do
filename=$(echo $filename | sed 's/^.\///g')
echo "Excluding ${filename} from coverage report..."
sed -i "/$(echo $filename | sed 's/\//\\\//g')/d" ./coverage.out
done
- name: Convert coverage to lcov
uses: jandelgado/gcov2lcov-action@v1
- name: LCOV Minimum test coverage checker
uses: terencetcf/github-actions-lcov-minimum-coverage-checker@v1
with:
coverage-file: coverage.lcov
minimum-coverage: 70
- name: Coveralls
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.lcov
- name: Code Coverage Report
if: github.event_name == 'pull_request'
uses: vebr/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
lcov-file: coverage.lcov
update-comment: true
build-e2e-environment:
runs-on: ubuntu-latest
steps:
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v8
- name: Build Docker image
uses: strangelove-ventures/[email protected]
with:
registry: # empty registry, image only shared for e2e testing
tag: local # emulate local environment for consistency in interchaintest cases
tar-export-path: ${{ env.TAR_PATH }} # export a tarball that can be uploaded as an artifact for the e2e jobs
platform: linux/amd64 # test runner architecture only
git-ref: ${{ steps.branch-name.outputs.current_branch }}
# Heighliner chains.yaml config
chain: pstake
dockerfile: cosmos
build-target: make install
binaries: |
- /go/bin/pstaked
build-env: |
- LEDGER_ENABLED=false
- BUILD_TAGS=muslc
# Use github actions artifacts for temporary storage of the docker image tarball
- name: Publish Tarball as Artifact
uses: actions/upload-artifact@v4
with:
name: pstake-docker-image
path: ${{ env.TAR_PATH }}
- name: Setup Go with cache
uses: magnetikonline/action-golang-cache@v5
with:
go-version: "1.21.5"
id: go
- name: Checkout repository
uses: actions/checkout@v4
- name: Download dependencies for interchaintest
run: |
cd interchaintest && go mod download
e2e-tests:
needs: build-e2e-environment
runs-on: ubuntu-latest
strategy:
matrix:
# names of `make` commands to run tests
test:
- "e2e-test-basic"
- "e2e-test-ibc-transfer"
fail-fast: false
steps:
# Load the docker image tarball from github actions artifacts and run tests (one runner per test due to matrix)
- name: Download Tarball Artifact
uses: actions/download-artifact@v4
with:
name: pstake-docker-image
- name: Load Docker Image
run: docker image load -i ${{ env.TAR_PATH }}
- name: Setup Go with cache
uses: magnetikonline/action-golang-cache@v5
with:
go-version: "1.21.5"
id: go
- name: Checkout repository
uses: actions/checkout@v4
- name: run test
run: make ${{ matrix.test }}