Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Aug 30, 2024
1 parent 04a5780 commit 443d7e2
Show file tree
Hide file tree
Showing 8 changed files with 376 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: jcelerier
173 changes: 173 additions & 0 deletions .github/workflows/build_cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
name: CMake build

on: push

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAC_CODESIGN_EMAIL: ${{ secrets.MAC_CODESIGN_EMAIL }}
MAC_CODESIGN_IDENTITY: ${{ secrets.MAC_CODESIGN_IDENTITY }}
MAC_CODESIGN_KEYCHAIN: "/Users/runner/travis.keychain"
MAC_CODESIGN_KEYCHAIN_PASSWORD: "travis"
MAC_CODESIGN_PASSWORD: ${{ secrets.MAC_CODESIGN_PASSWORD }}
MAC_CODESIGN_TEAM: ${{ secrets.MAC_CODESIGN_TEAM }}
MAC_CODESIGN_FILE_B64: ${{ secrets.MAC_CODESIGN_FILE_B64 }}
MAC_NOTARIZE_PASSWORD: ${{ secrets.MAC_NOTARIZE_PASSWORD }}

jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows",
os: windows-latest,
triple: "windows-clang-x86_64",
path: "/c/ossia-sdk/llvm/bin",
common_flags: "-GNinja \
-DCMAKE_C_COMPILER=c:/ossia-sdk/llvm/bin/clang.exe \
-DCMAKE_CXX_COMPILER=c:/ossia-sdk/llvm/bin/clang++.exe \
-DCMAKE_EXE_LINKER_FLAGS=\"-fuse-ld=c:/ossia-sdk/llvm/bin/ld.lld.exe --target=x86_64-windows-gnu\" \
-DCMAKE_SHARED_LINKER_FLAGS=\"-fuse-ld=c:/ossia-sdk/llvm/bin/ld.lld.exe --target=x86_64-windows-gnu\" \
-DCMAKE_MODULE_LINKER_FLAGS=\"-fuse-ld=c:/ossia-sdk/llvm/bin/ld.lld.exe --target=x86_64-windows-gnu\" ",
debug_flags: "-DCMAKE_BUILD_TYPE=Debug",
release_flags: "-DCMAKE_BUILD_TYPE=Release",
build_flags: "",
dependencies: "choco install -y ninja",
sdk: "/c/ossia-sdk",
pre_build: ""
}
- {
name: "macOS",
os: macos-13,
triple: "macos-clang-x86_64",
common_flags: "",
debug_flags: "-DCMAKE_BUILD_TYPE=Debug",
release_flags: "-DCMAKE_BUILD_TYPE=Release",
build_flags: "",
sdk: "/opt/ossia-sdk-x86_64",
pre_build: "sudo xcode-select -s /Applications/Xcode_15.4.app"
}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
shell: bash
run: |
${{ matrix.config.dependencies }}
- name: Download SDK
shell: bash
if: runner.os == 'Windows'
run: |
curl -L https://raw.githubusercontent.com/ossia/score/master/tools/fetch-sdk.sh > fetch-sdk.sh
chmod +x ./fetch-sdk.sh
./fetch-sdk.sh
- name: Setup Codesigning
shell: bash
if: runner.os == 'macOS'
run: |
set +x
security create-keychain -p "$MAC_CODESIGN_KEYCHAIN_PASSWORD" "$MAC_CODESIGN_KEYCHAIN"
security default-keychain -s "$MAC_CODESIGN_KEYCHAIN"
security unlock-keychain -p "$MAC_CODESIGN_KEYCHAIN_PASSWORD" "$MAC_CODESIGN_KEYCHAIN"
echo $MAC_CODESIGN_FILE_B64 | base64 --decode > "$HOME/cert.p12"
security import "$HOME/cert.p12" -k "$MAC_CODESIGN_KEYCHAIN" -P "$MAC_CODESIGN_PASSWORD" -T /usr/bin/codesign > /dev/null 2>&1
security set-key-partition-list -S apple-tool:,apple: -s -k "$MAC_CODESIGN_KEYCHAIN_PASSWORD" "$MAC_CODESIGN_KEYCHAIN" > /dev/null 2>&1

rm -rf "$HOME/cert.p12"

