forked from hyperledger-archives/aries-framework-go
-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (134 loc) · 4.45 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
#
# 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-18.04, macOS-10.15]
steps:
- name: Setup Go 1.15
uses: actions/setup-go@v2
with:
go-version: 1.15
id: go
- uses: actions/checkout@v2
- name: Skip tests using docker on macOS (issue-2183)
if: matrix.os == 'macOS-10.15'
run: echo '::set-env name=SKIP_DOCKER::true'
- name: Run unit test
timeout-minutes: 15
run: make unit-test
- name: Upload coverage to Codecov
timeout-minutes: 10
if: matrix.os == 'ubuntu-18.04' && github.repository == 'hyperledger/aries-framework-go'
uses: codecov/codecov-action@v1.0.6
with:
file: ./coverage.txt
unitTestWasm:
name: Unit test wasm
runs-on: ubuntu-18.04
timeout-minutes: 10
steps:
- name: Setup Go 1.15
uses: actions/setup-go@v2
with:
go-version: 1.15
id: go
- uses: actions/checkout@v2
- name: Run unit test wasm
timeout-minutes: 10
run: make unit-test-wasm
bddTest:
name: BDD test
runs-on: ubuntu-18.04
timeout-minutes: 20
steps:
- name: Setup Go 1.15
uses: actions/setup-go@v2
with:
go-version: 1.15
id: go
- name: Setup Node.js
uses: actions/setup-node@v1.4.0
with:
node-version: 12.14.x
registry-url: "https://npm.pkg.github.com"
- uses: actions/checkout@v2
- name: Run BDD test
timeout-minutes: 20
run: |
function logout {
docker logout docker.pkg.github.com
}
trap logout EXIT
echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com --username $GITHUB_ACTOR --password-stdin
make bdd-test
checks:
name: Checks
timeout-minutes: 10
runs-on: ubuntu-18.04
steps:
- name: Setup Go 1.15
uses: actions/setup-go@v2
with:
go-version: 1.15
- uses: actions/checkout@v2
- name: Run checks
timeout-minutes: 10
run: make checks
publish:
name: Publish images and npm packages
if: github.event_name == 'push' && ((github.repository == 'hyperledger/aries-framework-go' && github.ref == 'refs/heads/master') || (github.repository != 'hyperledger/aries-framework-go' && github.ref == 'refs/heads/afg-publish'))
needs: [checks, unitTest, unitTestWasm, bddTest]
runs-on: ubuntu-18.04
timeout-minutes: 10
steps:
- name: Setup Go 1.15
uses: actions/setup-go@v2
with:
go-version: 1.15
id: go
- name: Setup Node.js
uses: actions/setup-node@v1.4.0
with:
node-version: 12.14.x
registry-url: "https://npm.pkg.github.com"
- uses: actions/checkout@v2
- name: Publish docker images
run: |
function logout {
docker logout docker.pkg.github.com
}
trap logout EXIT
source ci/version_var.sh
if [ "${IS_RELEASE}" = true ] || [ "${GITHUB_REF}" = "refs/heads/afg-publish" ]; then
echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com --username $GITHUB_ACTOR --password-stdin
make agent-rest-docker
docker tag aries-framework-go/agent-rest:latest docker.pkg.github.com/${GITHUB_REPOSITORY}/agent-rest:$AGENT_IMAGE_TAG
docker push docker.pkg.github.com/${GITHUB_REPOSITORY}/agent-rest:$AGENT_IMAGE_TAG
fi
- name: Publish npm packages
working-directory: ./cmd/aries-js-worker
run: |
source ../../ci/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 }}