Skip to content

Commit

Permalink
c++17 and updated actions
Browse files Browse the repository at this point in the history
  • Loading branch information
elgiano committed Jun 26, 2024
1 parent 3126d39 commit 44b9077
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 67 deletions.
140 changes: 75 additions & 65 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,95 +1,105 @@
on:
push:
tags:
- 'v*'

- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name'
required: false
default: 'manual_run'
jobs:
build:

runs-on: ${{matrix.os}}
runs-on: ${{ matrix.os }}
name: ${{ matrix.name }}
strategy:
matrix:
os: [macos-latest, ubuntu-18.04, windows-latest]
include:

- name: 'Linux-x64'
os: ubuntu-latest

- name: 'Windows-x64'
os: windows-latest

- name: 'macOS-x64'
os: macos-12

- name: 'macOS-12-arm64'
arch: arm64
os: macos-12

- name: 'macOS-latest-arm64'
arch: arm64
os: macos-latest

env:
SC_PATH: ${{ github.workspace }}/supercollider
TORCH_PATH: ${{ github.workspace }}/libtorch
BUILD_PATH: ${{ github.workspace }}/build
INSTALL_PATH: ${{ github.workspace }}/build/Install
ARCHIVE_NAME: XPlayBuf-${{ matrix.name }}.zip
CMAKE_OSX_ARCHITECTURES: '${{ matrix.arch }}'

steps:
- uses: actions/checkout@v2

- name: Install 7Zip (Windows)
if: matrix.os == 'windows-latest'
shell: powershell
run: Install-Module 7Zip4PowerShell -Force -Verbose

- name: Get SC source code
run: git clone https://github.com/supercollider/supercollider.git ${{github.workspace}}/supercollider
- name: Checkout SuperCollider
uses: actions/checkout@v2
with:
repository: supercollider/supercollider
path: ${{ env.SC_PATH }}
ref: main

# Build
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{github.workspace}}/build

- name: Configure CMake (Unix)
shell: bash
if: matrix.os != 'windows-latest'
working-directory: ${{github.workspace}}/build
run: cmake .. -DCMAKE_BUILD_TYPE='Release' -DSC_PATH=${{github.workspace}}/supercollider -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install

- name: Configure CMake (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
working-directory: ${{github.workspace}}\build
run: cmake .. -DCMAKE_BUILD_TYPE='Release' -DSC_PATH=${{github.workspace}}\supercollider -DCMAKE_INSTALL_PREFIX=${{github.workspace}}\build\install

- name: Build (Unix)
if: matrix.os != 'windows-latest'
working-directory: ${{github.workspace}}/build
run: cmake -E make_directory $BUILD_PATH

- name: Configure CMake
shell: bash
run: cmake --build . --config "Release" --target install
working-directory: ${{ env.BUILD_PATH }}
run: cmake .. -DCMAKE_BUILD_TYPE=Release -DSC_PATH="$SC_PATH" -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH"

- name: Build (Windows)
working-directory: ${{github.workspace}}\build
if: matrix.os == 'windows-latest'
shell: pwsh
run: cmake --build . --config "Release" --target install
- name: Build
shell: bash
working-directory: ${{ env.BUILD_PATH }}
env:
CMAKE_BUILD_PARALLEL_LEVEL: 4
run: cmake --build . --config Release --target install

# Gather all files in a zip
- name: Zip up build (Unix)
if: matrix.os != 'windows-latest'
if: runner.os != 'Windows'
shell: bash
working-directory: ${{github.workspace}}/build
run: zip -r XPlayBuf-${{runner.os}} install/XPlayBuf
working-directory: ${{ env.INSTALL_PATH }}
run: zip -r "$ARCHIVE_NAME" "XPlayBuf"

# Gather all files in a zip
- name: Zip up build (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
working-directory: ${{github.workspace}}\build
run: Compress-7Zip "install\XPlayBuf" -ArchiveFileName "XPlayBuf-${{runner.os}}.zip" -Format Zip

- name: Check if release has been created
uses: mukunku/[email protected]
id: checkTag
with:
tag: 'v1'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: runner.os == 'Windows'
shell: bash
working-directory: ${{ env.INSTALL_PATH }}
run: 7z a "$ARCHIVE_NAME" -tzip "XPlayBuf"

# Publish build
- name: Create Release
if: steps.checkTag.outputs.exists == false
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
# Upload
- name: Upload binaries to release
if: github.event_name == 'push'
uses: svenstaro/upload-release-action@v2
with:
tag_name: ${{ github.ref }}
release_name: XPlayBuf-${{ github.ref }}
draft: false
prerelease: false
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.INSTALL_PATH }}/${{ env.ARCHIVE_NAME }}
body: ""
tag: ${{ github.ref }}

# Upload: manual trigger
- name: Upload binaries to release
if: github.event_name == 'workflow_dispatch'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{github.workspace}}/build/XPlayBuf-${{runner.os}}.zip
asset_name: XPlayBuf-${{ github.ref_name }}-${{runner.os}}.zip
tag: ${{ github.ref }}
file: ${{ env.INSTALL_PATH }}/${{ env.ARCHIVE_NAME }}
prerelease: true
body: ""
tag: ${{github.event.inputs.tag_name}}

4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
cmake_minimum_required(VERSION 3.5)
set(project_name "XPlayBuf")
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules ${CMAKE_MODULE_PATH})
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

####################################################################################################
# load modules
Expand Down Expand Up @@ -76,7 +76,7 @@ set(XPlayBuf_schelp_files
)

sc_add_server_plugin(
"XPlayBuf/XPlayBuf" # desination directory
"XPlayBuf" # desination directory
"XPlayBuf" # target name
"${XPlayBuf_cpp_files}"
"${XPlayBuf_sc_files}"
Expand Down

0 comments on commit 44b9077

Please sign in to comment.