-
Notifications
You must be signed in to change notification settings - Fork 37
182 lines (152 loc) · 6.04 KB
/
continuous-integration.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
name: Continuous Integration
on:
pull_request:
branches: [main, 'afj-**']
types: [opened, synchronize, reopened, labeled]
push:
branches: [main, 'afj-**']
env:
TEST_AGENT_PUBLIC_DID_SEED: 000000000000000000000000Trustee9
GENESIS_TXN_PATH: network/genesis/local-genesis.txn
# Make sure we're not running multiple release steps at the same time as this can give issues with determining the next npm version to release.
# Ideally we only add this to the 'release' job so it doesn't limit PR runs, but github can't guarantee the job order in that case:
# "When concurrency is specified at the job level, order is not guaranteed for jobs or runs that queue within 5 minutes of each other."
concurrency:
group: aries-framework-${{ github.ref }}-${{ github.repository }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
ci-trigger:
runs-on: ubuntu-20.04
outputs:
triggered: ${{ steps.check.outputs.triggered }}
steps:
- name: Determine if CI should run
id: check
run: |
if [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" == "ci-test" ]]; then
export SHOULD_RUN='true'
elif [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" != "ci-test" ]]; then
export SHOULD_RUN='false'
else
export SHOULD_RUN='true'
fi
echo "SHOULD_RUN: ${SHOULD_RUN}"
echo "::set-output name=triggered::${SHOULD_RUN}"
validate:
runs-on: ubuntu-20.04
name: Validate
needs: [ci-trigger]
if: needs.ci-trigger.outputs.triggered == 'true'
steps:
- name: Checkout aries-framework-javascript-ext
uses: actions/checkout@v2
# setup dependencies
- name: Setup Libindy
uses: ./.github/actions/setup-libindy
- name: Setup NodeJS
uses: ./.github/actions/setup-node
with:
node-version: 16
- name: Install dependencies
run: yarn install
- name: Linting
run: yarn lint
- name: Prettier
run: yarn check-format
- name: Compile
run: yarn check-types
integration-test:
runs-on: ubuntu-20.04
name: Integration Tests
needs: [ci-trigger]
if: needs.ci-trigger.outputs.triggered == 'true'
strategy:
matrix:
node-version: [16.x, 18.x]
steps:
- name: Checkout aries-framework-javascript-ext
uses: actions/checkout@v2
# setup dependencies
- name: Setup Libindy
uses: ./.github/actions/setup-libindy
- name: Setup Indy Pool
uses: ./.github/actions/setup-indy-pool
with:
seed: ${TEST_AGENT_PUBLIC_DID_SEED}
- name: Setup NodeJS
uses: ./.github/actions/setup-node
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn install
- name: Run tests for Push notifications
run: TEST_AGENT_PUBLIC_DID_SEED=${TEST_AGENT_PUBLIC_DID_SEED} GENESIS_TXN_PATH=${GENESIS_TXN_PATH} yarn test push-notifications --coverage
- name: Run tests for React hooks
run: TEST_AGENT_PUBLIC_DID_SEED=${TEST_AGENT_PUBLIC_DID_SEED} GENESIS_TXN_PATH=${GENESIS_TXN_PATH} yarn test react-hooks --coverage
- name: Run tests for Redux store
run: TEST_AGENT_PUBLIC_DID_SEED=${TEST_AGENT_PUBLIC_DID_SEED} GENESIS_TXN_PATH=${GENESIS_TXN_PATH} yarn test redux-store --coverage
- name: Run tests for Rest
run: TEST_AGENT_PUBLIC_DID_SEED=${TEST_AGENT_PUBLIC_DID_SEED} GENESIS_TXN_PATH=${GENESIS_TXN_PATH} yarn test rest --coverage
- uses: codecov/codecov-action@v1
if: always()
package-finder:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.repository == 'hyperledger/aries-framework-javascript-ext' && github.event_name == 'push'
needs: [integration-test, validate]
outputs:
packages: ${{ steps.get-packages.outputs.packages }}
steps:
- name: Checkout aries-framework-javascript-ext
uses: actions/checkout@v2
# Some packages need indy-sdk for node as part of yarn install
- name: Setup Libindy
uses: ./.github/actions/setup-libindy
- name: Setup NodeJS
uses: ./.github/actions/setup-node
with:
node-version: 16
- name: Install dependencies
run: yarn install
- id: get-packages
name: Get all NPM packages
run: yarn ts-node ./scripts/getPackages.ts
release-please:
runs-on: ubuntu-latest
needs: [package-finder]
strategy:
fail-fast: false
matrix:
package: ${{fromJson(needs.package-finder.outputs.packages)}}
steps:
- uses: google-github-actions/release-please-action@v2
id: release-please
with:
path: packages/${{ matrix.package }}
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
package-name: ${{ matrix.package }}
bump-minor-pre-major: true
bump-patch-for-minor-pre-major: true
monorepo-tags: true
signoff: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>'
# Initiate release process if release was created
- name: Checkout aries-framework-javascript-ext
uses: actions/checkout@v2
if: ${{ steps.release-please.outputs.release_created }}
# Some packages need indy-sdk for node as part of yarn install
- name: Setup Libindy
uses: ./.github/actions/setup-libindy
if: ${{ steps.release-please.outputs.release_created }}
- name: Setup NodeJS
uses: ./.github/actions/setup-node
with:
node-version: 16
if: ${{ steps.release-please.outputs.release_created }}
- name: Install dependencies
run: yarn install --frozen-lockfile
if: ${{ steps.release-please.outputs.release_created }}
- name: Release to NPM
run: npm publish ./packages/${{ matrix.package }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: ${{ steps.release-please.outputs.release_created }}