Skip to content

Merge pull request #59 from JohT/renovate/juce-framework-juce-7.x #155

Merge pull request #59 from JohT/renovate/juce-framework-juce-7.x

Merge pull request #59 from JohT/renovate/juce-framework-juce-7.x #155

name: Build with CMake
# Based on https://github.com/sudara/pamplejuce
on:
push:
# Ignore changes in documentation
paths-ignore:
- '**/LICENSE'
- '**.md'
- '**.svg'
- '**.png'
- '**.pdf'
- '**.code-workspace'
- '.clang-format'
- '.clang-tidy'
- '.gitignore'
- 'renovate.json'
env:
PROJECT_NAME: Speclet # Must match the JUCE project name from juce_add_plugin
BUILD_TYPE: Release
BUILD_DIR: Builds
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLUGINVAL_VERSION: v1.0.3
DISPLAY: :0 # linux pluginval needs this
# jobs are run in parallel on different machines
# all steps run in series
jobs:
build_and_test:
name: ${{ matrix.artifact }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # show all errors for each platform (vs. cancel jobs on error)
matrix:
#os: [ubuntu-latest] # first test only with linux
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
artifact: Linux
- os: windows-latest
artifact: Windows
- os: macos-latest
artifact: MacOS
steps:
- name: Install JUCE's Linux Dependencies and select g++ 10
if: runner.os == 'Linux'
# Thanks to McMartin & co https://forum.juce.com/t/list-of-juce-dependencies-under-linux/15121/44
# Added further dependencies from https://github.com/Tracktion/pluginval/blob/develop/.github/workflows/build.yaml
run: |
sudo apt-get update && sudo apt install libasound2-dev libx11-dev libxinerama-dev libxext-dev libfreetype6-dev libwebkit2gtk-4.0-dev libglu1-mesa-dev ccache xvfb
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get install -y freeglut3-dev g++ libcurl4-openssl-dev libjack-jackd2-dev libxcomposite-dev libxcursor-dev libxrandr-dev mesa-common-dev ladspa-sdk libgtk-3-dev
# Starting Virtual Frame Buffer X Server (Xvfb) as local display in the background
sudo /usr/bin/Xvfb $DISPLAY &
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
- name: Get latest CMake
uses: lukka/get-cmake@latest
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true # Gotta get JUCE populated
- name: ccache
if: matrix.os != 'windows-latest'
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.os }}-${{ matrix.type }}
- name: Configure
shell: bash
run: cmake -B ${{ env.BUILD_DIR }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .
- name: Build
shell: bash
run: cmake --build ${{ env.BUILD_DIR }} --config ${{ env.BUILD_TYPE }}
- name: Test
working-directory: ${{ env.BUILD_DIR }}
run: ctest
- name: Pluginval Linux
working-directory: ${{ env.BUILD_DIR }}
if: matrix.artifact == 'Linux'
run: |
curl -L "https://github.com/Tracktion/pluginval/releases/download/${{env.PLUGINVAL_VERSION}}/pluginval_${{ matrix.artifact }}.zip" -o pluginval.zip
unzip pluginval
./pluginval --strictness-level 10 --validate-in-process --verbose --output-dir "." --validate "${{ env.PROJECT_NAME }}_artefacts/${{ env.BUILD_TYPE }}/VST3/${{ env.PROJECT_NAME }}.vst3"
- name: Pluginval Mac
working-directory: ${{ env.BUILD_DIR }}
if: matrix.artifact == 'MacOS'
run: |
curl -L "https://github.com/Tracktion/pluginval/releases/download/${{env.PLUGINVAL_VERSION}}/pluginval_${{ matrix.artifact }}.zip" -o pluginval.zip
unzip pluginval
pluginval.app/Contents/MacOS/pluginval --strictness-level 10 --validate-in-process --verbose --output-dir "." --validate "${{ env.PROJECT_NAME }}_artefacts/${{ env.BUILD_TYPE }}/VST3/${{ env.PROJECT_NAME }}.vst3"
- name: Pluginval Windows
shell: cmd
working-directory: ${{ env.BUILD_DIR }}
if: matrix.artifact == 'Windows'
run: |
powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest https://github.com/Tracktion/pluginval/releases/download/${{env.PLUGINVAL_VERSION}}/pluginval_Windows.zip -OutFile pluginval.zip"
powershell -Command "Expand-Archive pluginval.zip -DestinationPath ."
pluginval.exe --strictness-level 10 --validate-in-process --output-dir "./bin" --validate "${{ env.PROJECT_NAME }}_artefacts/${{ env.BUILD_TYPE }}/VST3/${{ env.PROJECT_NAME }}.vst3"
if %ERRORLEVEL% neq 0 { exit /b 1 }
- name: Remove shared lib before zip packaging
working-directory: ${{ env.BUILD_DIR }}/${{ env.PROJECT_NAME }}_artefacts/${{ env.BUILD_TYPE }}
run: |
cmake -E rm -f lib${{ env.PROJECT_NAME }}_SharedCode.a ${{ env.PROJECT_NAME }}_SharedCode.lib
- name: Rename folder to ${{ env.PROJECT_NAME }} before zip packaging
working-directory: ${{ env.BUILD_DIR }}/${{ env.PROJECT_NAME }}_artefacts
run: |
cmake -E rename ${{ env.BUILD_TYPE }} ${{ env.PROJECT_NAME }}-${{ matrix.artifact }}
- name: Zip
working-directory: ${{ env.BUILD_DIR }}/${{ env.PROJECT_NAME }}_artefacts
run: cmake -E tar cfv ${{ env.PROJECT_NAME }}-${{ matrix.artifact }}.zip --format=zip ${{ env.PROJECT_NAME }}-${{ matrix.artifact }}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
path: ${{ env.BUILD_DIR }}/${{ env.PROJECT_NAME }}_artefacts/${{ env.PROJECT_NAME }}-${{ matrix.artifact }}.zip
name: ${{ env.PROJECT_NAME }}-${{ matrix.artifact }}
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: build_and_test
steps:
- name: Get the release version
id: get_release_version
run: echo ::set-output name=RELEASE_VERSION::${GITHUB_REF/refs\/tags\//}
- name: Download All Artifacts
id: download_artifacts
uses: actions/download-artifact@v4
- name: Add version name to the files that will be published
run: |
mv ${{ steps.download_artifacts.outputs.download-path }}/${{ env.PROJECT_NAME }}-Windows/${{ env.PROJECT_NAME }}-Windows.zip ./${{ env.PROJECT_NAME }}-${{ steps.get_release_version.outputs.RELEASE_VERSION }}-Windows.zip
mv ${{ steps.download_artifacts.outputs.download-path }}/${{ env.PROJECT_NAME }}-MacOS/${{ env.PROJECT_NAME }}-MacOS.zip ./${{ env.PROJECT_NAME }}-${{ steps.get_release_version.outputs.RELEASE_VERSION }}-MacOS.zip
mv ${{ steps.download_artifacts.outputs.download-path }}/${{ env.PROJECT_NAME }}-Linux/${{ env.PROJECT_NAME }}-Linux.zip ./${{ env.PROJECT_NAME }}-${{ steps.get_release_version.outputs.RELEASE_VERSION }}-Linux.zip
- name: Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: |
./${{ env.PROJECT_NAME }}-${{ steps.get_release_version.outputs.RELEASE_VERSION }}-Windows.zip
./${{ env.PROJECT_NAME }}-${{ steps.get_release_version.outputs.RELEASE_VERSION }}-Linux.zip
./${{ env.PROJECT_NAME }}-${{ steps.get_release_version.outputs.RELEASE_VERSION }}-MacOS.zip