- name: Build debug
shell: bash
run: |
export BUILD_DIR=build-debug
if [[ "${{ matrix.config.path }}" != "" ]]; then
export PATH=${{ matrix.config.path }}:$PATH
fi
${{ matrix.config.pre_build }}
cmake -S $PWD -B $BUILD_DIR \
-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" \
-DCMAKE_CXX_STANDARD=20 \
${{ matrix.config.common_flags }} \
${{ matrix.config.debug_flags }}
cmake --build $BUILD_DIR -- ${{ matrix.config.build_flags }}
- name: Build release
shell: bash
run: |
export BUILD_DIR=build-release
export INSTALL_DIR="$PWD/install"
mkdir -p "$INSTALL_DIR"
if [[ "${{ matrix.config.path }}" != "" ]]; then
export PATH=${{ matrix.config.path }}:$PATH
fi
${{ matrix.config.pre_build }}
cmake -S $PWD -B $BUILD_DIR \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=1 \
-DLEAPSDK_PATH="$PWD/LeapSDK" \
-DMAX_PACKAGE_FOLDER="$PWD/UltraLeap" \
-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" \
-DCMAKE_CXX_STANDARD=20 \
${{ matrix.config.common_flags }} \
${{ matrix.config.release_flags }}
cmake --build $BUILD_DIR -- ${{ matrix.config.build_flags }}
cmake -E tar cf "$PWD/UltraLeap-${{ matrix.config.triple }}.zip" --format=zip -- "$PWD/UltraLeap"
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.config.triple }}
path: UltraLeap-${{ matrix.config.triple }}.zip

release:
name: Release
runs-on: ubuntu-latest
needs: build
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3

- name: Combine
shell: bash
run: |
mkdir -p output
find . -name '*.zip' -exec mv {} output/ \;
cd output
for file in *.zip; do
unzip -o $file
done
ls
rm *.zip
zip -r UltraLeap-max.zip UltraLeap
rm -rf UltraLeap
- name: Upload
uses: xresloader/upload-to-github-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "output/*"
branches: "main"
verbose: true
prerelease: true
tag_name: "continuous"
default_release_name: "Continuous build"
67 changes: 67 additions & 0 deletions .github/workflows/build_vs2022.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: VS2022 build

on: push

jobs:
build:
name: VS2022
runs-on: windows-2022
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Checkout dependencies
uses: actions/checkout@v4
with:
repository: ossia/score
submodules: "recursive"
path: score

- name: Checkout Max SDK
uses: actions/checkout@v4
with:
repository: jcelerier/max-sdk-base
submodules: "recursive"
path: max-sdk-base

- name: Install dependencies
shell: bash
run: |
${{ matrix.config.dependencies }}
- name: Download SDK
shell: bash
run: |
curl -L https://raw.githubusercontent.com/ossia/score/master/tools/fetch-sdk.sh > fetch-sdk.sh
chmod +x ./fetch-sdk.sh
./fetch-sdk.sh
- name: Checkout Leap SDK
uses: actions/checkout@v4
with:
repository: celtera/LeapSDK
submodules: "recursive"
path: LeapSDK
token: ${{ secrets.GIT_CLONE_TOKEN }}

