Skip to content

Commit f1e73b0

Browse files
committed
Test different linkedom versions.
1 parent f1c4485 commit f1e73b0

3 files changed

Lines changed: 131 additions & 117 deletions

File tree

.github/workflows/build.yml

Lines changed: 110 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -3,102 +3,115 @@
33
name: Build and Test
44

55
on:
6-
workflow_dispatch:
7-
push:
8-
paths-ignore:
9-
- '.github/**'
10-
- 'README.md'
11-
- 'LICENSE.md'
12-
pull_request:
13-
paths-ignore:
14-
- '.github/**'
15-
- 'README.md'
16-
- 'LICENSE.md'
6+
workflow_dispatch:
7+
push:
8+
paths-ignore:
9+
- ".github/**"
10+
- "README.md"
11+
- "LICENSE.md"
12+
pull_request:
13+
paths-ignore:
14+
- ".github/**"
15+
- "README.md"
16+
- "LICENSE.md"
1717

1818
jobs:
19-
test-node:
20-
name: Test on Node.js ${{ matrix.node-version }}
21-
runs-on: ubuntu-latest
22-
strategy:
23-
matrix:
24-
node-version: [18.x, 20.x, 22.x, 24.x, 25.x]
25-
26-
steps:
27-
- name: Checkout repository
28-
uses: actions/checkout@v4
29-
30-
- name: Set up Node.js ${{ matrix.node-version }}
31-
uses: actions/setup-node@v4
32-
with:
33-
node-version: ${{ matrix.node-version }}
34-
cache: 'npm' # Add caching for npm dependencies
35-
36-
- name: Install Puppeteer Dependencies
37-
run: |
38-
sudo apt-get update
39-
sudo apt-get install -y \
40-
libx11-6 libxcomposite1 libxcursor1 libxdamage1 libxext6 \
41-
libxfixes3 libxi6 libxtst6 libnss3 libglib2.0-0 libgtk-3-0t64 \
42-
libasound2t64 libxrandr2 libpangocairo-1.0-0 libatk1.0-0 \
43-
libatk-bridge2.0-0 libcups2 libdbus-1-3 libdrm2 libgbm1 \
44-
libgdk-pixbuf2.0-0
45-
46-
- name: Install dependencies
47-
run: npm install
48-
49-
- name: Run build
50-
run: npm run build
51-
52-
- name: Run tests
53-
run: npm run test:ci
54-
55-
- name: Generate and upload coverage report
56-
if: matrix.node-version == '22.x' # Only run coverage on the latest LTS version
57-
run: npm run coverage
58-
59-
- name: Upload coverage to Coveralls
60-
if: matrix.node-version == '22.x'
61-
uses: coverallsapp/github-action@v2
62-
with:
63-
github-token: ${{ secrets.GITHUB_TOKEN }}
64-
65-
- name: Upload coverage to Codecov
66-
if: matrix.node-version == '22.x'
67-
uses: codecov/codecov-action@v4
68-
with:
69-
token: ${{ secrets.CODECOV_TOKEN }}
70-
- name: Upload test results to Codecov
71-
if: ${{ matrix.node-version == '22.x' && !cancelled() }}
72-
uses: codecov/test-results-action@v1
73-
with:
74-
token: ${{ secrets.CODECOV_TOKEN }}
75-
76-
# --- Test on the Bun runtime ---
77-
test-bun:
78-
name: Test on Bun
79-
runs-on: ubuntu-latest
80-
steps:
81-
- name: Checkout repository
82-
uses: actions/checkout@v4
83-
84-
- name: Set up Bun
85-
uses: oven-sh/setup-bun@v1
86-
with:
87-
bun-version: latest # Or a specific version
88-
# Caching is enabled by default with setup-bun
89-
90-
- name: Install Puppeteer Dependencies
91-
run: |
92-
sudo apt-get update
93-
sudo apt-get install -y \
94-
libx11-6 libxcomposite1 libxcursor1 libxdamage1 libxext6 \
95-
libxfixes3 libxi6 libxtst6 libnss3 libglib2.0-0 libgtk-3-0t64 \
96-
libasound2t64 libxrandr2 libpangocairo-1.0-0 libatk1.0-0 \
97-
libatk-bridge2.0-0 libcups2 libdbus-1-3 libdrm2 libgbm1 \
98-
libgdk-pixbuf2.0-0
99-
100-
- name: Install dependencies
101-
run: bun install
102-
103-
- name: Run tests with Bun
104-
run: bun run test:ci
19+
test-node:
20+
name: Test on Node.js ${{ matrix.node-version }}
21+
runs-on: ubuntu-latest
22+
strategy:
23+
matrix:
24+
node-version: [18.x, 20.x, 22.x, 24.x, 25.x]
25+
linkedom-version: [0.13, 0.14, 0.15, 0.16, 0.18]
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
31+
- name: Set up Node.js ${{ matrix.node-version }}
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: ${{ matrix.node-version }}
35+
cache: "npm" # Add caching for npm dependencies
36+
37+
- name: Install Puppeteer Dependencies
38+
run: |
39+
sudo apt-get update
40+
sudo apt-get install -y \
41+
libx11-6 libxcomposite1 libxcursor1 libxdamage1 libxext6 \
42+
libxfixes3 libxi6 libxtst6 libnss3 libglib2.0-0 libgtk-3-0t64 \
43+
libasound2t64 libxrandr2 libpangocairo-1.0-0 libatk1.0-0 \
44+
libatk-bridge2.0-0 libcups2 libdbus-1-3 libdrm2 libgbm1 \
45+
libgdk-pixbuf2.0-0
46+
47+
- name: Install dependencies
48+
run: npm install
49+
50+
- name: Install specific linkedom version
51+
run: npm install linkedom@${{ matrix.linkedom-version }}
52+
53+
- name: Run build
54+
run: npm run build
55+
56+
- name: Run tests
57+
run: npm run test:ci
58+
59+
- name: Generate and upload coverage report
60+
if: matrix.node-version == '24.x' && matrix.linkedom-version == '0.18' # Only run coverage on the latest LTS version
61+
run: npm run coverage
62+
63+
- name: Upload coverage to Coveralls
64+
if: matrix.node-version == '24.x' && matrix.linkedom-version == '0.18'
65+
uses: coverallsapp/github-action@v2
66+
with:
67+
github-token: ${{ secrets.GITHUB_TOKEN }}
68+
69+
- name: Upload coverage to Codecov
70+
if: matrix.node-version == '24.x' && matrix.linkedom-version == '0.18'
71+
uses: codecov/codecov-action@v4
72+
with:
73+
token: ${{ secrets.CODECOV_TOKEN }}
74+
- name: Upload test results to Codecov
75+
if: ${{ matrix.node-version == '24.x' && matrix.linkedom-version == '0.18' && !cancelled() }}
76+
uses: codecov/test-results-action@v1
77+
with:
78+
token: ${{ secrets.CODECOV_TOKEN }}
79+
80+
# --- Test on the Bun runtime ---
81+
test-bun:
82+
name: Test on Bun
83+
runs-on: ubuntu-latest
84+
85+
strategy:
86+
fail-fast: false
87+
matrix:
88+
linkedom-version: [0.13, 0.14, 0.15, 0.16, 0.18]
89+
90+
steps:
91+
- name: Checkout repository
92+
uses: actions/checkout@v4
93+
94+
- name: Set up Bun
95+
uses: oven-sh/setup-bun@v1
96+
with:
97+
bun-version: latest # Or a specific version
98+
# Caching is enabled by default with setup-bun
99+
100+
- name: Install Puppeteer Dependencies
101+
run: |
102+
sudo apt-get update
103+
sudo apt-get install -y \
104+
libx11-6 libxcomposite1 libxcursor1 libxdamage1 libxext6 \
105+
libxfixes3 libxi6 libxtst6 libnss3 libglib2.0-0 libgtk-3-0t64 \
106+
libasound2t64 libxrandr2 libpangocairo-1.0-0 libatk1.0-0 \
107+
libatk-bridge2.0-0 libcups2 libdbus-1-3 libdrm2 libgbm1 \
108+
libgdk-pixbuf2.0-0
109+
110+
- name: Install dependencies
111+
run: bun install
112+
113+
- name: Override linkedom version
114+
run: bun add linkedom@${{ matrix.linkedom-version }}
115+
116+
- name: Run tests with Bun
117+
run: bun run test:ci

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
"open-graph",
3030
"json-ld",
3131
"scraping"
32-
],
33-
"main": "dist/index",
34-
"dependencies": {
35-
"linkedom": "^0.18.12"
36-
},
37-
"peerDependencies": {
38-
"puppeteer": ">=22.0.0 <25.0.0"
32+
],
33+
"main": "dist/index",
34+
"dependencies": {
35+
"linkedom": ">=0.13.7"
36+
},
37+
"peerDependencies": {
38+
"puppeteer": ">=22.0.0 <25.0.0"
3939
},
4040
"peerDependenciesMeta": {
4141
"puppeteer": {
@@ -60,12 +60,13 @@
6060
"ts-node": "^10.9.2",
6161
"typescript": "^5.9.3"
6262
},
63-
"scripts": {
64-
"build": "tsc && terser dist/index.js -o dist/index.js -c -m",
65-
"dev": "tsc -w",
66-
"test": "mocha",
67-
"test:ci": "mocha --reporter mocha-junit-reporter --reporter-options \"mochaFile=./test-report.junit.xml\"",
68-
"coverage": "c8 --reporter=text --reporter=lcov npm test",
63+
"scripts": {
64+
"build": "tsc && terser dist/index.js -o dist/index.js -c -m",
65+
"dev": "tsc -w",
66+
"test:linkedom": "for v in 0.13 0.14 0.15 0.16 0.18; do npm i linkedom@$v && npm test || break; done",
67+
"test": "mocha",
68+
"test:ci": "mocha --reporter mocha-junit-reporter --reporter-options \"mochaFile=./test-report.junit.xml\"",
69+
"coverage": "c8 --reporter=text --reporter=lcov npm test",
6970
"coverage:ci": "c8 --reporter=text --reporter=lcov npm run test:ci"
7071
},
7172
"engines": {

0 commit comments

Comments
 (0)