-
Notifications
You must be signed in to change notification settings - Fork 9
108 lines (89 loc) · 2.9 KB
/
Copy pathci.yml
File metadata and controls
108 lines (89 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [published]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [20, 22, 24, 25]
exclude:
# Exclude Windows for now (similar to Travis config)
# Remove this exclusion when ready to enable Windows builds
- os: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
# Setup Python for node-gyp (required for native modules)
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
# Linux-specific setup
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential g++-11
echo "CXX=g++-11" >> $GITHUB_ENV
# macOS-specific setup
- name: Setup macOS compiler
if: runner.os == 'macOS'
run: |
echo "CXX=clang++" >> $GITHUB_ENV
# Windows-specific setup (when enabled)
- name: Setup Windows build tools
if: runner.os == 'Windows'
run: |
npm install --global --production windows-build-tools
echo "PYTHON=%USERPROFILE%\.windows-build-tools\python27\python.exe" >> $GITHUB_ENV
- name: Print versions
run: |
node --version
npm --version
echo "CXX: $CXX"
- name: Print C++ compiler version (Unix)
if: runner.os != 'Windows'
run: $CXX --version
# Determine if we should publish binary
- name: Check if should publish binary
id: publish_check
run: |
PUBLISH_BINARY=no
if [[ "${GITHUB_EVENT_NAME}" == "release" ]]; then
PUBLISH_BINARY=yes
fi
echo "PUBLISH_BINARY=$PUBLISH_BINARY" >> $GITHUB_ENV
echo "publish=$PUBLISH_BINARY" >> $GITHUB_OUTPUT
echo "Are we going to publish a binary? -> $PUBLISH_BINARY"
shell: bash
- name: Install dependencies
run: npm install --build-from-source
- name: Compile TypeScript tests
run: npm run tsc
- name: Run tests
run: npm test
# Binary publishing steps (only on releases)
- name: Package binary
if: steps.publish_check.outputs.publish == 'yes'
run: npx node-pre-gyp package
- name: Publish binary to GitHub releases
if: steps.publish_check.outputs.publish == 'yes'
run: npx node-pre-gyp-github publish --release
env:
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Clean up
run: npx node-pre-gyp clean
- name: Test binary installation
if: steps.publish_check.outputs.publish == 'yes'
run: npm install --fallback-to-build=false