-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (128 loc) · 3.7 KB
/
javascript-sdk-ci.yml
File metadata and controls
157 lines (128 loc) · 3.7 KB
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
name: JavaScript SDK CI/CD
on:
push:
branches:
- main
paths:
- 'clients/javascript/**'
- '.github/workflows/javascript-sdk-ci.yml'
tags:
- 'javascript-sdk-v*'
pull_request:
paths:
- 'clients/javascript/**'
- '.github/workflows/javascript-sdk-ci.yml'
permissions:
contents: read
jobs:
lint:
name: Lint JavaScript SDK
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
working-directory: clients/javascript
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: clients/javascript/package-lock.json
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npm run lint
- name: Check formatting
run: npm run format:check
- name: Type check
run: npm run typecheck
test:
name: Test JavaScript SDK
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: ['18', '20', '22']
defaults:
run:
working-directory: clients/javascript
steps:
- uses: actions/checkout@v4
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: clients/javascript/package-lock.json
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Generate coverage
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20'
run: npm run test:coverage
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20'
uses: codecov/codecov-action@v4
with:
file: clients/javascript/coverage/lcov.info
flags: javascript-sdk
name: javascript-sdk-coverage
build:
name: Build JavaScript SDK
runs-on: ubuntu-latest
needs: [lint, test]
permissions:
contents: read
defaults:
run:
working-directory: clients/javascript
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: clients/javascript/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build package
run: npm run build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: javascript-sdk-dist
path: clients/javascript/dist/
publish:
name: Publish to npm
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/javascript-sdk-v')
permissions:
contents: read
defaults:
run:
working-directory: clients/javascript
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
cache-dependency-path: clients/javascript/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build package
run: npm run build
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public