Skip to content

Commit 822b24a

Browse files
authored
add nodejs v22 and v23 to build matrix (#89)
* add nodejs v22 and v23 to build matrix * Update c-sdk to latest commit
1 parent d88eb31 commit 822b24a

29 files changed

+290
-83
lines changed

.github/workflows/build.yml

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ jobs:
4343
- { os: windows-latest, target: "windows", arch: "x64" }
4444
- { os: ubuntu-20.04, target: "linux", arch: "x64" }
4545
- { os: ubuntu-20.04, target: "linux", arch: "arm64" }
46-
- { os: macos-latest, target: "macos", arch: "x64" }
47-
- { os: macos-latest, target: "macos", arch: "arm64" }
48-
node_ver: [ 16, 18, 19, 20, 21]
46+
- { os: macos-13, target: "macos", arch: "x64" }
47+
- { os: macos-14, target: "macos", arch: "arm64" }
48+
node_ver: [ 18, 20, 21, 22, 23 ]
4949
fail-fast: false
5050

5151
steps:
@@ -57,6 +57,11 @@ jobs:
5757
submodules: 'recursive'
5858
# token: ${{ secrets.ZITI_CI_GH_TOKEN }}
5959

60+
- name: macOS tools
61+
if: runner.os == 'macOS'
62+
shell: bash
63+
run: brew install autoconf autoconf-archive automake pkg-config libtool
64+
6065
- name: Setup PkgConfig (Windows)
6166
if: matrix.config.target == 'windows'
6267
run: |
@@ -88,30 +93,34 @@ jobs:
8893
run: echo "date=$(date)" >> $GITHUB_OUTPUT
8994

9095
- name: Install CMake/Ninja
91-
uses: lukka/get-cmake@v3.27.6
96+
uses: lukka/get-cmake@v3.30.1
9297

9398
- name: Run VCPKG
94-
uses: lukka/run-vcpkg@v10
99+
uses: lukka/run-vcpkg@v11
100+
# will use baseline from vcpkg.json
95101
with:
96-
vcpkgGitCommitId: 'c8696863d371ab7f46e213d8f5ca923c4aef2a00'
102+
# get baseline from vcpkg
103+
vcpkgJsonGlob: './vcpkg.json'
97104

98-
- name: gcc version
105+
- name: show versions
99106
run: |
107+
echo ===== gcc =====
100108
gcc --version
101-
- name: cmake version
102-
run: |
109+
echo ===== cmake =====
103110
cmake --version
104-
- name: ninja version
105-
run: |
106-
ninja --version
107-
- name: node version
108-
run: |
109-
node --version
110-
- name: npm version
111-
run: |
112-
npm --version
111+
echo "ninja: $(ninja --version)"
112+
echo "node: $(node --version)"
113+
echo "npm: $(npm --version)"
114+
115+
- name: restore dependencies cache
116+
uses: actions/cache/restore@v4
117+
id: cache-restore
118+
with:
119+
key: deps-${{ matrix.config.target }}-${{ matrix.config.arch }}-${{ hashFiles('./vcpkg.json') }}
120+
path: './vcpkg/packages'
113121

114122
- name: Build NodeJS-SDK
123+
id: buildSDK
115124
run: |
116125
cd ${{ runner.workspace }}/${{ github.event.repository.name }}
117126
npm install
@@ -121,11 +130,33 @@ jobs:
121130
TARGET_ARCH: ${{ matrix.config.arch }}
122131
BUILD_DATE: ${{ steps.date.outputs.date }}
123132

133+
- name: show build result
134+
if: always()
135+
run: echo build result ${{ steps.buildSDK.outcome }}
136+
137+
- name: debug build failure
138+
if: always() && steps.buildSDK.outcome == 'failure'
139+
uses: actions/upload-artifact@v3
140+
with:
141+
name: build-logs-${{ matrix.config.target }}-${{ matrix.config.arch }}
142+
path: |
143+
./vcpkg/buildtrees/**/*.log
144+
./build/**/*log
145+
124146
- name: Hello test
125147
if: matrix.config.arch == 'x64'
126148
run: |
127149
node tests/hello.js
128150
151+
- name: save dependencies cache
152+
uses: actions/cache/save@v4
153+
id: cache-save
154+
# save deps even build has failed
155+
if: always()
156+
with:
157+
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
158+
path: './vcpkg/packages'
159+
129160
- name: upload artifacts
130161
uses: actions/upload-artifact@v3
131162
with:

.gitmodules

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
[submodule "deps/ziti-sdk-c"]
2-
path = deps/ziti-sdk-c
3-
url = https://github.com/openziti/ziti-sdk-c
4-
branch = main

CMakeLists.txt

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,20 @@ endif (WIN32)
2323
file(GLOB SOURCE_FILES ./src/*.c ./src/.cpp)
2424

2525
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC})
26-
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
26+
set_target_properties(${PROJECT_NAME} PROPERTIES
27+
PREFIX ""
28+
SUFFIX ".node"
29+
C_STANDARD 11
30+
POSITION_INDEPENDENT_CODE ON
31+
)
32+
2733
target_include_directories(${PROJECT_NAME}
2834
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include
2935
PRIVATE ${CMAKE_JS_INC}
3036
)
3137

3238
if (WIN32)
3339
target_compile_definitions(${PROJECT_NAME} PRIVATE WIN32_LEAN_AND_MEAN)
34-
35-
#
36-
# nodejs contains all needed libuv stuff
37-
# trick TLSUV to link against it
38-
add_library(libuv::uv SHARED IMPORTED)
39-
set_target_properties(libuv::uv PROPERTIES
40-
IMPORTED_LOCATION ${CMAKE_JS_LIB}
41-
IMPORTED_IMPLIB ${CMAKE_JS_LIB}
42-
)
43-
set(TLSUV_LIBUV_LIB libuv::uv)
4440
endif (WIN32)
4541

4642

@@ -49,7 +45,7 @@ if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET)
4945
execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS})
5046
endif()
5147

52-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/ziti-sdk-c)
48+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps)
5349

5450
target_link_libraries(${PROJECT_NAME} PRIVATE ziti ${CMAKE_JS_LIB})
5551
if (WIN32)

CMakePresets.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"cacheVariables": {
5555
"VCPKG_TARGET_ARCHITECTURE": "arm64",
5656
"VCPKG_TARGET_TRIPLET": "arm64-osx",
57-
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/deps/ziti-sdk-c/toolchains/macOS-arm64.cmake"
57+
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/toolchains/macOS-arm64.cmake"
5858
}
5959
},
6060
{
@@ -66,15 +66,15 @@
6666
"inherits": "ci-linux-x64",
6767
"cacheVariables": {
6868
"VCPKG_TARGET_TRIPLET": "arm64-linux",
69-
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/deps/ziti-sdk-c/toolchains/Linux-arm64.cmake"
69+
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/toolchains/Linux-arm64.cmake"
7070
}
7171
},
7272
{
7373
"name": "ci-linux-arm",
7474
"inherits": "ci-linux-x64",
7575
"cacheVariables": {
7676
"VCPKG_TARGET_TRIPLET": "arm-linux",
77-
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/deps/ziti-sdk-c/toolchains/Linux-arm.cmake"
77+
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/toolchains/Linux-arm.cmake"
7878
}
7979
},
8080
{

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ The `@openziti/ziti-sdk-nodejs` module works with the following Node.js versions
6262
- v19.x
6363
- v20.x
6464
- v21.x
65+
- v22.x
66+
- v23.x
6567

6668
The `@openziti/ziti-sdk-nodejs` module works with the following architectures:
6769
- amd64

deps/CMakeLists.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
include(FetchContent)
2+
3+
if (WIN32)
4+
# nodejs contains all needed libuv stuff
5+
# trick TLSUV to link against it
6+
add_library(libuv::uv SHARED IMPORTED)
7+
set_target_properties(libuv::uv PROPERTIES
8+
IMPORTED_LOCATION ${CMAKE_JS_LIB}
9+
IMPORTED_IMPLIB ${CMAKE_JS_LIB}
10+
)
11+
set(TLSUV_LIBUV_LIB libuv::uv)
12+
13+
# make sure on WIN32 tlsuv uses our definition for libuv
14+
FetchContent_Declare(tlsuv
15+
GIT_REPOSITORY https://github.com/openziti/tlsuv.git
16+
GIT_TAG v0.33.1
17+
PATCH_COMMAND git apply ${CMAKE_CURRENT_SOURCE_DIR}/tlsuv-libuv.patch
18+
)
19+
FetchContent_MakeAvailable(tlsuv)
20+
endif (WIN32)
21+
22+
FetchContent_Declare(ziti
23+
GIT_REPOSITORY https://github.com/openziti/ziti-sdk-c.git
24+
GIT_TAG 1.3.5
25+
)
26+
FetchContent_MakeAvailable(ziti)
27+
28+

deps/tlsuv-libuv.patch

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index f8a0c2f..a07ee13 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -84,21 +84,25 @@ endif()
6+
include(FindPkgConfig)
7+
find_package(PkgConfig)
8+
9+
-find_package(libuv CONFIG QUIET)
10+
-if (libuv_FOUND)
11+
- # newer libuv versions (via VCPKG) have proper namespacing
12+
- if (TARGET libuv::uv_a)
13+
- set(TLSUV_LIBUV_LIB libuv::uv_a)
14+
- elseif (TARGET uv_a)
15+
- set(TLSUV_LIBUV_LIB uv_a)
16+
- elseif (TARGET libuv::uv)
17+
- set(TLSUV_LIBUV_LIB libuv::uv)
18+
+if (TARGET libuv::uv)
19+
+ set(TLSUV_LIBUV_LIB libuv::uv)
20+
+else ()
21+
+ find_package(libuv CONFIG QUIET)
22+
+ if (libuv_FOUND)
23+
+ # newer libuv versions (via VCPKG) have proper namespacing
24+
+ if (TARGET libuv::uv_a)
25+
+ set(TLSUV_LIBUV_LIB libuv::uv_a)
26+
+ elseif (TARGET uv_a)
27+
+ set(TLSUV_LIBUV_LIB uv_a)
28+
+ elseif (TARGET libuv::uv)
29+
+ set(TLSUV_LIBUV_LIB libuv::uv)
30+
+ else()
31+
+ set(TLSUV_LIBUV_LIB uv)
32+
+ endif()
33+
else()
34+
- set(TLSUV_LIBUV_LIB uv)
35+
+ pkg_check_modules(libuv REQUIRED IMPORTED_TARGET libuv)
36+
+ set(TLSUV_LIBUV_LIB PkgConfig::libuv)
37+
endif()
38+
-else()
39+
- pkg_check_modules(libuv REQUIRED IMPORTED_TARGET libuv)
40+
- set(TLSUV_LIBUV_LIB PkgConfig::libuv)
41+
endif()
42+
43+
add_library(tlsuv STATIC

deps/ziti-sdk-c

Lines changed: 0 additions & 1 deletion
This file was deleted.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
{
22
"name": "@openziti/ziti-sdk-nodejs",
33
"description": "A NodeJS-based SDK for delivering secure applications over a Ziti Network",
4-
"version": "0.17.0",
4+
"version": "0.18.0",
55
"main": "./lib/ziti",
66
"scripts": {
7-
"build": "npm run build:init && npm run build:configure && npm run build:make",
8-
"build:init": "git submodule update --init --recursive",
7+
"build": "npm run build:configure && npm run build:make",
98
"build:configure": "run-script-os",
109
"build:configure:windows": "configure",
1110
"build:configure:linux:darwin": "./configure",

0 commit comments

Comments
 (0)