Skip to content

Commit fd44609

Browse files
authored
chore: setup github actions for tests (#854)
PR-URL: #854 Reviewed-By: Michael Dawson <[email protected]>
1 parent c52ace4 commit fd44609

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

.github/workflows/ci.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Node.js CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
strategy:
8+
matrix:
9+
node-version:
10+
- node/10
11+
- node/12
12+
- node/14
13+
- node/15
14+
compiler:
15+
- gcc
16+
- clang
17+
os:
18+
- ubuntu-16.04 # ubuntu-18.04/ubuntu-latest missing package g++-4.9
19+
- macos-latest
20+
runs-on: ${{ matrix.os }}
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Install system dependencies
24+
run: |
25+
if [ "${{ matrix.compiler }}" = "gcc" -a "${{ matrix.os }}" = ubuntu-* ]; then
26+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
27+
sudo apt-get update
28+
sudo apt-get install g++-4.9
29+
fi
30+
- name: Use Node.js ${{ matrix.node-version }}
31+
run: |
32+
git clone --branch v1.4.2 --depth 1 https://github.com/jasongin/nvs ~/.nvs
33+
. ~/.nvs/nvs.sh
34+
nvs --version
35+
nvs add ${{ matrix.node-version }}
36+
nvs use ${{ matrix.node-version }}
37+
node --version
38+
npm --version
39+
npm install
40+
- name: npm test
41+
run: |
42+
if [ "${{ matrix.compiler }}" = "gcc" ]; then
43+
export CC="gcc" CXX="g++"
44+
fi
45+
if [ "${{ matrix.compiler }}" = "gcc" -a "${{ matrix.os }}" = ubuntu-* ]; then
46+
export CC="gcc-4.9" CXX="g++-4.9" AR="gcc-ar-4.9" RANLIB="gcc-ranlib-4.9" NM="gcc-nm-4.9"
47+
fi
48+
if [ "${{ matrix.compiler }}" = "clang" ]; then
49+
export CC="clang" CXX="clang++"
50+
fi
51+
export CFLAGS="$CFLAGS -O3 --coverage" LDFLAGS="$LDFLAGS --coverage"
52+
echo "CFLAGS=\"$CFLAGS\" LDFLAGS=\"$LDFLAGS\""
53+
npm run pretest -- --verbose
54+
node test

.github/workflows/linter.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on: [push, pull_request]
44

55
jobs:
66
lint:
7+
if: github.repository == 'nodejs/node-addon-api'
78
strategy:
89
matrix:
910
node-version: [14.x]

0 commit comments

Comments
 (0)