This repository has been archived by the owner on Apr 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
187 lines (171 loc) · 6.24 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
#
# Copyright SecureKey Technologies Inc. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
name: "agent-sdk ci"
env:
GO_VERSION: 1.17
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
SemanticPullRequest:
name: Semantic Pull Request Check
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Checks:
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Run checks
run: |
echo $PATH
go env
echo ${{ github.workspace }}
echo '//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}' > ~/.npmrc
echo '@hyperledger:registry=https://npm.pkg.github.com' >> ~/.npmrc
echo '@trustbloc-cicd:registry=https://npm.pkg.github.com' >> ~/.npmrc
echo '@trustbloc:registry=https://npm.pkg.github.com' >> ~/.npmrc
make checks
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
UnitTest:
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Run unit test
run: make unit-test
- name: Upload coverage to Codecov
run: |
bash <(curl https://codecov.io/bash)
env:
CODECOV_UPLOAD_TOKEN: ${{ secrets.CODECOV_UPLOAD_TOKEN }}
UnitTestWASM:
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Run WASM unit test
run: make unit-test-wasm
AgentRestAPTest:
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Run agent REST API tests (docker)
run: |
make rest-api-bdd
AgentJSTest:
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Run agent JS tests (npm)
run: |
source ci/version_var.sh
echo '//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}' > ~/.npmrc
echo '@hyperledger:registry=https://npm.pkg.github.com' >> ~/.npmrc
echo '@trustbloc-cicd:registry=https://npm.pkg.github.com' >> ~/.npmrc
echo '@trustbloc:registry=https://npm.pkg.github.com' >> ~/.npmrc
export npm_config_prefix=~/.npm-prefix
echo '127.0.0.1 static-file-server-js' | sudo tee -a /etc/hosts
make aries-js-bdd
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WalletSDKTest:
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Run wallet SDK JS tests (npm)
run: |
source ci/version_var.sh
echo '127.0.0.1 testnet.orb.local' | sudo tee -a /etc/hosts
echo '//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}' > ~/.npmrc
echo '@hyperledger:registry=https://npm.pkg.github.com' >> ~/.npmrc
echo '@trustbloc-cicd:registry=https://npm.pkg.github.com' >> ~/.npmrc
echo '@trustbloc:registry=https://npm.pkg.github.com' >> ~/.npmrc
export npm_config_prefix=~/.npm-prefix
echo '127.0.0.1 static-file-server-js' | sudo tee -a /etc/hosts
make wallet-sdk-tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Publish:
needs: [Checks, UnitTest, UnitTestWasm, AgentJSTest, WalletSDKTest, AgentRestAPTest]
if: github.event_name == 'push' && (github.repository == 'trustbloc/agent-sdk' && github.ref == 'refs/heads/main')
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- run: |
function logout {
docker logout
}
trap logout EXIT
git lfs install
git lfs pull
source ci/version_var.sh
echo $DOCKER_PASSWORD | docker login ghcr.io --username $DOCKER_USER --password-stdin
echo '//npm.pkg.github.com/:_authToken=${DOCKER_PASSWORD}' > ~/.npmrc
echo '@hyperledger:registry=https://npm.pkg.github.com' >> ~/.npmrc
echo '@trustbloc-cicd:registry=https://npm.pkg.github.com' >> ~/.npmrc
echo '@trustbloc:registry=https://npm.pkg.github.com' >> ~/.npmrc
make agent-server-docker
docker tag ghcr.io/trustbloc/agent-sdk-server:latest ${AGENT_SDK_PKG}:${AGENT_SDK_TAG}
docker push ${AGENT_SDK_PKG}:${AGENT_SDK_TAG}
cd ./cmd/agent-js-worker
sed -i 's/"version": "0.1.0"/"version": "'$NPM_PKG_TAG'"/g' package.json
sed -i 's#"name": "@trustbloc/agent-sdk-web"#"name": "@'${NPM_AGENT_PKG_NAME}'"#g' package.json
sed -i 's#"url": "git://github.com/trustbloc/agent-sdk.git"#"url": "git://github.com/'${NPM_PKG_REPO}'.git"#g' package.json
npm install
npm publish
cd ../wallet-js-sdk
sed -i 's/"version": "0.1.0"/"version": "'$NPM_PKG_TAG'"/g' package.json
sed -i 's#"name": "@trustbloc/wallet-sdk"#"name": "@'${NPM_SDK_PKG_NAME}'"#g' package.json
sed -i 's#"url": "git://github.com/trustbloc/agent-sdk.git"#"url": "git://github.com/'${NPM_PKG_REPO}'.git"#g' package.json
npm install
npm publish
env:
DOCKER_USER: ${{ secrets.CR_USER }}
DOCKER_PASSWORD: ${{ secrets.CR_PAT }}
NPM_PKG_TAG: $(NPM_PKG_TAG)
NPM_AGENT_PKG_NAME: $(NPM_AGENT_PKG_NAME)
NPM_SDK_PKG_NAME: $(NPM_SDK_PKG_NAME)
NPM_PKG_REPO: $(NPM_PKG_REPO)