-
Notifications
You must be signed in to change notification settings - Fork 42
171 lines (155 loc) · 4.88 KB
/
ci.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
name: CI
on:
push:
branches:
- "master"
- "staging"
- "trying"
pull_request:
workflow_dispatch:
inputs:
nim_wakunode_image:
description: "Docker hub image name taken from https://hub.docker.com/r/wakuorg/nwaku/tags. Format: wakuorg/nwaku:v0.20.0"
required: false
type: string
env:
NODE_JS: "18"
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: waku-org/js-waku
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_JS }}
- uses: ./.github/actions/npm
- run: npm run build
- run: npm run check
- run: npm run doc
proto:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: waku-org/js-waku
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_JS }}
- uses: ./.github/actions/npm
- name: Generate protobuf code
run: |
npm run proto
npm run fix
- name: Check all protobuf code was committed
shell: bash
run: |
res=$(git status --short --ignore-submodules)
echo -n "'$res'" # For debug purposes
[ $(echo -n "$res"|wc -l) -eq 0 ]
browser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: waku-org/js-waku
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_JS }}
- uses: ./.github/actions/npm
- run: npx playwright install --with-deps
- run: npm run build:esm
- run: npm run test:browser
build_rln_tree:
if: false # This condition disables the job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: waku-org/js-waku
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_JS }}
- name: Check for existing RLN tree artifact
id: check-artifact
uses: actions/github-script@v6
with:
script: |
const artifact = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.runId
});
console.log(artifact);
const foundArtifact = artifact.data.artifacts.find(art => art.name === 'rln_tree.tar.gz');
if (foundArtifact) {
core.setOutput('artifact_id', foundArtifact.id);
core.setOutput('artifact_found', 'true');
} else {
core.setOutput('artifact_found', 'false');
}
- name: Download RLN tree artifact
if: steps.check-artifact.outputs.artifact_found == 'true'
uses: actions/download-artifact@v4
with:
name: rln_tree.tar.gz
path: /tmp
- uses: ./.github/actions/npm
- name: Sync rln tree and save artifact
run: |
mkdir -p /tmp/rln_tree.db
npm run build:esm
npm run sync-rln-tree
tar -czf rln_tree.tar.gz -C /tmp/rln_tree.db .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: rln_tree.tar.gz
path: rln_tree.tar.gz
node:
uses: ./.github/workflows/test-node.yml
secrets: inherit
with:
nim_wakunode_image: ${{ inputs.nim_wakunode_image || 'wakuorg/nwaku:v0.27.0' }}
test_type: node
allure_reports: true
node_optional:
uses: ./.github/workflows/test-node.yml
with:
nim_wakunode_image: ${{ inputs.nim_wakunode_image || 'wakuorg/nwaku:v0.27.0' }}
test_type: node-optional
node_with_nwaku_master:
uses: ./.github/workflows/test-node.yml
with:
nim_wakunode_image: harbor.status.im/wakuorg/nwaku:latest
test_type: nwaku-master
maybe-release:
name: release
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [check, proto, browser, node]
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
command: manifest
monorepo-tags: true
token: ${{ secrets.CI_TOKEN }}
- uses: actions/checkout@v3
with:
repository: waku-org/js-waku
if: ${{ steps.release.outputs.releases_created }}
- uses: actions/setup-node@v3
if: ${{ steps.release.outputs.releases_created }}
with:
node-version: ${{ env.NODE_JS }}
registry-url: "https://registry.npmjs.org"
- run: npm install
if: ${{ steps.release.outputs.releases_created }}
- run: npm run build
if: ${{ steps.release.outputs.releases_created }}
- run: npm run publish
if: ${{ steps.release.outputs.releases_created }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_JS_WAKU_PUBLISH }}