-
Notifications
You must be signed in to change notification settings - Fork 51
93 lines (91 loc) · 2.44 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
name: Build & Test
on:
pull_request:
push:
branches:
- main
- "release/**"
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}-test
cancel-in-progress: true
jobs:
cleanup-runs:
runs-on: ubuntu-latest
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.20"
check-latest: true
- uses: actions/checkout@v4
- name: build
run: |
make build
- name: test & coverage report creation
run: |
go test ./... -mod=readonly -timeout 12m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock'
liveness-test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.20"
check-latest: true
- uses: technote-space/get-diff-action@v6
id: git_diff
with:
PATTERNS: |
**/**.go
go.mod
go.sum
# Enable BuildKit
- name: Set BuildKit environment variable
run: |
echo "DOCKER_BUILDKIT=1" >> $GITHUB_ENV
- name: start localnet
run: |
make clean localnet-start
if: env.GIT_DIFF
- name: test liveness
run: |
./contrib/localnet/localnet_liveness.sh 100 3 30 localhost
if: env.GIT_DIFF
upgrade-test:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.20"
check-latest: true
- uses: technote-space/get-diff-action@v6
id: git_diff
with:
PATTERNS: |
app/upgrades/**/*.go
- name: echo diff
run: echo '${{ env.GIT_DIFF }}'
# Enable BuildKit
- name: Set BuildKit environment variable
run: |
echo "DOCKER_BUILDKIT=1" >> $GITHUB_ENV
- name: start localnet
run: |
make clean localnet-start-upgrade
if: env.GIT_DIFF
- name: test upgrade
run: |
chmod +x -R ./contrib/updates
./contrib/updates/upgrade-test.sh
if: env.GIT_DIFF