Skip to content

Commit ec0f3c9

Browse files
committed
Move all continuous integration to GitHub Actions
Signed-off-by: Jon Koops <[email protected]>
1 parent 2ceb998 commit ec0f3c9

File tree

6 files changed

+162
-631
lines changed

6 files changed

+162
-631
lines changed

.github/actions/setup/action.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Set up workspace
2+
description: Sets up the workspace by installing Node.js and dependencies.
3+
4+
inputs:
5+
node-version:
6+
description: The Node.js version to install.
7+
required: false
8+
default: "lts/*"
9+
10+
runs:
11+
using: composite
12+
steps:
13+
- name: Install Node.js
14+
uses: actions/setup-node@v4
15+
with:
16+
node-version: ${{ matrix.node-version }}
17+
cache: npm
18+
19+
- name: Install dependencies
20+
# Because the lockfile is not compatible between all supported Node.js versions we need to run `npm install`.
21+
# When support for older versions of Node.js is dropped, this can be changed to `npm ci`.
22+
run: npm install
23+
shell: bash

.github/workflows/main.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
branches: [main]
7+
jobs:
8+
lint:
9+
name: Lint
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: Set up workspace
16+
uses: ./.github/actions/setup
17+
18+
- name: Run linter
19+
run: npm run lint
20+
21+
test-node:
22+
name: Test on Node.js ${{ matrix.node-version }}
23+
runs-on: ubuntu-latest
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
node-version: ["0.10", "0.12", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
32+
- name: Set up workspace
33+
uses: ./.github/actions/setup
34+
with:
35+
node-version: ${{ matrix.node-version }}
36+
37+
- name: Run tests
38+
run: npm run test-node
39+
40+
test-browser:
41+
name: Test in browser
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout repository
45+
uses: actions/checkout@v4
46+
47+
- name: Set up workspace
48+
uses: ./.github/actions/setup
49+
50+
- name: Install browsers
51+
run: npx playwright install --with-deps
52+
53+
- name: Run tests
54+
run: npm run test-browser
55+
56+
benchmark:
57+
name: Benchmark
58+
runs-on: ubuntu-latest
59+
permissions:
60+
# To deploy GitHub pages website.
61+
deployments: write
62+
# To update benchmark contents in gh-pages branch.
63+
contents: write
64+
steps:
65+
- name: Checkout repository
66+
uses: actions/checkout@v4
67+
68+
- name: Set up workspace
69+
uses: ./.github/actions/setup
70+
71+
- name: Install browsers
72+
run: npx playwright install --with-deps
73+
74+
- name: Run benchmark
75+
run: npm run benchmark | tee benchmark.txt
76+
77+
- name: Download previous benchmark data
78+
uses: actions/cache@v4
79+
with:
80+
path: ./cache
81+
key: ${{ runner.os }}-benchmark
82+
83+
- name: Store benchmark result
84+
uses: benchmark-action/github-action-benchmark@v1
85+
with:
86+
tool: benchmarkjs
87+
output-file-path: benchmark.txt
88+
external-data-json-path: ./cache/benchmark-data.json
89+
github-token: ${{ secrets.GITHUB_TOKEN }}
90+
alert-threshold: 150%
91+
comment-on-alert: true
92+
fail-on-alert: true
93+
alert-comment-cc-users: "@Stuk"

.github/workflows/pr.yaml

Lines changed: 0 additions & 58 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)