-
Notifications
You must be signed in to change notification settings - Fork 170
155 lines (145 loc) · 4.17 KB
/
tests.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
name: Tests
on:
pull_request:
types: [opened, synchronize, reopened, labeled]
merge_group:
types: [checks_requested]
concurrency:
group: ci-${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
install-tparse:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.20"
- uses: actions/cache@v3
id: cache-go-tparse
with:
path: ~/go/bin
key: ${{ runner.os }}-go-tparse-binary
- name: Install tparse
if: steps.cache-go-tparse.outputs.cache-hit != 'true'
run: |
go install github.com/mfridman/tparse@v0.11.1
build:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
targetos: [darwin, linux]
name: umeed ${{ matrix.targetos }}-${{ matrix.arch }}
steps:
- uses: actions/checkout@v3
- name: Cache binaries
id: cache-binaries
uses: actions/cache@v3
with:
path: ./cmd/umeed/umeed
key: umeed-${{ matrix.targetos }}-${{ matrix.arch }}
- uses: technote-space/get-diff-action@v6.1.2
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- name: Setup go
if: steps.cache-binaries.outputs.cache-hit != 'true' && env.GIT_DIFF
uses: actions/setup-go@v4
with:
go-version: "1.20"
cache: true
env:
GOOS: ${{ matrix.targetos }}
GOARCH: ${{ matrix.arch }}
- name: Compile
if: steps.cache-binaries.outputs.cache-hit != 'true' && env.GIT_DIFF
run: |
go mod download
make build
test-unit-cover:
runs-on: ubuntu-latest
needs: install-tparse
steps:
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6.1.2
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/setup-go@v4
if: env.GIT_DIFF
with:
go-version: "1.20"
cache: true
- name: Test and Create Coverage Report
if: env.GIT_DIFF
run: |
EXPERIMENTAL=true make test-unit-cover
- uses: codecov/codecov-action@v3.1.4
if: env.GIT_DIFF
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
fail_ci_if_error: true
verbose: true
test-e2e:
# skip the e2e tests when `skip-e2e-test` label is present on pull request
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-e2e-test') }}
runs-on: ubuntu-latest
needs: install-tparse
timeout-minutes: 25
steps:
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6.1.2
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/setup-go@v4
if: env.GIT_DIFF
with:
go-version: "1.20"
cache: true
- name: Test E2E
if: env.GIT_DIFF
run: |
EXPERIMENTAL=true make test-e2e
liveness-test:
needs: install-tparse
# needs: build-umeed
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6.1.2
id: git_diff
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- name: Cache updated version binary
id: cache-binaries
uses: actions/cache@v3
with:
path: ./cmd/umeed/umeed
key: umeed-linux-amd64
- name: Move new version binary to build folder
if: steps.cache-binaries.outputs.cache-hit == 'true'
run: |
mkdir -p build
cp ./cmd/umeed/umeed ./build/umeed
chmod +x ./build/umeed
- name: Start single node chain
if: env.GIT_DIFF && steps.cache-binaries.outputs.cache-hit == 'true'
run: |
./contrib/scripts/single-node.sh
- name: Test Local Network Liveness
if: env.GIT_DIFF && steps.cache-binaries.outputs.cache-hit == 'true'
run: |
sleep 1m
./contrib/scripts/test_localnet_liveness.sh 50 5 50 localhost:26657