-
Notifications
You must be signed in to change notification settings - Fork 7
117 lines (96 loc) · 3.77 KB
/
build.yml
File metadata and controls
117 lines (96 loc) · 3.77 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
# .github/workflows/build.yml
name: Build and Test
on:
workflow_dispatch:
push:
paths-ignore:
- ".github/**"
- "README.md"
- "LICENSE.md"
pull_request:
paths-ignore:
- ".github/**"
- "README.md"
- "LICENSE.md"
jobs:
test-node:
name: Test on Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x, 24.x, 25.x]
linkedom-version: [0.13, 0.14, 0.15, 0.16, 0.18]
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: "npm" # Add caching for npm dependencies
- name: Install Puppeteer Dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libx11-6 libxcomposite1 libxcursor1 libxdamage1 libxext6 \
libxfixes3 libxi6 libxtst6 libnss3 libglib2.0-0 libgtk-3-0t64 \
libasound2t64 libxrandr2 libpangocairo-1.0-0 libatk1.0-0 \
libatk-bridge2.0-0 libcups2 libdbus-1-3 libdrm2 libgbm1 \
libgdk-pixbuf2.0-0
- name: Install dependencies
run: npm install
- name: Install specific linkedom version
run: npm install linkedom@${{ matrix.linkedom-version }}
- name: Run build
run: npm run build
- name: Run tests
run: npm run test:ci
- name: Generate and upload coverage report
if: matrix.node-version == '24.x' && matrix.linkedom-version == '0.18' # Only run coverage on the latest LTS version
run: npm run coverage
- name: Upload coverage to Coveralls
if: matrix.node-version == '24.x' && matrix.linkedom-version == '0.18'
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload coverage to Codecov
if: matrix.node-version == '24.x' && matrix.linkedom-version == '0.18'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: ${{ matrix.node-version == '24.x' && matrix.linkedom-version == '0.18' && !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
# --- Test on the Bun runtime ---
test-bun:
name: Test on Bun
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
linkedom-version: [0.13, 0.14, 0.15, 0.16, 0.18]
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest # Or a specific version
# Caching is enabled by default with setup-bun
- name: Install Puppeteer Dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libx11-6 libxcomposite1 libxcursor1 libxdamage1 libxext6 \
libxfixes3 libxi6 libxtst6 libnss3 libglib2.0-0 libgtk-3-0t64 \
libasound2t64 libxrandr2 libpangocairo-1.0-0 libatk1.0-0 \
libatk-bridge2.0-0 libcups2 libdbus-1-3 libdrm2 libgbm1 \
libgdk-pixbuf2.0-0
- name: Install dependencies
run: bun install
- name: Override linkedom version
run: bun add linkedom@${{ matrix.linkedom-version }}
- name: Run tests with Bun
run: bun run test:ci