-
Notifications
You must be signed in to change notification settings - Fork 20
192 lines (168 loc) · 5.57 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
name: Build
on:
pull_request:
branches: [main]
jobs:
verify:
runs-on: macos-latest
steps:
- name: Setup repo
uses: actions/checkout@v3
- name: Verify README generation
uses: momentohq/standards-and-practices/github-actions/oss-readme-template@gh-actions-v2
with:
project_status: official
project_stability: stable
project_type: sdk
sdk_language: JavaScript
dev_docs_slug: nodejs
multiple_sdks: true
- name: Verify README generation for nodejs
uses: momentohq/standards-and-practices/github-actions/oss-readme-template@gh-actions-v2
with:
project_status: official
project_stability: stable
project_type: sdk
sdk_language: Node.js
dev_docs_slug: nodejs
template_file: ./packages/client-sdk-nodejs/README.template.md
output_file: ./packages/client-sdk-nodejs/README.md
- name: Verify README generation for web
uses: momentohq/standards-and-practices/github-actions/oss-readme-template@gh-actions-v2
with:
project_status: official
project_stability: stable
project_type: sdk
sdk_language: "JavaScript Web"
dev_docs_slug: web
template_file: ./packages/client-sdk-web/README.template.md
output_file: ./packages/client-sdk-web/README.md
- name: Commitlint and Other Shared Build Steps
uses: momentohq/standards-and-practices/github-actions/shared-build@gh-actions-v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test:
strategy:
matrix:
node: [18]
name: Test on Node ${{ matrix.node }}
runs-on: macos-latest
env:
TEST_AUTH_TOKEN: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
TEST_SESSION_TOKEN: ${{ secrets.MOMENTO_PREPROD_SESSION_TOKEN }}
TEST_LEGACY_AUTH_TOKEN: ${{ secrets.ALPHA_LEGACY_TEST_AUTH_TOKEN }}
steps:
- name: Setup repo
uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Build and test all packages
run: |
node -v
./scripts/build-and-test-all-packages.sh
- name: Run auth tests for packages
run: |
node -v
./scripts/test-auth-packages.sh
test-examples:
strategy:
matrix:
node: [14, 16, 18]
name: Test examples on node ${{ matrix.node }}
runs-on: macos-latest
env:
# TODO: remove token stored as secret in favor of using a
# momento-local instance that can be spun up for testing
MOMENTO_AUTH_TOKEN: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
steps:
- name: Setup repo
uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Install Deps and Build
id: validation
continue-on-error: true
run: |
pushd examples/nodejs/cache
npm ci
npm run build
npm run validate-examples
popd
pushd examples/nodejs/observability
npm ci
npm run build
npm run validate-examples
popd
pushd examples/nodejs/load-gen
npm ci
npm run build
popd
pushd examples/nodejs/topics
npm ci
npm run build
popd
pushd examples/nodejs/lambda-examples/topics-microservice
npm ci
npm run build
popd
pushd examples/nodejs/mongodb-examples/simple-read-aside
npm ci
npm run build
popd
pushd examples/nodejs/access-control
npm ci
npm run build
npm run validate-examples
popd
pushd examples/nodejs/aws
npm ci
npm run build
popd
- name: Send CI failure mail
if: ${{ steps.validation.outcome == 'failure' }}
uses: momentohq/standards-and-practices/github-actions/error-email-action@gh-actions-v2
with:
username: ${{secrets.MOMENTO_ROBOT_GMAIL_USERNAME}}
password: ${{secrets.MOMENTO_ROBOT_GMAIL_PASSWORD}}
- name: Flag Job Failure
if: ${{ steps.validation.outcome == 'failure' }}
run: exit 1
test-web-examples:
strategy:
matrix:
node: [ 16, 18 ]
name: Test web examples on node ${{ matrix.node }}
runs-on: macos-latest
env:
# TODO: remove token stored as secret in favor of using a
# momento-local instance that can be spun up for testing
MOMENTO_AUTH_TOKEN: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
steps:
- name: Setup repo
uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Install Deps and Build
id: validation
continue-on-error: true
run: |
pushd examples/web/cache
npm ci
npm run build
npm run validate-examples
popd
- name: Send CI failure mail
if: ${{ steps.validation.outcome == 'failure' }}
uses: momentohq/standards-and-practices/github-actions/error-email-action@gh-actions-v2
with:
username: ${{secrets.MOMENTO_ROBOT_GMAIL_USERNAME}}
password: ${{secrets.MOMENTO_ROBOT_GMAIL_PASSWORD}}
- name: Flag Job Failure
if: ${{ steps.validation.outcome == 'failure' }}
run: exit 1