Skip to content

refactor: Initialize properties in PluginProcessor #9

refactor: Initialize properties in PluginProcessor

refactor: Initialize properties in PluginProcessor #9

#===========================================================================================
# This workflow will build the project for Windows, macOS, and Linux.
# It will also build an Arch Linux and Fedora package using Docker containers.
# The artifacts will be uploaded to the release page.
#
# TODO:
# - Add a step to sign the macOS package
# - Add a step after release to update the AUR repository
#===========================================================================================
name: Build Project
on:
workflow_dispatch:
pull_request:
push:
defaults:
run:
shell: bash
#===========================================================================================
# Environment Variables
env:
PROJECT_NAME: Oscilloscope
BUNDLE_NAME: oscilloscope
BUNDLE_ID: com.dimethoxy.oscilloscope
VERSION: 0.1.0
BUILD_DIR: build
DISPLAY: :0 # Linux pluginval needs this
HOMEBREW_NO_INSTALL_CLEANUP: 1
IPP_DIR: C:\Program Files (x86)\Intel\oneAPI\ipp\latest\lib\cmake\ipp
#===========================================================================================
# Build Jobs
#===========================================================================================
jobs:
#=========================================================================================
# Windows Build
#=========================================================================================
build-windows:
runs-on: windows-latest
steps:
- name: Export Variables
run: |
echo "BUILD_ARTIFACTS_DIR=$BUILD_DIR/src/${{env.PROJECT_NAME}}Plugin_artefacts/Release" >> $GITHUB_ENV
echo "WINDOWS-PACKAGE=${{env.BUNDLE_NAME}}-snapshot-windows.exe" >> $GITHUB_ENV
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup MSVC
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x64
spectre: true
- name: Set Up Windows
run: |
choco install ninja
choco install innosetup
- name: Cache IPP (Windows)
id: cache-ipp
uses: actions/cache@v4
with:
key: ipp-v6
path: C:\Program Files (x86)\Intel
- name: Install IPP (Windows)
if: steps.cache-ipp.outputs.cache-hit != 'true'
run: |
curl --output oneapi.exe https://registrationcenter-download.intel.com/akdlm/IRC_NAS/2e89fab4-e1c7-4f14-a1ef-6cddba8c5fa7/intel-ipp-2022.0.0.796_offline.exe
./oneapi.exe -s -x -f oneapi
./oneapi/bootstrapper.exe -s -c --action install --components=intel.oneapi.win.ipp.devel --eula=accept -p=NEED_VS2022_INTEGRATION=1 --log-dir=.
- name: Save IPP cache
if: steps.cache-ipp.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: C:\Program Files (x86)\Intel
key: ipp-v6
- name: Select CMake Preset
run: |
cmake --preset "Windows Release"
- name: Build
run: cmake --build build --config "Release"
- name: Copy Build Artifacts
run: |
mkdir -p artifacts
cp -r ${{env.BUILD_ARTIFACTS_DIR}}/VST3/${{env.PROJECT_NAME}}.vst3 \
artifacts/
cp -r ${{env.BUILD_ARTIFACTS_DIR}}/CLAP/${{env.PROJECT_NAME}}.clap \
artifacts/
shell: bash
- name: Create Installer
run: |
# Create the packaging directory
mkdir -p packaging
# Create the Inno Setup
envsubst < pkg/windows/Setup.iss > packaging/Setup.iss
iscc packaging/Setup.iss
# Move the installer to the artifacts directory
mv packaging/Output/"${{env.PROJECT_NAME}}_Setup.exe" artifacts/${{env.WINDOWS-PACKAGE}}
shell: bash
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-windows
path: artifacts
#=========================================================================================
# macOS Build
#=========================================================================================
build-macos:
runs-on: macos-latest
steps:
- name: Export Variables
run: |
echo "BUILD_ARTIFACTS_DIR=$BUILD_DIR/src/${{env.PROJECT_NAME}}Plugin_artefacts/Release" >> $GITHUB_ENV
echo "MAC_PACKAGE=${{env.BUNDLE_NAME}}-snapshot-macos.pkg" >> $GITHUB_ENV
- name: Checkout Code
uses: actions/checkout@v4
- name: Set Up Mac
run: brew install ninja osxutils
- name: Select CMake Preset
run: |
cmake --preset "Mac Release" \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
- name: Build
run: cmake --build build --config "Release"
- name: Copy Build Artifacts
run: |
mkdir -p artifacts
cp -r ${{env.BUILD_ARTIFACTS_DIR}}/VST3/${{env.PROJECT_NAME}}.vst3 \
artifacts/
cp -r ${{env.BUILD_ARTIFACTS_DIR}}/CLAP/${{env.PROJECT_NAME}}.clap \
artifacts/
cp -r ${{env.BUILD_ARTIFACTS_DIR}}/AU/${{env.PROJECT_NAME}}.component \
artifacts/
shell: bash
- name: Import Certificates
uses: sudara/basic-macos-keychain-action@v1
id: keychain
with:
dev-id-app-cert: ${{ secrets.DEV_ID_APP_CERT }}
dev-id-app-password: ${{ secrets.DEV_ID_PASSWORD }}
dev-id-installer-cert: ${{ secrets.DEV_ID_INSTALL_CERT }}
dev-id-installer-password: ${{ secrets.DEV_ID_PASSWORD }}
- name: Codesign (macOS)
run: |
# Set variables
VST3_BIN="artifacts/${{env.PROJECT_NAME}}.vst3/Contents/MacOS/${{env.PROJECT_NAME}}"
CLAP_BIN="artifacts/${{env.PROJECT_NAME}}.clap/Contents/MacOS/${{env.PROJECT_NAME}}"
AU_BIN="artifacts/${{env.PROJECT_NAME}}.component/Contents/MacOS/${{env.PROJECT_NAME}}"
# Codesign the binaries
codesign \
--force -s "${{secrets.DEVELOPER_ID_APPLICATION}}" \
-v "$VST3_BIN" \
--deep --strict --options=runtime --timestamp
codesign \
--force -s "${{secrets.DEVELOPER_ID_APPLICATION}}" \
-v "$CLAP_BIN" \
--deep --strict --options=runtime --timestamp
codesign \
--force -s "${{secrets.DEVELOPER_ID_APPLICATION}}" \
-v "$AU_BIN" \
--deep --strict --options=runtime --timestamp
shell: bash
- name: Create Installer
run: |
# Set variables
VST3_PATH="artifacts/${{env.PROJECT_NAME}}.vst3"
CLAP_PATH="artifacts/${{env.PROJECT_NAME}}.clap"
AU_PATH="artifacts/${{env.PROJECT_NAME}}.component"
PACKAGE_NAME="${{env.PROJECT_NAME}}-snapshot-macos.pkg"
# Create the packaging directory
mkdir -p packaging
# Create the distribution file
envsubst < pkg/mac/distribution.xml > packaging/distribution.xml
# Create the VST subpackage
pkgbuild \
--identifier "${{env.BUNDLE_ID}}.vst3.pkg" \
--version "$VERSION" \
--component "$VST3_PATH" \
--install-location "/Library/Audio/Plug-Ins/VST3" \
"packaging/${{env.PROJECT_NAME}}.vst3.pkg"
# Create the CLAP subpackage
pkgbuild \
--identifier "${{env.BUNDLE_ID}}.clap.pkg" \
--version "$VERSION" \
--component "$CLAP_PATH" \
--install-location "/Library/Audio/Plug-Ins/CLAP" \
"packaging/${{env.PROJECT_NAME}}.clap.pkg"
# Create the AU subpackage
pkgbuild \
--identifier "${{env.BUNDLE_ID}}.au.pkg" \
--version "$VERSION" \
--component "$AU_PATH" \
--install-location "/Library/Audio/Plug-Ins/Components" \
"packaging/${{env.PROJECT_NAME}}.au.pkg"
# Create the main package
cd packaging
productbuild \
--resources ./resources \
--distribution distribution.xml \
--sign "${{secrets.DEVELOPER_ID_INSTALLER}}" \
--timestamp "${{env.PROJECT_NAME}}.pkg"
# Notarize the package
xcrun notarytool submit "${{env.PROJECT_NAME}}.pkg" \
--apple-id ${{secrets.NOTARIZATION_USERNAME}} \
--password ${{secrets.NOTARIZATION_PASSWORD}} \
--team-id ${{secrets.TEAM_ID}} \
--wait
# Staple the package
xcrun stapler staple "${{env.PROJECT_NAME}}.pkg"
# Move the package to the artifacts directory
mv ${{env.PROJECT_NAME}}.pkg ../artifacts/${{env.MAC_PACKAGE}}
shell: bash
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-macos
path: artifacts
#=========================================================================================
# Ubuntu Linux Build
#=========================================================================================
build-ubuntu:
runs-on: ubuntu-latest
steps:
- name: Export Variables
run: |
echo "BUILD_ARTIFACTS_DIR=$BUILD_DIR/src/${{env.PROJECT_NAME}}Plugin_artefacts/Release" >> $GITHUB_ENV
echo "UBUNTU_PACKAGE=${{env.BUNDLE_NAME}}-snapshot-linux-ubuntu.deb" >> $GITHUB_ENV
echo "LINUX_PACKAGE=${{env.BUNDLE_NAME}}-snapshot-linux-vanilla.zip" >> $GITHUB_ENV
- name: Checkout Code
uses: actions/checkout@v4
- name: Set Up Linux
run: |
sudo apt-get update
sudo apt-get install ninja-build
sudo apt install libasound2-dev \
libjack-jackd2-dev \
ladspa-sdk \
libcurl4-openssl-dev \
libfreetype-dev \
libfontconfig1-dev \
libx11-dev \
libxcomposite-dev \
libxcursor-dev \
libxext-dev \
libxinerama-dev \
libxrandr-dev \
libxrender-dev \
libwebkit2gtk-4.1-dev \
libglu1-mesa-dev mesa-common-dev
sudo apt-get install -y dpkg-dev devscripts
sudo /usr/bin/Xvfb $DISPLAY &
shell: bash
- name: Select CMake Preset
run: |
cmake --preset "Linux Release"
- name: Build
run: cmake --build build --config "Release"
- name: Copy Artifacts
run: |
mkdir -p artifacts
cp -r ${{env.BUILD_ARTIFACTS_DIR}}/VST3/${{env.PROJECT_NAME}}.vst3 \
artifacts/
cp -r ${{env.BUILD_ARTIFACTS_DIR}}/CLAP/${{env.PROJECT_NAME}}.clap \
artifacts/
cp -r ${{env.BUILD_ARTIFACTS_DIR}}/LV2/${{env.PROJECT_NAME}}.lv2 \
artifacts/
shell: bash
- name: Package Linux Artifacts
run: |
# Set variables
UBUNTU_PACKAGE_DIR="${{env.BUNDLE_NAME}}-snapshot-linux-ubuntu"
UBUNTU_CONTROL_FILE="pkg/ubuntu/control"
VST3_INSTALL_DIR="/usr/lib/vst3/${{env.PROJECT_NAME}}"
CLAP_INSTALL_DIR="/usr/lib/clap/${{env.PROJECT_NAME}}"
LV2_INSTALL_DIR="/usr/lib/lv2/${{env.PROJECT_NAME}}"
# Create Vanilla package directory
mkdir -p vanilla
cp -r artifacts/${{env.PROJECT_NAME}}.vst3 vanilla/
cp -r artifacts/${{env.PROJECT_NAME}}.clap vanilla/
cp -r artifacts/${{env.PROJECT_NAME}}.lv2 vanilla/
# Zip and move the package to the artifacts directory
zip -r ${{env.LINUX_PACKAGE}} vanilla/*
mv ${{env.LINUX_PACKAGE}} artifacts/$LINUX_PACKAGE
# Create Debian package directory
mkdir -p $UBUNTU_PACKAGE_DIR/DEBIAN
mkdir -p $UBUNTU_PACKAGE_DIR/$VST3_INSTALL_DIR
mkdir -p $UBUNTU_PACKAGE_DIR/$CLAP_INSTALL_DIR
mkdir -p $UBUNTU_PACKAGE_DIR/$LV2_INSTALL_DIR
# Copy files to Debian package directory
cp -r artifacts/${{env.PROJECT_NAME}}.vst3 \
$UBUNTU_PACKAGE_DIR/$VST3_INSTALL_DIR/
cp -r artifacts/${{env.PROJECT_NAME}}.clap \
$UBUNTU_PACKAGE_DIR/$CLAP_INSTALL_DIR/
cp -r artifacts/${{env.PROJECT_NAME}}.lv2 \
$UBUNTU_PACKAGE_DIR/$LV2_INSTALL_DIR/
# Copy control file to Debian package directory
cp $UBUNTU_CONTROL_FILE $UBUNTU_PACKAGE_DIR/DEBIAN
# Build Debian package
dpkg-deb --build $UBUNTU_PACKAGE_DIR
# Move the package to the artifacts directory
cp -r *.deb artifacts/${{env.UBUNTU_PACKAGE}}
shell: bash
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-ubuntu
path: artifacts
#=========================================================================================
# Arch Linux Build
#=========================================================================================
build-archlinux:
runs-on: ubuntu-latest
container:
image: archlinux:latest
steps:
- name: Export Variables
run: |
echo "BUILD_ARTIFACTS_DIR=$BUILD_DIR/src/${{env.PROJECT_NAME}}Plugin_artefacts/Release" >> $GITHUB_ENV
echo "PACKAGE_NAME=${{env.BUNDLE_NAME}}-snapshot-linux-arch.pkg.tar.zst" >> $GITHUB_ENV
- name: Install Base Packages
run: |
pacman -Sy --noconfirm base-devel git
- name: Checkout Repository
uses: actions/checkout@v4
- name: Create user for build process
run: |
useradd -m dimethoxy
sudo su - dimethoxy
- name: Set permissions for the build directory
run: |
sudo chown -R dimethoxy:dimethoxy /__w/${{env.PROJECT_NAME}}/${{env.PROJECT_NAME}}/pkg/arch/git
sudo chmod -R u+rw /__w/${{env.PROJECT_NAME}}/${{env.PROJECT_NAME}}/pkg/arch/git
- name: Disable sudo password prompt
run: |
echo 'dimethoxy ALL=(ALL) NOPASSWD: ALL' | sudo tee -a /etc/sudoers
- name: Build Package
run: |
sudo -u dimethoxy bash -c 'cd pkg/arch/git && makepkg -s --noconfirm'
- name: Package Artifacts
run: |
# Remove the default package
rm pkg/arch/git/*debug*.pkg.tar.zst
# Move the package to the root directory
mv pkg/arch/git/*.pkg.tar.zst .
# Rename the package
mv *.pkg.tar.zst ${{env.PACKAGE_NAME}}
# Move the package to the artifacts directory
mkdir -p artifacts
mv ${{env.PACKAGE_NAME}} artifacts/
shell: bash
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-archlinux
path: artifacts
#=========================================================================================
# Release the project
#=========================================================================================
release:
runs-on: ubuntu-latest
needs: [build-windows, build-macos, build-ubuntu, build-archlinux]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Get Artifacts
uses: actions/download-artifact@v4
- name: Package Artifacts
run: |
mv artifacts-windows/*.exe .
mv artifacts-macos/*.pkg .
mv artifacts-ubuntu/*.deb .
mv artifacts-ubuntu/*.zip .
mv artifacts-archlinux/*.pkg.tar.zst .
shell: bash
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: "Snapshot"
prerelease: true
body: |
### ⚠️ WARNING: Unstable Release ⚠️
This is a **unstable** snapshot intended solely for testing purposes.
It may contain bugs, incomplete features, or cause instability.
**Not recommended** for production or general use—proceed with caution.
- name: Upload Artifacts
run: |
ls -la
gh release upload "Snapshot" ${{env.BUNDLE_NAME}}-snapshot-windows.exe --clobber
gh release upload "Snapshot" ${{env.BUNDLE_NAME}}-snapshot-linux-arch.pkg.tar.zst --clobber
gh release upload "Snapshot" ${{env.BUNDLE_NAME}}-snapshot-linux-ubuntu.deb --clobber
gh release upload "Snapshot" ${{env.BUNDLE_NAME}}-snapshot-linux-vanilla.zip --clobber
gh release upload "Snapshot" ${{env.BUNDLE_NAME}}-snapshot-macos.pkg --clobber