macos-arm64 and codesign #108
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env: | |
CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM: ${{ secrets.CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM }} | |
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} | |
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} | |
name: Compile | |
on: | |
pull_request: {} | |
push: | |
tags: | |
- '*' | |
jobs: | |
build-windows: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
include: | |
- { name: "win64", os: "windows-2022", python-version: "3.9", python-major: "39"} | |
- { name: "win64", os: "windows-2022", python-version: "3.11", python-major: "311"} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: Get CMake | |
uses: lukka/get-cmake@latest | |
- name: Build Windows (Release) | |
run: | | |
mkdir build | |
cmake . -DCMAKE_BUILD_TYPE=Release -Bbuild -DPython_ROOT_DIR=$pythonLocation | |
cd build | |
msbuild ChucKDesignerCHOP.sln /property:Configuration=Release | |
- name: Make distribution | |
run: | | |
mkdir ChucKDesigner-${{ matrix.name }}-Python${{ matrix.python-major }} | |
move ${{ github.workspace }}/Plugins/ChucK*.dll ChucKDesigner-${{ matrix.name }}-Python${{ matrix.python-major }} | |
7z a ChucKDesigner-${{ matrix.name }}-Python${{ matrix.python-major }}.zip ./ChucKDesigner-${{ matrix.name }}-Python${{ matrix.python-major }}/* -r | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ChucKDesigner-${{ matrix.name }}-Python${{ matrix.python-major }} | |
path: ChucKDesigner-${{ matrix.name }}-Python${{ matrix.python-major }}.zip | |
build-macos: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: macos-x86_64 | |
arch: x86_64 | |
os: macos-12 | |
python-version: "3.11" | |
python-major: "311" | |
- name: macos-arm64 | |
arch: arm64 | |
os: macos-12 | |
python-version: "3.11" | |
python-major: "311" | |
runs-on: macos-12 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install Certificate | |
run: | | |
echo "$MACOS_CERTIFICATE" | base64 --decode > certificate.p12 | |
security create-keychain -p "" build.keychain | |
security default-keychain -s build.keychain | |
security unlock-keychain -p "" build.keychain | |
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PASSWORD" -T /usr/bin/codesign | |
security find-identity -v | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Brew install requirements (arm64) | |
if: ${{ endsWith( matrix.name, 'macos-arm64') }} | |
run: | | |
brew update | |
PACKAGES=(flac libogg libtool libvorbis opus mpg123 lame) | |
DEPS=($(brew deps --union --topological $(echo $PACKAGES) | tr '\n' ' ')) | |
PACKAGES=("${DEPS[@]}" "${PACKAGES[@]}") | |
export HOMEBREW_NO_INSTALL_CLEANUP=1 | |
export HOMEBREW_NO_INSTALL_UPGRADE=1 | |
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 | |
for PACKAGE in "${PACKAGES[@]}" | |
do | |
echo "Fetching bottle: $PACKAGE" | |
response=$(brew fetch --bottle-tag=arm64_monterey $PACKAGE 2>&1) | |
package_path=$(echo $response | sed -n 's/.*\:\ \(.*\.tar\.gz\).*/\1/p') | |
package_path=$(echo "$package_path" | xargs) | |
echo "Package Path: $package_path" | |
brew reinstall --verbose --force-bottle "$package_path" || true | |
done | |
brew uninstall --ignore-dependencies curl git || true | |
- name: Install dependencies macOS | |
if: ${{ endsWith( matrix.name, 'macos-x86_64') }} | |
run: | | |
brew install autoconf autogen automake flac libogg libtool libvorbis opus mpg123 pkg-config | |
- name: Some Setup | |
run: | | |
cd thirdparty/chuck/src/core | |
bison -dv -b chuck chuck.y | |
flex -ochuck.yy.c chuck.lex | |
- name: Build MacOS (Release) | |
run: | | |
cmake -Bbuild -G "Xcode" -DCMAKE_OSX_ARCHITECTURES=${{matrix.arch}} -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DPYTHONVER="${{matrix.python-version}}" -DPython_ROOT_DIR=$pythonLocation | |
cmake --build build --config Release | |
codesign --force --verify --verbose=2 --timestamp --options=runtime --deep --sign "Developer ID Application" build/Release/ChucKDesignerCHOP.plugin | |
codesign --force --verify --verbose=2 --timestamp --options=runtime --deep --sign "Developer ID Application" build/Release/ChucKListenerCHOP.plugin | |
codesign --verify --deep --strict --verbose=2 build/Release/ChucKDesignerCHOP.plugin | |
codesign --verify --deep --strict --verbose=2 build/Release/ChucKListenerCHOP.plugin | |
- name: Make distribution | |
run: | | |
mkdir ChucKDesigner-${{ matrix.name }}-Python${{ matrix.python-major }} | |
cp ${{ github.workspace }}/build/Release/libChucKDesignerShared.dylib ChucKDesigner-${{ matrix.name }}-Python${{ matrix.python-major }} | |
mv ${{ github.workspace }}/build/Release/ChucKDesignerCHOP.plugin ChucKDesigner-${{ matrix.name }}-Python${{ matrix.python-major }} | |
mv ${{ github.workspace }}/build/Release/ChucKListenerCHOP.plugin ChucKDesigner-${{ matrix.name }}-Python${{ matrix.python-major }} | |
zip -r ChucKDesigner-${{ matrix.os }}-Python${{ matrix.python-major }}.zip ChucKDesigner-${{ matrix.name }}-Python${{ matrix.python-major }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ChucKDesigner-${{ matrix.name }}-Python${{ matrix.python-major }} | |
path: ChucKDesigner-${{ matrix.name }}-Python${{ matrix.python-major }}.zip | |
create-release: | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: [build-windows, build-macos] | |
runs-on: ubuntu-latest | |
name: "Create Release on GitHub" | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: "dist" | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "dist/*/*" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
draft: true |