diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 56de491..6b3dbbf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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/tag-exists-action@v1.0.0 - 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}} + diff --git a/CMakeLists.txt b/CMakeLists.txt index f54c134..6bda54f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 @@ -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}"