Skip to content

Commit 9db0738

Browse files
committed
GitHub Action to run tests on most versions of Node.js
1 parent 475ef4f commit 9db0738

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

.github/workflows/ci.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
2+
# https://github.com/actions/setup-node
3+
# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
4+
5+
name: ci
6+
on:
7+
push:
8+
# branches: [main]
9+
pull_request:
10+
# branches: [main]
11+
workflow_dispatch:
12+
permissions:
13+
contents: read
14+
jobs:
15+
ci:
16+
strategy:
17+
fail-fast: false
18+
matrix: # TODO: Enable 23.x after nodejs/nan#979 or similar.
19+
node-version: [22.x, 21.x, 20.x, 19.x, 18.x, 17.x, 16.x, 15.x]
20+
os: [windows-latest]
21+
include:
22+
# TODO: Enable macOS after nodejs/nan#985 or similar.
23+
# - node-version: lts/*
24+
# os: macos-13 # macOS on Intel
25+
# - node-version: lts/*
26+
# os: macos-latest # macOS on arm64
27+
- node-version: lts/*
28+
os: ubuntu-latest # Linux on x64
29+
- node-version: lts/*
30+
os: ubuntu-24.04-arm # Linux on arm64
31+
- node-version: 14.x
32+
os: windows-2019
33+
- node-version: 13.x
34+
os: windows-2019
35+
- node-version: 12.x
36+
os: windows-2019
37+
- node-version: 11.x
38+
os: windows-2019
39+
- node-version: 10.x
40+
os: windows-2019
41+
- node-version: 8.x
42+
os: windows-2019
43+
runs-on: ${{ matrix.os }}
44+
steps:
45+
- uses: actions/checkout@v4
46+
- uses: actions/setup-node@v4
47+
with:
48+
node-version: ${{ matrix.node-version }}
49+
- run: npm install
50+
# TODO: On Windows Node.js v11 these will fail but `make test` will succeed
51+
- if: matrix.node-version != '11.x'
52+
run: |
53+
npm run-script rebuild-tests
54+
npm test
55+
- run: make test
56+
# TODO: Enable these older versions which require Python 2.
57+
# This workflow properly enables legacy Python the default `python` but the tests still fail.
58+
# See the AppVeyor file for hints.
59+
# python2:
60+
# strategy:
61+
# fail-fast: false
62+
# matrix:
63+
# node-version: [6.x, 5.x, 4.x, 0.12, '0.10']
64+
# runs-on: windows-2019
65+
# env:
66+
# NODE_GYP_FORCE_PYTHON: C:\Python27\python
67+
# PYTHON: C:\Python27\python
68+
# steps:
69+
# - uses: actions/checkout@v4
70+
# - uses: actions/setup-node@v4
71+
# with:
72+
# node-version: ${{ matrix.node-version }}
73+
# - run: |
74+
# choco install python2
75+
# C:\Python27\python --version # Python 2.7.18
76+
# python --version # This is still Python 3
77+
# - name: Prepend Python27 to Windows PATH
78+
# shell: powershell
79+
# run: echo "C:\Python27`n$(Get-Content $env:GITHUB_PATH)" | Set-Content $env:GITHUB_PATH
80+
# - run: python --version # This is now Python 2.7.18!
81+
#
82+
# - if: matrix.node-version == '5.x'
83+
# run: npm -g install npm@3
84+
# - if: matrix.node-version == '0.12' || matrix.node-version == '0.10'
85+
# run: npm -g install npm@2
86+
# - run: npm install
87+
# - run: npm run-script rebuild-tests # These fail!!
88+
# - run: npm test
89+
# - run: make test

0 commit comments

Comments
 (0)