-
Notifications
You must be signed in to change notification settings - Fork 764
94 lines (81 loc) · 2.51 KB
/
Copy pathnodejs.yml
File metadata and controls
94 lines (81 loc) · 2.51 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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x, 24.x]
steps:
- uses: actions/checkout@v7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
- name: Cache Node Modules
id: cache-node-modules
uses: actions/cache@v6
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
- name: Lint commit message
if: github.ref != 'refs/heads/main' && github.actor != 'dependabot[bot]'
run: git log -1 --pretty=format:"%s" | npx commitlint
- name: Lint code
run: npm run lint
- name: Run all tests
run: npm test
env:
CI: true
- name: Build swagger-client
run: npm run build
- name: Upload commonjs build artifacts
if: startsWith(matrix.node-version, '24')
uses: actions/upload-artifact@v7
with:
name: commonjs
path: ./lib/
commonjs-artifacts-test:
name: commonjs-artifacts-test
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v7
- name: Use Node.js
uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
- name: Cache Node Modules
id: cache-node-modules
uses: actions/cache@v6
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
- name: Download commonjs build artifacts
uses: actions/download-artifact@v8
with:
name: commonjs
- name: Use Node 22.x
uses: actions/setup-node@v7
with:
node-version: 22.x
- name: Run commonjs build artifacts on Node.js 22.x
run: node -p "require('./commonjs')"
- name: Use Node 24.x
uses: actions/setup-node@v7
with:
node-version: 24.x
- name: Run commonjs build artifacts on Node.js 24.x
run: node -p "require('./commonjs')"