Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 38 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ permissions:
jobs:
build:
name: 'Build a package'
runs-on: windows-latest
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
- name: Show GitHub context
Expand All @@ -47,11 +47,46 @@ jobs:
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1
- name: Configure
run: cmake -H"${{ github.workspace }}" -B"${{env.BUILD_DIRECTORY}}" -G"Visual Studio 17 2022" -A x64 -DNODEJS_VERSION="${{env.ELECTRON_VERSION}}" -DCMAKE_INSTALL_PREFIX="${{env.INSTALL_PACKAGE_PATH}}"
run: cmake -H"${{ github.workspace }}" -B"${{env.BUILD_DIRECTORY}}" -G"Visual Studio 17 2022" -A x64 -DNODEJS_VERSION="${{env.ELECTRON_VERSION}}" -DNODE_LIBUIOHOOK_BUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX="${{env.INSTALL_PACKAGE_PATH}}"
env:
INSTALL_PACKAGE_PATH: "${{env.BUILD_DIRECTORY}}/${{env.DISTRIBUTE_DIRECTORY}}/${{env.PACKAGE_DIRECTORY}}"
- name: Build
run: cmake --build "${{env.BUILD_DIRECTORY}}" --target install --config ${{env.BUILD_CONFIGURATION}}
# TODO: Remove the Electron 29 compatibility checks as soon as the Electron 43 migration is complete.
- name: Install exact Electron 29 test runtime
run: npm install --prefix "${{ runner.temp }}/electron29" --no-save electron@29.4.3
- name: Test hotkey callbacks with Electron 29
run: node test/run_electron_test.js "${{ runner.temp }}/electron29/node_modules/electron/dist/electron.exe" test/test_hotkey_win.js build/RelWithDebInfo/node_libuiohook.node build/RelWithDebInfo/node_libuiohook_send_input.exe
env:
EXPECTED_ELECTRON_VERSION: '29.4.3'
- name: Test hotkey teardown with Electron 29
run: node test/run_electron_test.js "${{ runner.temp }}/electron29/node_modules/electron/dist/electron.exe" test/test_hotkey_teardown_win.js build/RelWithDebInfo/node_libuiohook.node build/RelWithDebInfo/node_libuiohook_send_input.exe
env:
EXPECTED_ELECTRON_VERSION: '29.4.3'
- name: Test worker hotkey callbacks with Electron 29
run: node test/run_electron_test.js "${{ runner.temp }}/electron29/node_modules/electron/dist/electron.exe" test/test_hotkey_worker_win.js build/RelWithDebInfo/node_libuiohook.node build/RelWithDebInfo/node_libuiohook_send_input.exe
env:
EXPECTED_ELECTRON_VERSION: '29.4.3'
- name: Install Node.js 22 for Electron 43
uses: actions/setup-node@v4
with:
node-version: '22.12.0'
- name: Install Electron 43 test runtime
run: |
npm install --prefix "${{ runner.temp }}/electron43" --no-save electron@43.2.0
npx --prefix "${{ runner.temp }}/electron43" install-electron --no
- name: Test hotkey callbacks with Electron 43
run: node test/run_electron_test.js "${{ runner.temp }}/electron43/node_modules/electron/dist/electron.exe" test/test_hotkey_win.js build/RelWithDebInfo/node_libuiohook.node build/RelWithDebInfo/node_libuiohook_send_input.exe
env:
EXPECTED_ELECTRON_VERSION: '43.2.0'
- name: Test hotkey teardown with Electron 43
run: node test/run_electron_test.js "${{ runner.temp }}/electron43/node_modules/electron/dist/electron.exe" test/test_hotkey_teardown_win.js build/RelWithDebInfo/node_libuiohook.node build/RelWithDebInfo/node_libuiohook_send_input.exe
env:
EXPECTED_ELECTRON_VERSION: '43.2.0'
- name: Test worker hotkey callbacks with Electron 43
run: node test/run_electron_test.js "${{ runner.temp }}/electron43/node_modules/electron/dist/electron.exe" test/test_hotkey_worker_win.js build/RelWithDebInfo/node_libuiohook.node build/RelWithDebInfo/node_libuiohook_send_input.exe
env:
EXPECTED_ELECTRON_VERSION: '43.2.0'
- name: Put version into package.json
if: startsWith(github.ref, 'refs/tags/')
run: node ci/bump-version.js "${{ steps.get_version.outputs.VERSION }}" "${{env.PACKAGE_PATH}}"
Expand Down Expand Up @@ -218,4 +253,4 @@ jobs:
- name: Deploy
run: aws s3 cp ${{env.TARGET_ARTIFACT}}.tar.gz s3://${{env.RELEASE_BUCKET}} --acl public-read
env:
TARGET_ARTIFACT: ${{env.PACKAGE_NAME}}-${{ steps.get_version.outputs.VERSION }}-${{env.OS_TAG}}-${{ matrix.arch }}
TARGET_ARTIFACT: ${{env.PACKAGE_NAME}}-${{ steps.get_version.outputs.VERSION }}-${{env.OS_TAG}}-${{ matrix.arch }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules
build
.yarn/
.yarnrc.yml
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.14)
project(node_libuiohook)

if(APPLE)
Expand All @@ -22,6 +22,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")

SET(NODEJS_URL "https://artifacts.electronjs.org/headers/dist" CACHE STRING "Node.JS URL")
SET(NODEJS_NAME "iojs" CACHE STRING "Node.JS Name")
# TODO: Remove the Electron 29 build target and package dependency as soon as the Electron 43 migration is complete.
SET(NODEJS_VERSION "v29.4.3" CACHE STRING "Node.JS Version")

include(NodeJS)
Expand Down Expand Up @@ -95,6 +96,11 @@ target_compile_definitions(
PRIVATE BUILDING_NODE_EXTENSION
)

option(NODE_LIBUIOHOOK_BUILD_TESTS "Build the Windows hotkey test helper" OFF)
if(WIN32 AND NODE_LIBUIOHOOK_BUILD_TESTS)
add_executable(node_libuiohook_send_input "${PROJECT_SOURCE_DIR}/test/send_input_win.cpp")
endif()

set(CompilerFlags
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
},
"license": "GPL-3.0-or-later",
"main": "main.js",
"scripts": {
"test": "node test/run_hotkey_tests.js"
},
"devDependencies": {
"colors": "^1.4.0",
"electron": "^29.4.3",
"fs": "^0.0.1-security",
"path": "^0.12.7",
"shelljs": "^0.8.5",
"electron": "^29.4.3",
"underscore":"1.13.4"
"underscore": "1.13.4"
},
"dependencies": {
"node-addon-api": "^7.1.1"
Expand Down
Loading
Loading