-
Notifications
You must be signed in to change notification settings - Fork 29
184 lines (165 loc) · 5.87 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: Build and Test
on:
pull_request:
types: [opened, edited, ready_for_review, reopened]
jobs:
run-build-test:
strategy:
fail-fast: false
max-parallel: 8
matrix:
os: [ubuntu-latest, macos-12]
go-version: [1.18]
ignite-version: [v0.23.0, v0.24.0]
name: "Build/Test ${{ matrix.os }}; Go ${{ matrix.go-version }}; Ignite ${{ matrix.ignite-version }}"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: ~${{ matrix.go-version }}
- name: Get changed files for Blockchain modules
id: changed-files-chain
uses: tj-actions/changed-files@v34
with:
since_last_remote_commit: false
files: |
x/**
app/**
cmd/**
proto/bucket/**
proto/registry/**
proto/schema/**
- name: Run build against Release target for macos
if: matrix.os == 'macos-12' && steps.changed-files-chain.outputs.any_changed == 'true'
continue-on-error: false
run: |
sudo curl https://get.ignite.com/cli@${{matrix.ignite-version}}! | sudo bash
go mod download
ignite chain build --release -t darwin:amd64
- name: Run build against Release target for ubuntu
if: matrix.os == 'ubuntu-latest' && steps.changed-files-chain.outputs.any_changed == 'true'
continue-on-error: false
run: |
sudo curl https://get.ignite.com/cli@${{matrix.ignite-version}}! | sudo bash
go mod download
ignite chain build --release -t linux:amd64
run-bind-test:
strategy:
max-parallel: 8
matrix:
platform: [ios, web, android]
build-on: [ubuntu-latest, macos-latest]
go-version: [1.17, 1.18]
# https://github.com/android/ndk/wiki/Unsupported-Downloads && https://developer.android.com/ndk/downloads
ndk-version: [r22b, r23c] # Target is 23, but local is 24 - need solve this
exclude:
# Don't build on incompatible targets
- build-on: ubuntu-latest
platform: ios
- build-on: macos-latest
platform: android
# Don't pollute the build matrix cause of android on ios
- platform: ios
ndk-version: r22b
- platform: ios
ndk-version: r23c
# - platform: ios
# ndk-version: r24
# - platform: ios
# ndk-version: r25b
# Don't pollute the build matrix cause of android on web
- platform: web
ndk-version: r22b
- platform: web
ndk-version: r23c
# - platform: web
# ndk-version: r24
# - platform: web
# ndk-version: r25b
fail-fast: false
name: "Bind ${{ matrix.platform }}; ${{ matrix.build-on }}; Go ${{ matrix.go-version }}; NDK ${{ matrix.ndk-version }}"
runs-on: ${{ matrix.build-on }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get changed files for Motor modules
id: changed-files-motor
uses: tj-actions/changed-files@v34
with:
since_last_remote_commit: false
files: |
internal/**
proto/motor/**
proto/service/**
pkg/motor/**
pkg/crypto/**
pkg/client/**
pkg/did/**
pkg/tx/**
pkg/vault/**
- id: setup-ndk
uses: nttld/setup-ndk@v1
if: matrix.platform == 'android' && steps.changed-files-motor.outputs.any_changed == 'true'
with:
ndk-version: ${{ matrix.ndk-version }}
add-to-path: true
- uses: actions/setup-java@v3
if: matrix.platform == 'android' && steps.changed-files-motor.outputs.any_changed == 'true'
with:
distribution: "temurin" # See 'Supported distributions' for available options
java-version: "17"
- uses: actions/setup-go@v3
with:
go-version: ~${{ matrix.go-version }}
- name: Install Gomobile
if: steps.changed-files-motor.outputs.any_changed == 'true'
run: |
go install golang.org/x/mobile/cmd/gomobile@latest
go install golang.org/x/mobile/cmd/gobind@latest
go get golang.org/x/mobile/cmd/gobind
go get golang.org/x/mobile/cmd/gomobile
gomobile init
env:
GOPROXY: https://proxy.golang.org,direct
GO111MODULE: "on"
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
- name: Test Motor Bind
if: steps.changed-files-motor.outputs.any_changed == 'true'
run: make bind.${{ matrix.platform }}
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run-test-suite:
strategy:
fail-fast: false
max-parallel: 8
matrix:
os: [ubuntu-latest, macos-latest]
go-version: [1.18]
ignite-version: [v0.23.0, v0.24.0]
name: "Test ${{ matrix.os }}; Go ${{ matrix.go-version }}; Ignite ${{ matrix.ignite-version }}"
runs-on: ${{ matrix.os }}
needs:
- run-build-test
- run-bind-test
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: ~${{ matrix.go-version }}
- name: Run tests and evaluate coverage
continue-on-error: true
run: go test -race -coverprofile=coverage.out -covermode=atomic ./...
- name: Run simulate
continue-on-error: true
run: go test -benchmem -run=^$ -bench ^BenchmarkSimulation ./app -NumBlocks=200 -BlockSize 50 -Commit=true -Verbose=true -Enabled=true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3