|
1 | 1 | on: |
2 | 2 | push: |
3 | 3 | tags: |
4 | | - - 'v*' |
5 | | - |
| 4 | + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + tag_name: |
| 8 | + description: 'Tag name' |
| 9 | + required: false |
| 10 | + default: 'manual_run' |
6 | 11 | jobs: |
7 | 12 | build: |
8 | 13 |
|
9 | | - runs-on: ${{matrix.os}} |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + name: ${{ matrix.name }} |
10 | 16 | strategy: |
11 | 17 | matrix: |
12 | | - os: [macos-latest, ubuntu-18.04, windows-latest] |
| 18 | + include: |
| 19 | + |
| 20 | + - name: 'Linux-x64' |
| 21 | + os: ubuntu-latest |
| 22 | + |
| 23 | + - name: 'Windows-x64' |
| 24 | + os: windows-latest |
| 25 | + |
| 26 | + - name: 'macOS-x64' |
| 27 | + os: macos-12 |
| 28 | + |
| 29 | + - name: 'macOS-12-arm64' |
| 30 | + arch: arm64 |
| 31 | + os: macos-12 |
| 32 | + |
| 33 | + - name: 'macOS-latest-arm64' |
| 34 | + arch: arm64 |
| 35 | + os: macos-latest |
| 36 | + |
| 37 | + env: |
| 38 | + SC_PATH: ${{ github.workspace }}/supercollider |
| 39 | + TORCH_PATH: ${{ github.workspace }}/libtorch |
| 40 | + BUILD_PATH: ${{ github.workspace }}/build |
| 41 | + INSTALL_PATH: ${{ github.workspace }}/build/Install |
| 42 | + ARCHIVE_NAME: XPlayBuf-${{ matrix.name }}.zip |
| 43 | + CMAKE_OSX_ARCHITECTURES: '${{ matrix.arch }}' |
13 | 44 |
|
14 | 45 | steps: |
15 | 46 | - uses: actions/checkout@v2 |
16 | 47 |
|
17 | | - - name: Install 7Zip (Windows) |
18 | | - if: matrix.os == 'windows-latest' |
19 | | - shell: powershell |
20 | | - run: Install-Module 7Zip4PowerShell -Force -Verbose |
21 | | - |
22 | | - - name: Get SC source code |
23 | | - run: git clone https://github.com/supercollider/supercollider.git ${{github.workspace}}/supercollider |
| 48 | + - name: Checkout SuperCollider |
| 49 | + uses: actions/checkout@v2 |
| 50 | + with: |
| 51 | + repository: supercollider/supercollider |
| 52 | + path: ${{ env.SC_PATH }} |
| 53 | + ref: main |
24 | 54 |
|
| 55 | + # Build |
25 | 56 | - name: Create Build Environment |
26 | | - # Some projects don't allow in-source building, so create a separate build directory |
27 | | - # We'll use this as our working directory for all subsequent commands |
28 | | - run: cmake -E make_directory ${{github.workspace}}/build |
29 | | - |
30 | | - - name: Configure CMake (Unix) |
31 | 57 | shell: bash |
32 | | - if: matrix.os != 'windows-latest' |
33 | | - working-directory: ${{github.workspace}}/build |
34 | | - run: cmake .. -DCMAKE_BUILD_TYPE='Release' -DSC_PATH=${{github.workspace}}/supercollider -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install |
35 | | - |
36 | | - - name: Configure CMake (Windows) |
37 | | - if: matrix.os == 'windows-latest' |
38 | | - shell: pwsh |
39 | | - working-directory: ${{github.workspace}}\build |
40 | | - run: cmake .. -DCMAKE_BUILD_TYPE='Release' -DSC_PATH=${{github.workspace}}\supercollider -DCMAKE_INSTALL_PREFIX=${{github.workspace}}\build\install |
41 | | - |
42 | | - - name: Build (Unix) |
43 | | - if: matrix.os != 'windows-latest' |
44 | | - working-directory: ${{github.workspace}}/build |
| 58 | + run: cmake -E make_directory $BUILD_PATH |
| 59 | + |
| 60 | + - name: Configure CMake |
45 | 61 | shell: bash |
46 | | - run: cmake --build . --config "Release" --target install |
| 62 | + working-directory: ${{ env.BUILD_PATH }} |
| 63 | + run: cmake .. -DCMAKE_BUILD_TYPE=Release -DSC_PATH="$SC_PATH" -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" |
47 | 64 |
|
48 | | - - name: Build (Windows) |
49 | | - working-directory: ${{github.workspace}}\build |
50 | | - if: matrix.os == 'windows-latest' |
51 | | - shell: pwsh |
52 | | - run: cmake --build . --config "Release" --target install |
| 65 | + - name: Build |
| 66 | + shell: bash |
| 67 | + working-directory: ${{ env.BUILD_PATH }} |
| 68 | + env: |
| 69 | + CMAKE_BUILD_PARALLEL_LEVEL: 4 |
| 70 | + run: cmake --build . --config Release --target install |
53 | 71 |
|
54 | 72 | # Gather all files in a zip |
55 | 73 | - name: Zip up build (Unix) |
56 | | - if: matrix.os != 'windows-latest' |
| 74 | + if: runner.os != 'Windows' |
57 | 75 | shell: bash |
58 | | - working-directory: ${{github.workspace}}/build |
59 | | - run: zip -r XPlayBuf-${{runner.os}} install/XPlayBuf |
| 76 | + working-directory: ${{ env.INSTALL_PATH }} |
| 77 | + run: zip -r "$ARCHIVE_NAME" "XPlayBuf" |
60 | 78 |
|
61 | | - # Gather all files in a zip |
62 | 79 | - name: Zip up build (Windows) |
63 | | - if: matrix.os == 'windows-latest' |
64 | | - shell: pwsh |
65 | | - working-directory: ${{github.workspace}}\build |
66 | | - run: Compress-7Zip "install\XPlayBuf" -ArchiveFileName "XPlayBuf-${{runner.os}}.zip" -Format Zip |
67 | | - |
68 | | - - name: Check if release has been created |
69 | | - |
70 | | - id: checkTag |
71 | | - with: |
72 | | - tag: 'v1' |
73 | | - env: |
74 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 80 | + if: runner.os == 'Windows' |
| 81 | + shell: bash |
| 82 | + working-directory: ${{ env.INSTALL_PATH }} |
| 83 | + run: 7z a "$ARCHIVE_NAME" -tzip "XPlayBuf" |
75 | 84 |
|
76 | | - # Publish build |
77 | | - - name: Create Release |
78 | | - if: steps.checkTag.outputs.exists == false |
79 | | - id: create_release |
80 | | - uses: actions/create-release@v1 |
81 | | - env: |
82 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token |
| 85 | + # Upload |
| 86 | + - name: Upload binaries to release |
| 87 | + if: github.event_name == 'push' |
| 88 | + uses: svenstaro/upload-release-action@v2 |
83 | 89 | with: |
84 | | - tag_name: ${{ github.ref }} |
85 | | - release_name: XPlayBuf-${{ github.ref }} |
86 | | - draft: false |
87 | | - prerelease: false |
| 90 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 91 | + file: ${{ env.INSTALL_PATH }}/${{ env.ARCHIVE_NAME }} |
| 92 | + body: "" |
| 93 | + tag: ${{ github.ref }} |
88 | 94 |
|
| 95 | + # Upload: manual trigger |
89 | 96 | - name: Upload binaries to release |
| 97 | + if: github.event_name == 'workflow_dispatch' |
90 | 98 | uses: svenstaro/upload-release-action@v2 |
91 | 99 | with: |
92 | 100 | repo_token: ${{ secrets.GITHUB_TOKEN }} |
93 | | - file: ${{github.workspace}}/build/XPlayBuf-${{runner.os}}.zip |
94 | | - asset_name: XPlayBuf-${{ github.ref_name }}-${{runner.os}}.zip |
95 | | - tag: ${{ github.ref }} |
| 101 | + file: ${{ env.INSTALL_PATH }}/${{ env.ARCHIVE_NAME }} |
| 102 | + prerelease: true |
| 103 | + body: "" |
| 104 | + tag: ${{github.event.inputs.tag_name}} |
| 105 | + |
0 commit comments