-
Notifications
You must be signed in to change notification settings - Fork 200
192 lines (154 loc) · 6.46 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
183
184
185
186
187
188
189
190
191
192
name: Continuous Integration
on:
pull_request:
branches: [main, '**-pre']
types: [opened, synchronize, reopened, labeled]
push:
branches: [main, '**-pre']
workflow_dispatch:
env:
TEST_AGENT_PUBLIC_DID_SEED: 000000000000000000000000Trustee9
ENDORSER_AGENT_PUBLIC_DID_SEED: 00000000000000000000000Endorser9
GENESIS_TXN_PATH: network/genesis/local-genesis.txn
LIB_INDY_STRG_POSTGRES: /home/runner/work/aries-framework-javascript/indy-sdk/experimental/plugins/postgres_storage/target/release # for Linux
NODE_OPTIONS: --max_old_space_size=4096
# 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:
# PRs created by github actions won't trigger CI. Before we can merge a PR we need to run the tests and
# validation scripts. To still be able to run the CI we can manually trigger it by adding the 'ci-test'
# label to the pull request
ci-trigger:
runs-on: aries-ubuntu-2004
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: aries-ubuntu-2004
name: Validate
steps:
- name: Checkout aries-framework-javascript
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: Check Types
run: yarn check-types
- name: Compile
run: yarn build
integration-test:
runs-on: aries-ubuntu-2004
name: Integration Tests
strategy:
matrix:
node-version: [16.x, 18.x]
steps:
- name: Checkout aries-framework-javascript
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}
endorserSeed: ${ENDORSER_AGENT_PUBLIC_DID_SEED}
- name: Setup Cheqd
uses: ./.github/actions/setup-cheqd
- name: Setup Postgres
uses: ./.github/actions/setup-postgres
- name: Setup Postgres wallet plugin
uses: ./.github/actions/setup-postgres-wallet-plugin
- name: Setup NodeJS
uses: ./.github/actions/setup-node
with:
node-version: ${{ matrix.node-version }}
- name: Add ref-napi resolution in Node18
run: node ./scripts/add-ref-napi-resolution.js
if: matrix.node-version == '18.x'
- name: Install dependencies
run: yarn install
- name: Run tests
run: TEST_AGENT_PUBLIC_DID_SEED=${TEST_AGENT_PUBLIC_DID_SEED} ENDORSER_AGENT_PUBLIC_DID_SEED=${ENDORSER_AGENT_PUBLIC_DID_SEED} GENESIS_TXN_PATH=${GENESIS_TXN_PATH} yarn test --coverage --forceExit --bail
- uses: codecov/codecov-action@v1
if: always()
version-stable:
runs-on: aries-ubuntu-2004
name: Release stable
needs: [integration-test, validate]
if: github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch'
steps:
- name: Checkout aries-framework-javascript
uses: actions/checkout@v2
with:
# pulls all commits (needed for lerna to correctly version)
fetch-depth: 0
# 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 --frozen-lockfile
- name: Git config
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Lerna will use the latest tag to determine the latest released version. As we create a tag for each commit
# we need to remove all pre-release tags so we can determine the last stable release
- name: Remove all pre-release tags
run: git tag -l | grep -vE 'v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$' | xargs git tag -d
# no-private is important to not include the internal packages (demo, sample, etc...)
- name: Update version
run: |
export NEXT_VERSION_BUMP=$(./node_modules/.bin/ts-node ./scripts/get-next-bump.ts)
yarn lerna version --conventional-commits --no-git-tag-version --no-push --yes --exact --no-private $NEXT_VERSION_BUMP
- name: Format lerna changes
run: yarn format
- name: Get updated version
id: new-version
run: |
NEW_VERSION=$(node -p "require('./lerna.json').version")
echo $NEW_VERSION
echo "::set-output name=version::$NEW_VERSION"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
commit-message: |
chore(release): v${{ steps.new-version.outputs.version }}
author: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>'
committer: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>'
branch: lerna-release
signoff: true
title: |
chore(release): v${{ steps.new-version.outputs.version }}
body: |
Release version ${{ steps.new-version.outputs.version }}