-
Notifications
You must be signed in to change notification settings - Fork 5
130 lines (118 loc) · 4.43 KB
/
ci.yml
File metadata and controls
130 lines (118 loc) · 4.43 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux
arch: x64
mac_env: false
- os: ubuntu-24.04-arm
platform: linux
arch: arm64
mac_env: false
- os: macos-latest
platform: darwin
arch: arm64
mac_env: true
- os: windows-latest
platform: win32
arch: x64
mac_env: false
steps:
- name: Checkout nodejs_api
uses: actions/checkout@v4
with:
fetch-depth: 1
path: tools/nodejs_api
submodules: recursive
- name: Fetch ladybug source archive
shell: bash
run: |
curl -fsSL https://github.com/LadybugDB/ladybug/archive/refs/heads/main.tar.gz \
| tar -xz --strip-components=1 --exclude='*/tools/nodejs_api'
# Downloads the ladybug source tree (without a full clone) and extracts
# it into the working directory, excluding tools/nodejs_api since we
# already have it checked out there.
- name: Setup ccache (non-Windows)
if: ${{ matrix.platform != 'win32' }}
uses: hendrikmuhs/ccache-action@v1.2
with:
key: nodejs-${{ runner.os }}-${{ runner.arch }}-${{ github.ref }}
max-size: 2G
create-symlink: true
restore-keys: |
nodejs-${{ runner.os }}-${{ runner.arch }}-refs/heads/main
nodejs-${{ runner.os }}-${{ runner.arch }}-
- name: Install Node.js dependencies (non-Windows)
if: ${{ matrix.platform != 'win32' }}
working-directory: tools/nodejs_api
run: npm i
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.mac_env && '13.3' || '' }}
ARCHFLAGS: ${{ matrix.mac_env && format('-arch {0}', matrix.arch) || '' }}
- name: Install Node.js dependencies (Windows)
if: ${{ matrix.platform == 'win32' }}
working-directory: tools/nodejs_api
run: npm i
- name: Enable long paths (Windows)
if: ${{ matrix.platform == 'win32' }}
run: |
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
git config --system core.longpaths true
shell: pwsh
- name: Set up ccache (Windows)
if: ${{ matrix.platform == 'win32' }}
shell: cmd
run: |
choco install ccache -y
echo CMAKE_C_COMPILER_LAUNCHER=ccache>> %GITHUB_ENV%
echo CMAKE_CXX_COMPILER_LAUNCHER=ccache>> %GITHUB_ENV%
echo CCACHE_DIR=D:\c>> %GITHUB_ENV%
echo CCACHE_TEMPDIR=D:\t>> %GITHUB_ENV%
if not exist D:\c mkdir D:\c
if not exist D:\t mkdir D:\t
ccache --set-config=max_size=2G
ccache --set-config=compression=true
ccache --set-config=cache_dir=D:\c
ccache --set-config=temporary_dir=D:\t
env:
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
- name: Cache ccache directory (Windows)
if: ${{ matrix.platform == 'win32' }}
uses: actions/cache@v4
with:
path: D:\c
key: ${{ runner.os }}-ccache-node-${{ hashFiles('**/CMakeLists.txt', '**/*.cpp', '**/*.h', 'tools/nodejs_api/**') }}
restore-keys: |
${{ runner.os }}-ccache-node-
- name: Build Node.js native module (Windows)
if: ${{ matrix.platform == 'win32' }}
shell: cmd
run: |
powershell.exe -Command "Add-MpPreference -ExclusionPath '${{ github.workspace }}'"
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
ccache -s
make GEN=Ninja nodejs
ccache -s
- name: Build Node.js native module (non-Windows)
if: ${{ matrix.platform != 'win32' }}
run: make GEN=Ninja nodejs
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.mac_env && '13.3' || '' }}
CMAKE_OSX_ARCHITECTURES: ${{ matrix.mac_env && matrix.arch || '' }}
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
- name: Run Node.js tests
working-directory: tools/nodejs_api
run: npm test