-
Notifications
You must be signed in to change notification settings - Fork 22
224 lines (194 loc) · 6.35 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
220
221
222
223
224
#
# Copyright SecureKey Technologies Inc. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
name: Build
on:
push:
pull_request:
jobs:
unitTest:
name: Unit test
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
matrix:
os: [ubuntu-latest]
steps:
- name: Setup Go 1.21
uses: actions/setup-go@v2
with:
go-version: 1.21
id: go
- uses: actions/checkout@v2
- name: Run unit test
timeout-minutes: 15
run: make unit-test
- name: Upload coverage to Codecov
timeout-minutes: 10
if: matrix.os == 'ubuntu-latest' && github.repository == 'trustbloc/orb'
uses: codecov/[email protected]
with:
file: ./coverage.out
bddTest-cas-local:
name: BDD test cas local
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Setup Go 1.21
uses: actions/setup-go@v2
with:
go-version: 1.21
id: go
- uses: actions/checkout@v2
- name: Run bdd test cas local
timeout-minutes: 60
run: |
echo '127.0.0.1 orb.domain1.com' | sudo tee -a /etc/hosts
echo '127.0.0.1 orb.vct' | sudo tee -a /etc/hosts
wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.6.1.deb
sudo apt install ./mongodb-database-tools-ubuntu2204-x86_64-100.6.1.deb
make bdd-test-cas-local
- uses: actions/upload-artifact@v2
if: always()
with:
name: logs-cas-local
path: test/bdd/docker-compose.log
bddTest-cas-ipfs:
name: BDD test cas ipfs
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Setup Go 1.21
uses: actions/setup-go@v2
with:
go-version: 1.21
id: go
- uses: actions/checkout@v2
- name: Run bdd test cas ipfs
timeout-minutes: 60
run: |
echo '127.0.0.1 orb.domain1.com' | sudo tee -a /etc/hosts
echo '127.0.0.1 orb.vct' | sudo tee -a /etc/hosts
make bdd-test-cas-ipfs
- uses: actions/upload-artifact@v2
if: always()
with:
name: logs-cas-ipfs
path: test/bdd/docker-compose.log
bddTest-versions-maintenance:
name: BDD test protocol versions, maintenance mode
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Setup Go 1.21
uses: actions/setup-go@v2
with:
go-version: 1.21
id: go
- uses: actions/checkout@v2
- name: Run bdd test protocol versions, maintenance mode
timeout-minutes: 60
run: |
echo '127.0.0.1 orb.domain1.com' | sudo tee -a /etc/hosts
echo '127.0.0.1 orb.vct' | sudo tee -a /etc/hosts
make bdd-test-versions-maintenance
- uses: actions/upload-artifact@v2
if: always()
with:
name: logs-versions-maintenance
path: test/bdd/docker-compose.log
checks:
name: Checks
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Setup Go 1.21
uses: actions/setup-go@v2
with:
go-version: 1.21
- uses: actions/checkout@v2
- name: Run checks
timeout-minutes: 10
run: make checks
publish:
name: Publish image
if: github.event_name == 'push' && (github.repository == 'trustbloc/orb' && github.ref == 'refs/heads/main')
needs: [checks, unitTest]
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Setup Go 1.21
uses: actions/setup-go@v2
with:
go-version: 1.21
- uses: actions/checkout@v2
with: { fetch-depth: 0 }
- name: Get current published version
run: |
TAG=$(git describe --tags --always `git rev-list --tags --max-count=1`)
VERSION=$(git rev-parse --short=7 HEAD)
if [[ $TAG == $VERSION ]]; then
TAG=v0.0.0
fi
echo "CURRENT_SEMVER=${TAG:1}" >> $GITHUB_ENV
- name: Bump published version
id: bump_version
uses: christian-draeger/[email protected]
with:
current-version: "${{ env.CURRENT_SEMVER }}"
version-fragment: 'rc'
- name: Set ENV vars
run: |
VERSION=$(git rev-parse --short=7 HEAD)
echo "IMAGE_TAG"=v${{ steps.bump_version.outputs.next-version }}-snapshot-$VERSION >> $GITHUB_ENV
echo "ORB_IMAGE_PREFIX"=ghcr.io/trustbloc-cicd/orb >> $GITHUB_ENV
echo "ORB_DRIVER_IMAGE_PREFIX"=ghcr.io/trustbloc-cicd/orb-did-driver >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Github Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.CR_USER }}
password: ${{ secrets.CR_PAT }}
- name: Build and Push container orb image
uses: docker/build-push-action@v2
with:
context: .
file: ./images/orb/Dockerfile
platforms: linux/amd64,linux/arm64
build-args: |
ALPINE_VER=3.18
GO_VER=1.21
GO_LDFLAGS=-X 'github.com/trustbloc/orb/pkg/nodeinfo.OrbVersion=${{ env.IMAGE_TAG }}' -X 'github.com/trustbloc/orb/pkg/httpserver.BuildVersion=${{ env.IMAGE_TAG }}'
push: true
tags: |
${{ env.ORB_IMAGE_PREFIX }}:${{ env.IMAGE_TAG }}
${{ env.ORB_IMAGE_PREFIX }}:latest
- name: Build and Push orb driver image
uses: docker/build-push-action@v2
with:
context: .
file: ./images/orb-driver/Dockerfile
platforms: linux/amd64,linux/arm64
build-args: |
ALPINE_VER=3.18
GO_VER=1.21
push: true
tags: |
${{ env.ORB_DRIVER_IMAGE_PREFIX }}:${{ env.IMAGE_TAG }}
${{ env.ORB_DRIVER_IMAGE_PREFIX }}:latest
- name: Build binaries
run: make build-orb-cli-binaries
- uses: actions/upload-artifact@v2
with:
name: orb-cli
path: |
./.build/dist/bin/orb-cli-darwin-amd64.tar.gz
./.build/dist/bin/orb-cli-linux-amd64.tar.gz
./.build/dist/bin/orb-cli-linux-arm64.tar.gz
./.build/dist/bin/orb-cli-darwin-arm64.tar.gz