This repository has been archived by the owner on Mar 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 162
219 lines (186 loc) · 5.76 KB
/
build.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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#
# Copyright SecureKey Technologies Inc. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
name: build
on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:
jobs:
unitTest:
name: Unit test
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
matrix:
os: [ubuntu-22.04, macOS-10.15]
steps:
- name: Setup Go 1.20
uses: actions/setup-go@v2
with:
go-version: '1.20'
id: go
- uses: actions/checkout@v3
- name: Skip tests that require Docker on macOS (issue-2183)
if: matrix.os == 'macOS-10.15'
run: echo "SKIP_DOCKER=true" >> $GITHUB_ENV
- name: Run unit test
timeout-minutes: 15
run: make unit-test
- name: Upload coverage to Codecov
timeout-minutes: 10
if: matrix.os == 'ubuntu-22.04' && github.repository == 'hyperledger/aries-framework-go'
uses: codecov/[email protected]
with:
file: ./coverage.out
unitTestUrsa:
name: Unit test (Ursa/CL)
runs-on: ubuntu-22.04
container:
image: ghcr.io/hyperledger/ursa-wrapper-go/uwg-build # a container with libursa installed
timeout-minutes: 15
steps:
- name: Setup Go 1.20
uses: actions/setup-go@v2
with:
go-version: '1.20'
id: go
- uses: actions/checkout@v3
- name: Run unit test (Ursa/CL)
timeout-minutes: 15
run: make unit-test-ursa
unitTestMobile:
name: Unit test (mobile)
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- name: Setup Go 1.20
uses: actions/setup-go@v2
with:
go-version: '1.20'
id: go
- uses: actions/checkout@v3
- name: Run unit test
timeout-minutes: 15
run: make unit-test-mobile
unitTestWasm:
name: Unit test wasm
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Setup Go 1.20
uses: actions/setup-go@v2
with:
go-version: '1.20'
id: go
- uses: actions/checkout@v3
- name: Run unit test wasm
timeout-minutes: 10
run: make unit-test-wasm
bddTest:
name: BDD test
runs-on: ubuntu-22.04
timeout-minutes: 45
steps:
- name: Setup Go 1.20
uses: actions/setup-go@v2
with:
go-version: '1.20'
id: go
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: 12.14.x
registry-url: "https://npm.pkg.github.com"
- uses: actions/checkout@v3
- name: Run BDD test
timeout-minutes: 45
run: |
make bdd-test
- uses: actions/upload-artifact@v2
if: always()
with:
name: logs
path: test/bdd/docker-compose.log
repoLint:
name: repolint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: repolinter
uses: philips-labs/[email protected]
env:
CUSTOM_REPOLINT_FILE: .repolint.json
checks:
name: Checks
timeout-minutes: 10
runs-on: ubuntu-22.04
steps:
- name: Setup Go 1.20
uses: actions/setup-go@v2
with:
go-version: '1.20'
- uses: actions/checkout@v3
- name: Run checks
timeout-minutes: 10
run: make license lint-core generate-openapi-spec
lintComponents:
name: Lint Components
timeout-minutes: 10
runs-on: ubuntu-22.04
steps:
- name: Setup Go 1.20
uses: actions/setup-go@v2
with:
go-version: '1.20'
- uses: actions/checkout@v3
- name: Run lint
timeout-minutes: 10
run: make lint-components
publish:
name: Publish images and npm packages
if: github.event_name == 'push' && ((github.repository == 'hyperledger/aries-framework-go' && github.ref == 'refs/heads/main') || (github.repository != 'hyperledger/aries-framework-go' && github.ref == 'refs/heads/afg-publish'))
needs: [repoLint, checks, lintComponents, unitTest, unitTestWasm, bddTest]
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Setup Go 1.20
uses: actions/setup-go@v2
with:
go-version: '1.20'
id: go
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: 12.14.x
registry-url: "https://npm.pkg.github.com"
- uses: actions/checkout@v3
- name: Publish docker images
run: |
function logout {
docker logout ghcr.io
}
trap logout EXIT
source .github/workflows/version_var.sh
if [ "${IS_RELEASE}" = true ] || [ "${GITHUB_REF}" = "refs/heads/afg-publish" ]; then
echo ${{ secrets.CR_PAT }} | docker login ghcr.io --username ${{ secrets.CR_USER }} --password-stdin
make agent-rest-docker
docker tag aries-framework-go/agent-rest:latest ghcr.io/${GITHUB_REPOSITORY}:$AGENT_IMAGE_TAG
docker push ghcr.io/${GITHUB_REPOSITORY}:$AGENT_IMAGE_TAG
fi
- name: Publish npm packages
working-directory: ./cmd/aries-js-worker
run: |
source ../../.github/workflows/version_var.sh
if [ "${IS_RELEASE}" = true ] || [ "${GITHUB_REF}" = "refs/heads/afg-publish" ]; then
sed -i 's/"version": "0.0.1"/"version": "'$NPM_PKG_TAG'"/g' package.json
sed -i 's#"name": "@hyperledger/aries-framework-go"#"name": "@'${GITHUB_REPOSITORY}'"#g' package.json
sed -i 's#"url": "git://github.com/hyperledger/aries-framework-go.git"#"url": "git://github.com/'${GITHUB_REPOSITORY}'.git"#g' package.json
npm install
npm publish
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}