- name: Build debug
shell: bash
run: |
export BUILD_DIR=build-debug
cmake -S $PWD -B $BUILD_DIR \
-G "Visual Studio 17 2022" \
-DLEAPSDK_PATH="$PWD/LeapSDK"
cmake --build $BUILD_DIR --config Debug
- name: Build release
shell: bash
run: |
export BUILD_DIR=build-release
cmake -S $PWD -B $BUILD_DIR \
-G "Visual Studio 17 2022" \
-DLEAPSDK_PATH="$PWD/LeapSDK"
cmake --build $BUILD_DIR --config Release
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
.vscode
1 change: 1 addition & 0 deletions Hrv/HeartbeatMetrics.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "HeartbeatMetrics.hpp"
2 changes: 1 addition & 1 deletion Hrv/HeartbeatMetrics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class HeartbeatMetrics
struct
{
halp_meta(name, "Input")
void operator()(HeartbeatMetrics& self, const std::string& name, int bpm)
void operator()(HeartbeatMetrics& self, std::string name, int bpm)
{
if(name.starts_with('/'))
self.addRow(name, bpm);
Expand Down
60 changes: 60 additions & 0 deletions max/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)

project(MyProcessor)

include(dependencies.cmake)

include_directories(${concurrentqueue_SOURCE_DIR})
include_directories(${MAXSDK_MAX_INCLUDE_DIR})
include_directories(${MAXSDK_MSP_INCLUDE_DIR})

# Create a target for our base library
add_library(Heartbeat STATIC
"${CMAKE_CURRENT_SOURCE_DIR}/../Hrv/HeartbeatMetrics.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../Hrv/HeartbeatMetrics.cpp"
)

target_link_libraries(Heartbeat PUBLIC
Avendish::Avendish
Boost::boost
)

avnd_make(
TARGET Heartbeat
MAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../Hrv/HeartbeatMetrics.hpp"
MAIN_CLASS fheel::HeartbeatMetrics
C_NAME heartbeat_metrics
BACKENDS "dump;max"
)

# Create a Max package
if(MAX_PACKAGE_FOLDER)
if(WIN32 AND NOT MSVC)
get_filename_component(cxx_path "${CMAKE_CXX_COMPILER}" PATH)
set(FILES_TO_INSTALL
${FILES_TO_INSTALL}
"${cxx_path}/libc++.dll"
"${cxx_path}/libunwind.dll"
)
endif()

avnd_create_max_package(
CODESIGN
NOTARIZE

NAME UltraLeap
SOURCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/max/package"
PACKAGE_ROOT "${MAX_PACKAGE_FOLDER}"

KEYCHAIN_FILE "$ENV{MAC_CODESIGN_KEYCHAIN}"
KEYCHAIN_PASSWORD "$ENV{MAC_CODESIGN_KEYCHAIN_PASSWORD}"
CODESIGN_ENTITLEMENTS "${CMAKE_CURRENT_SOURCE_DIR}/src/entitlements.plist"
CODESIGN_IDENTITY "$ENV{MAC_CODESIGN_IDENTITY}"
NOTARIZE_TEAM "$ENV{MAC_CODESIGN_TEAM}"
NOTARIZE_EMAIL "$ENV{MAC_CODESIGN_EMAIL}"
NOTARIZE_PASSWORD "$ENV{MAC_NOTARIZE_PASSWORD}"

EXTERNALS UltraLeap_max
SUPPORT "${FILES_TO_INSTALL}"
)
endif()
69 changes: 69 additions & 0 deletions max/dependencies.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
include(FetchContent)

# Boost
FetchContent_Declare(
boost
URL "https://github.com/ossia/sdk/releases/download/sdk30/boost_1_85_0.tar.gz"
)
FetchContent_Populate(boost)
set(BOOST_ROOT "${boost_SOURCE_DIR}")

# Max/MSP sdk
FetchContent_Declare(
max_sdk
GIT_REPOSITORY "https://github.com/jcelerier/max-sdk-base"
GIT_TAG main
GIT_PROGRESS true
)
FetchContent_Populate(max_sdk)

set(AVND_MAXSDK_PATH "${max_sdk_SOURCE_DIR}" CACHE INTERNAL "")

# PureData
if(WIN32)
FetchContent_Declare(
puredata
URL "http://msp.ucsd.edu/Software/pd-0.54-0.msw.zip"
)
FetchContent_Populate(puredata)
set(CMAKE_PREFIX_PATH "${puredata_SOURCE_DIR}/src;${puredata_SOURCE_DIR}/bin;${CMAKE_PREFIX_PATH}")
else()
FetchContent_Declare(
puredata
GIT_REPOSITORY "https://github.com/pure-data/pure-data"
GIT_TAG master
GIT_PROGRESS true
)
FetchContent_Populate(puredata)
set(CMAKE_PREFIX_PATH "${puredata_SOURCE_DIR}/src;${CMAKE_PREFIX_PATH}")
endif()


# ConcurrentQueue
FetchContent_Declare(
concurrentqueue
GIT_REPOSITORY https://github.com/cameron314/concurrentqueue.git
GIT_TAG master
GIT_PROGRESS true
)
FetchContent_MakeAvailable(concurrentqueue)

# Avendish
if(AVENDISH_EXTERNAL_SOURCE_DIR)
FetchContent_Declare(
avendish
DOWNLOAD_COMMAND ""
SOURCE_DIR "${AVENDISH_EXTERNAL_SOURCE_DIR}"
)
else()
FetchContent_Declare(
avendish
GIT_REPOSITORY "https://github.com/celtera/avendish"
GIT_TAG main
GIT_PROGRESS true
)
endif()
FetchContent_Populate(avendish)

set(CMAKE_PREFIX_PATH "${avendish_SOURCE_DIR};${CMAKE_PREFIX_PATH}")
find_package(Avendish REQUIRED)

0 comments on commit 443d7e2

Please sign in to comment.