From 405663a92ec487750ed3304c907275548307dcdb Mon Sep 17 00:00:00 2001 From: Geoffroy Montel Date: Thu, 11 Nov 2021 22:11:43 +0100 Subject: [PATCH] add Github Actions to automatically build plugin, thanks Mads Kjeldgaard --- .github/workflows/build.yml | 93 +++++++++++++++++++++++++++++++++++++ .gitignore | 4 +- 2 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..588db5f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,93 @@ +on: + push + +jobs: + build: + + runs-on: ${{matrix.os}} + strategy: + matrix: + os: [macos-latest, ubuntu-18.04, windows-latest] + + 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: 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 + shell: bash + run: cmake --build . --config "Release" --target install + + - name: Build (Windows) + working-directory: ${{github.workspace}}\build + if: matrix.os == 'windows-latest' + shell: pwsh + run: cmake --build . --config "Release" --target install + + # Gather all files in a zip + - name: Zip up build (Unix) + if: matrix.os != 'windows-latest' + shell: bash + working-directory: ${{github.workspace}}/build + run: zip -r XPlayBuf-${{runner.os}} install/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 }} + + # 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 + with: + tag_name: ${{ github.ref }} + release_name: XPlayBuf-${{ github.ref }} + draft: false + prerelease: false + + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{github.workspace}}/build/XPlayBuf-${{runner.os}}.zip + asset_name: XPlayBuf-${{runner.os}}.zip + tag: ${{ github.ref }} diff --git a/.gitignore b/.gitignore index 276670f..61130d5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ .vimrc - -build* +.DS_Store +/build*