Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
# Dependabot updates for GitHub Actions
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "weekly"
84 changes: 84 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Build

on:
[push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: false

defaults:
run:
shell: bash

jobs:
build-docker:
strategy:
fail-fast: false
matrix:
include:
- container: wpilib/aarch64-cross-ubuntu:bullseye-22.04
name: LinuxARM64
platform-type: linuxarm64
arch: arm64
- container: wpilib/raspbian-cross-ubuntu:bullseye-22.04
name: LinuxARM32
platform-type: linuxarm32
arch: arm32
runs-on: ubuntu-latest
name: "Build - ${{ matrix.name }}"
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
run: npm install

- name: Pretest
run: npm run pretest

# Due to the nature of the build process, we can't run the tests in the container becauase external hardware is required
# If this were to be running on a local machine, the tests would be run here
#- name: Test
# run: npm test

build-native:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
name: "Build - ${{ matrix.os }}"
steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
run: npm install

- name: Pretest
run: npm run pretest

# Due to the nature of the build process, we can't run the tests in the container becauase external hardware is required
# If this were to be running on a local machine, the tests would be run here
#- name: Test
# run: npm test
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Create release

on:
push:
tags:
- 'v*'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: false

defaults:
run:
shell: bash

jobs:
release:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
name: "Release - ${{ matrix.os }}"

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
run: npm install

- name: Build
run: npm run build

- name: Create release
uses: softprops/action-gh-release@v2
with:
files: dist/*
tag_name: ${{ github.ref }}
name: ${{ github.ref }}
body: |
This is a release for version ${{ github.ref }}.
It contains the compiled files from the build process.
110 changes: 92 additions & 18 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'sources': [
'src/addon.cc',
'src/canWrapper.cc',
],
],
'include_dirs': [
"src/",
"externalCompileTimeDeps/include",
Expand All @@ -15,30 +15,104 @@
"NAPI_VERSION=<(napi_build_version)"
],
'dependencies': ["<!(node -p \"require('node-addon-api').gyp\")"],
'libraries': [
# These files were placed by download-CanBridge.mjs
'<(module_root_dir)/externalCompileTimeDeps/CANBridge.lib',
'<(module_root_dir)/externalCompileTimeDeps/wpiHal.lib',
'<(module_root_dir)/externalCompileTimeDeps/wpiutil.lib',
'conditions': [
['OS=="mac"', {
'libraries': [
# These files were placed by download-CanBridge.mjs
'<(module_root_dir)/externalCompileTimeDeps/libCANBridge.a',
],
'copies': [{
'destination': './build/Release',
'files': [
# These files were placed in the prebuilds folder by download-CanBridge.mjs
'<(module_root_dir)/prebuilds/darwin-osxuniversal/libCANBridge.dylib',
'<(module_root_dir)/prebuilds/darwin-osxuniversal/libwpiHal.dylib',
'<(module_root_dir)/prebuilds/darwin-osxuniversal/libwpiutil.dylib',
]
}],
}],
['OS=="win"', {
'libraries': [
# These files were placed by download-CanBridge.mjs
'<(module_root_dir)/externalCompileTimeDeps/CANBridge.lib',
'<(module_root_dir)/externalCompileTimeDeps/wpiHal.lib',
'<(module_root_dir)/externalCompileTimeDeps/wpiutil.lib',
],
'copies': [{
'destination': './build/Release',
'files': [
# These files were placed in the prebuilds folder by download-CanBridge.mjs
'<(module_root_dir)/prebuilds/win32-x64/CANBridge.dll',
'<(module_root_dir)/prebuilds/win32-x64/wpiHal.dll',
'<(module_root_dir)/prebuilds/win32-x64/wpiutil.dll',
]
}],
}],
['OS=="linux"', {
'conditions': [
[ 'target_arch=="x64"', {
'libraries': [
# These files were placed by download-CanBridge.mjs
'<(module_root_dir)/externalCompileTimeDeps/libCANBridge.a',
],
'copies': [{
'destination': './build/Release',
'files': [
# These files were placed in the prebuilds folder by download-CanBridge.mjs
'<(module_root_dir)/prebuilds/linux-x64/libCANBridge.so',
'<(module_root_dir)/prebuilds/linux-x64/libwpiHal.so',
'<(module_root_dir)/prebuilds/linux-x64/libwpiutil.so',
]
}],
}],
[ 'target_arch=="arm"', {
'libraries': [
# These files were placed by download-CanBridge.mjs
'<(module_root_dir)/externalCompileTimeDeps/libCANBridge.a',
],
'copies': [{
'destination': './build/Release',
'files': [
# These files were placed in the prebuilds folder by download-CanBridge.mjs
'<(module_root_dir)/prebuilds/linux-arm32/libCANBridge.so',
'<(module_root_dir)/prebuilds/linux-arm32/libwpiHal.so',
'<(module_root_dir)/prebuilds/linux-arm32/libwpiutil.so',
]
}],
}],
[ 'target_arch=="arm64"', {
'libraries': [
# These files were placed by download-CanBridge.mjs
'<(module_root_dir)/externalCompileTimeDeps/libCANBridge.a',
],
'copies': [{
'destination': './build/Release',
'files': [
# These files were placed in the prebuilds folder by download-CanBridge.mjs
'<(module_root_dir)/prebuilds/linux-arm64/libCANBridge.so',
'<(module_root_dir)/prebuilds/linux-arm64/libwpiHal.so',
'<(module_root_dir)/prebuilds/linux-arm64/libwpiutil.so',
]
}],
}],
]}],
],
'copies': [{
'destination': './build/Release',
'files': [
# These files were placed in the prebuilds folder by download-CanBridge.mjs
'<(module_root_dir)/prebuilds/win32-x64/CANBridge.dll',
'<(module_root_dir)/prebuilds/win32-x64/wpiHal.dll',
'<(module_root_dir)/prebuilds/win32-x64/wpiutil.dll',
]
}],
'msvs_settings': {
'VCCLCompilerTool': {
'ExceptionHandling': 1,
'AdditionalOptions': [ '-std:c++20' ],
'RuntimeLibrary': 0
},
},
"cflags_cc!": ["-std=c++20", '-fno-exceptions'],
"cflags!": ["-std=c++20", '-fno-exceptions'],
"xcode_settings": {
"CLANG_CXX_LANGUAGE_STANDARD": "c++20",
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'GCC_ENABLE_CPP_RTTI': 'YES',
"OTHER_CPLUSPLUSFLAGS": ["-fexceptions"],
# 'MACOSX_DEPLOYMENT_TARGET': '14.0',
},
"cflags_cc": ["-std=c++20", '-fexceptions'],
"cflags": ["-std=c++20", '-fexceptions'],
}
]
}
}
Loading