Repository navigation
93 lines (77 loc) · 2.28 KB
/
Copy pathnodejs.yml
File metadata and controls
93 lines (77 loc) · 2.28 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
name: build
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
branches:
- master
workflow_dispatch:
env:
CI: true
jobs:
check:
name: Build and check (Node 24)
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v7.0.1
- name: Set Node.js version
uses: actions/setup-node@v7.1.0
with:
node-version-file: .nvmrc
cache: npm
- name: Install npm dependencies
run: npm ci
- name: Build, lint, check types and run tests
run: npm run check
- name: Upload coverage report
uses: actions/upload-artifact@v7.0.2
with:
name: coverage
path: |
coverage/lcov.info
coverage/lcov-report/
if-no-files-found: error
- name: Pack npm artifact
run: |
mkdir artifacts
npm pack --ignore-scripts --pack-destination artifacts
- name: Upload npm artifact
uses: actions/upload-artifact@v7.0.2
with:
name: npm-package
path: artifacts/*.tgz
if-no-files-found: error
runtime:
name: Runtime Node ${{ matrix.node }}
needs: check
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: [20.19.0, 22.12.0, 22, 24, 26]
env:
POSTHTML_PARSER_PACKAGE: ${{ github.workspace }}/consumer/node_modules/posthtml-parser
steps:
- name: Clone repository
uses: actions/checkout@v7.0.1
- name: Set Node.js version
uses: actions/setup-node@v7.1.0
with:
node-version: ${{ matrix.node }}
- name: Download npm artifact
uses: actions/download-artifact@v8.0.2
with:
name: npm-package
path: artifacts
- name: Install production package
run: |
mkdir consumer
node -e 'require("node:fs").writeFileSync("consumer/package.json", JSON.stringify({ private: true }))'
npm install --prefix consumer --ignore-scripts --omit=dev "$GITHUB_WORKSPACE"/artifacts/*.tgz
- name: Run all parser tests against the installed package
run: npm run test:unit
- name: Check CommonJS and ESM loading
run: npm run test:package