This repository has been archived by the owner on Apr 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
155 lines (142 loc) · 5.51 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
#
# Copyright SecureKey Technologies Inc. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
name: "adapter 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@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Run checks
run: |
echo $PATH
go env
echo ${{ github.workspace }}
make checks
UnitTest:
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
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 }}
BDDTestIssuerAdapter:
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Run Issuer Adapter BDD test
run: |
echo '127.0.0.1 testnet.orb.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 rp-adapter-rest.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 issuer-adapter-rest.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 issuer-hydra.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 mock-issuer-login.trustbloc.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
make bdd-test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAGS: issuer_adapter
BDDTestRPAdapter:
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Run RP Adapter BDD test
run: |
echo '127.0.0.1 testnet.orb.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 rp-adapter-rest.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 issuer-adapter-rest.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 issuer-hydra.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 mock-issuer-login.trustbloc.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
make bdd-test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAGS: rp_adapter
Publish:
needs: [Checks, UnitTest, BDDTestIssuerAdapter, BDDTestRPAdapter]
if: github.event_name == 'push' && (github.repository == 'trustbloc/adapter' && github.ref == 'refs/heads/main')
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
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 '@trustbloc-cicd:registry=https://npm.pkg.github.com' >> ~/.npmrc
echo '@trustbloc:registry=https://npm.pkg.github.com' >> ~/.npmrc
make issuer-adapter-rest-docker
docker tag ghcr.io/trustbloc/issuer-adapter:latest ${ISSUER_ADAPTER_REST_PKG}:${ADAPTER_REST_TAG}
docker push ${ISSUER_ADAPTER_REST_PKG}:${ADAPTER_REST_TAG}
make rp-adapter-rest-docker
docker tag ghcr.io/trustbloc/rp-adapter:latest ${RP_ADAPTER_REST_PKG}:${ADAPTER_REST_TAG}
docker push ${RP_ADAPTER_REST_PKG}:${ADAPTER_REST_TAG}
cd ./cmd/wallet-adapter-web
sed -i 's/"version": "0.1.0"/"version": "'${NPM_WALLET_PKG_TAG}'"/g' package.json
sed -i 's#"name": "@trustbloc/wallet-adapter-web"#"name": "@'${NPM_WALLET_PKG_NAME}'"#g' package.json
sed -i 's#"url": "git://github.com/trustbloc/edge-adapter.git"#"url": "git://github.com/'${NPM_WALLET_PKG_REPO}'.git"#g' package.json
npm install
npm publish
env:
DOCKER_USER: ${{ secrets.CR_USER }}
DOCKER_PASSWORD: ${{ secrets.CR_PAT }}
NPM_WALLET_PKG_TAG: $(NPM_WALLET_PKG_TAG)
NPM_WALLET_PKG_NAME: $(NPM_WALLET_PKG_NAME)
NPM_WALLET_PKG_REPO: $(NPM_WALLET_PKG_REPO)