generated from okp4/template-oss
-
Notifications
You must be signed in to change notification settings - Fork 126
110 lines (90 loc) · 2.49 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
name: Test
on:
workflow_call:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
jobs:
check-tests:
runs-on: ubuntu-22.04
outputs:
status: ${{ steps.changed-files.outputs.any_changed == 'true' }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Search for all modified files that involve the execution of tests
id: changed-files
uses: tj-actions/[email protected]
with:
files: |
**/*.go
go.mod
go.sum
Makefile
test-go:
runs-on: ubuntu-22.04
needs: check-tests
if: needs.check-tests.outputs.status
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup Go environment
uses: actions/[email protected]
with:
go-version: "1.21"
- name: Test go project
run: |
make test-go
- name: Upload coverage
uses: codecov/codecov-action@v4
if: github.actor != 'dependabot[bot]'
with:
files: ./target/coverage.txt
env_vars: OS,GOLANG
fail_ci_if_error: false
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
test-blockchain:
runs-on: ubuntu-22.04
timeout-minutes: 10
needs: check-tests
if: needs.check-tests.outputs.status
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install jq
run: sudo apt-get install jq
- name: Setup Go environment
uses: actions/[email protected]
with:
go-version: "1.21"
- name: Install AXONE blockchain
run: |
make build && make install
- name: Initialize blockchain
run: |
make chain-init
- name: Start the blockchain
run: |
make chain-start&
- name: Wait for blockchain to start
uses: ifaxity/wait-on-action@v1
with:
resource: http://0.0.0.0:26657/status
timeout: 10000 # ms
- name: Verify blockchain startup
run: |
STATUS=$(curl http://0.0.0.0:26657/status)
CHECK=$(echo $STATUS | jq '.result.validator_info | has("address")')
if [ $CHECK != "true" ]; then
echo "❌ Blockchain test failed"
echo "$STATUS"
exit -1
fi
- name: Stop the blockchain
run: |
make chain-stop