I am updating my Song Selector extension to make it cross platform and am now getting successful builds on GitHub for both Windows and Mac, but I can’t work out how to get the config of the artefact upload correct, at the moment it is not seeing any files to add. I know it’s going to be my lack of understanding causing this issue, but if anyone has any pointers, I’d be very grateful.
This is my build.yaml file (a tweaked version of @rank13’s one for GPSelector):
name: Build
on:
pull_request:
branches: ["basic-choc-test"]
push:
branches: ["basic-choc-test"]
permissions:
repository-projects: read
jobs:
build:
name: Plugins and Packages - ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
# If the job fails for one config, don't abort the jobs for the other configs
fail-fast: false
matrix:
config:
- name: "macOS - universal"
os: "macos-11"
cmake_preset: "mac-universal"
build_config: "Release"
- name: "Windows"
os: "windows-2019"
cmake_preset: "windows-native"
build_config: "Release"
env:
# Unfortunately, Ccache is not available yet for Windows and MSVC
CCACHE_AVAILABLE: ${{ matrix.config.os == 'macos-11' }}
# To store the build extension later, we store it inside the build cache
CMAKE_ADDITIONAL_OPTIONS: "-D 'GIG_PERFORMER_EXTENSIONS_DIRECTORY=${{ github.workspace }}/build/install'"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: "Ccache"
uses: hendrikmuhs/ccache-action@ed038da2f2f09b0c8387c00e1498290a4808da2e # v1.2.2
if: env.CCACHE_AVAILABLE == 'true'
with:
key: ${{ matrix.config.os }}-${{ matrix.config.cmake_preset }}
max-size: 1536M
- name: "Ccache: Clear"
# We are triggered by the "push" event in the case of release branches.
# For these branches, no cache shall be used - but we still use the
# Ccache compiler driver in order to build up a cache that pull requests
# targeting this branch can use.
if: env.CCACHE_AVAILABLE == 'true' && github.event_name == 'push'
run: ccache --clear
- name: "Ccache: Enable compiler driver"
if: env.CCACHE_AVAILABLE == 'true'
run: echo "CMAKE_ADDITIONAL_OPTIONS=${{ env.CMAKE_ADDITIONAL_OPTIONS }} -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache" >> $GITHUB_ENV
- name: "CMake: Configure"
run: cmake -S . --preset=${{ matrix.config.cmake_preset }} ${{ env.CMAKE_ADDITIONAL_OPTIONS }}
- name: "CMake: Build"
run: cmake --build --preset=${{ matrix.config.cmake_preset }} --config ${{ matrix.config.build_config }} --parallel
- name: "CMake: Install"
run: cmake --install build/${{ matrix.config.cmake_preset }} --config ${{ matrix.config.build_config }}
- name: Store extension
uses: actions/upload-artifact@v3
with:
name: extension
path: build/install
Well, I’ve got a bit further, I’ve now worked out how to get the ./build directory into the artifact upload and it contains the build files including the compiled Windows .dll binary, but no binary for Mac-Universal.
My build.yaml is now:
name: Build
on:
pull_request:
branches: ["basic-choc-test"]
push:
branches: ["basic-choc-test"]
permissions:
repository-projects: read
jobs:
build:
name: Plugins and Packages - ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
# If the job fails for one config, don't abort the jobs for the other configs
fail-fast: false
matrix:
config:
- name: "macOS - universal"
os: "macos-11"
cmake_preset: "mac-universal"
build_config: "Release"
- name: "Windows"
os: "windows-2019"
cmake_preset: "windows-native"
build_config: "Release"
env:
# Unfortunately, Ccache is not available yet for Windows and MSVC
CCACHE_AVAILABLE: ${{ matrix.config.os == 'macos-11' }}
# To store the build extension later, we store it inside the build cache
CMAKE_ADDITIONAL_OPTIONS: "-D 'GIG_PERFORMER_EXTENSIONS_DIRECTORY=${{ github.workspace }}/build'"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: "Ccache"
uses: hendrikmuhs/ccache-action@ed038da2f2f09b0c8387c00e1498290a4808da2e # v1.2.2
if: env.CCACHE_AVAILABLE == 'true'
with:
key: ${{ matrix.config.os }}-${{ matrix.config.cmake_preset }}
max-size: 1536M
- name: "Ccache: Clear"
# We are triggered by the "push" event in the case of release branches.
# For these branches, no cache shall be used - but we still use the
# Ccache compiler driver in order to build up a cache that pull requests
# targeting this branch can use.
if: env.CCACHE_AVAILABLE == 'true' && github.event_name == 'push'
run: ccache --clear
- name: "Ccache: Enable compiler driver"
if: env.CCACHE_AVAILABLE == 'true'
run: echo "CMAKE_ADDITIONAL_OPTIONS=${{ env.CMAKE_ADDITIONAL_OPTIONS }} -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache" >> $GITHUB_ENV
- name: "CMake: Configure"
run: cmake -S . --preset=${{ matrix.config.cmake_preset }} ${{ env.CMAKE_ADDITIONAL_OPTIONS }}
- name: "CMake: Build"
run: cmake --build --preset=${{ matrix.config.cmake_preset }} --config ${{ matrix.config.build_config }} --parallel
- name: "CMake: Install"
run: cmake --install build/${{ matrix.config.cmake_preset }} --config ${{ matrix.config.build_config }}
- name: Store extension
uses: actions/upload-artifact@v3
with:
name: extension
path: ./build
I see the Mac libBasicSongChooser.dylib in the extension.zip generated artefact.
I didn’t modify anything in the yaml file. I started my project from the gp Juce cmake template, that @simon created, and everything ‘just worked’.
I wasn’t sure what you meant by uploads. When I sync a commit to GitHub, it automatically triggers the action, and then I download the resulting extension.zip file, which only contains the single dynamic library file for Windows and Mac.
Indeed, the actions are designed so that you usually should not have to modify them at all. @DaveBoulden, could you explain why you initially decided to modify those files?
Off the top of my head, the most likely reason for this problem is that some part of your extension‘s CMake scripts broke the install step, so I would start by checking the logs of that. If you don’t get further by yourself, I can likely take a closer look myself next week.
The changes I have made were simply to get anything coming back in the artifact ZIP file. I have had to make various changes to my CMakeLists.txt file to support the libraries I have been using with my extension.
@rank13 this shows my ignorance concerning the Mac. I hadn’t fully realised that libBasicSongChooser.dylib actually is the Mac compiled binary!
It’s a little but buggy at the moment, but does anyone fancy giving these a quick try just to see if they install and run? There’s both Windows and Mac extensions in this ZIP file.
While looking through the README, I noticed that you are distributing your extension under the MIT license, which is not allowed by the license of the SDK. You must distribute any extension built on top of the SDK under GPL 3.
No files were found with the provided path: build/install. No artifacts will be uploaded.
For that reason, I swapped the path on the Store Extension step to include the whole build directory. I guess I need something different in my CMakeLists.txt file to get the compiled extension in the build/install directory? Although, I can at least still get the files as it stands now.
EDIT: I’ve just seen the install step you highlighted… I’ll go put that in my CMakeLists.txt file and test again… thank you!
The presets have set this variable such that it installs right into Gig Performer’s extensions directory for your OS and the GitHub action sets it to ./build/install.