|
3 | 3 | name: Build and Test |
4 | 4 |
|
5 | 5 | 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" |
17 | 17 |
|
18 | 18 | 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 |
0 commit comments