Skip to content

build pd-lib-builder based pure data externals #65

build pd-lib-builder based pure data externals

build pd-lib-builder based pure data externals #65

---
name: build pd-lib-builder based pure data externals
on:
workflow_call:
workflow_dispatch:
inputs:
core_run_id:
description: "Run ID of a successful 'build zerr-core static library' workflow (needed when not triggered via workflow_run)"
required: false
type: string
# push:
# branches:
# - main
# paths:
# - 'puredata/**' # Trigger when Pure Data related code changes
workflow_run:
workflows: ["build zerr-core static library"]
types:
- completed
jobs:
macOS:
runs-on: macos-latest
env:
cflags: -mmacosx-version-min=10.9
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
submodules: true
- name: Ensure core artifact id present
env:
CORE_RUN_ID: ${{ github.event.workflow_run.id || inputs.core_run_id }}
run: |
if [ -z "${CORE_RUN_ID}" ]; then
echo "CORE_RUN_ID missing. Provide inputs.core_run_id when dispatching manually or trigger via workflow_run." >&2
exit 1
fi
- name: Download zerr-core library
uses: actions/download-artifact@v4
with:
name: zerr-core-macos
path: core/lib/
run-id: ${{ github.event.workflow_run.id || inputs.core_run_id }}
github-token: ${{ github.token }}
- name: Display structure of downloaded files
run: ls -R core/lib/
- name: Install Pure Data
run: brew install --cask pd
- name: Set up Conan
run: |
pip install conan
conan profile detect
- name: Configure Conan
working-directory: puredata
run: |
conan install . --output-folder=build --build=missing
- name: Build & Install
working-directory: puredata
run: |
make
make install PDLIBDIR=build
- name: Upload macOS artifacts
uses: actions/upload-artifact@v4
with:
name: zerr-pd-macos
path: puredata/build/zerr
linux:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
submodules: true
- name: Ensure core artifact id present
env:
CORE_RUN_ID: ${{ github.event.workflow_run.id || inputs.core_run_id }}
run: |
if [ -z "${CORE_RUN_ID}" ]; then
echo "CORE_RUN_ID missing. Provide inputs.core_run_id when dispatching manually or trigger via workflow_run." >&2
exit 1
fi
- name: Download zerr-core library
uses: actions/download-artifact@v4
with:
name: zerr-core-linux
path: core/lib/
run-id: ${{ github.event.workflow_run.id || inputs.core_run_id }}
github-token: ${{ github.token }}
- name: Display structure of downloaded files
run: ls -R core/lib/
- name: Install Pure Data
run: sudo apt update && sudo apt install puredata-dev
- name: Set up Conan
run: |
pip install conan
conan profile detect
- name: Configure Conan
working-directory: puredata
run: |
conan install . --output-folder=build --build=missing
- name: Build & Install
working-directory: puredata
run: |
make
make install PDLIBDIR=build
- name: Upload Linux artifacts
uses: actions/upload-artifact@v4
with:
name: zerr-pd-linux
path: puredata/build/zerr
windows:
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
submodules: true
- name: Ensure core artifact id present
shell: bash
env:
CORE_RUN_ID: ${{ github.event.workflow_run.id || inputs.core_run_id }}
run: |
if [ -z "${CORE_RUN_ID}" ]; then
echo "CORE_RUN_ID missing. Provide inputs.core_run_id when dispatching manually or trigger via workflow_run." >&2
exit 1
fi
- name: Set up MinGW
uses: egor-tensin/setup-mingw@v3
with:
arch: x64
- name: Install Pd
id: pd
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$url = "http://msp.ucsd.edu/Software/pd-0.53-2.msw.zip"
$zip = Join-Path $env:RUNNER_TEMP "Pd.zip"
$pdDir = Join-Path $env:ProgramFiles "pd"
Invoke-WebRequest $url -OutFile $zip
if (Test-Path $pdDir) { Remove-Item $pdDir -Recurse -Force }
New-Item -ItemType Directory -Path $pdDir | Out-Null
Expand-Archive -LiteralPath $zip -DestinationPath $pdDir -Force
Remove-Item $zip -Force
# flatten nested directory
$top = Get-ChildItem $pdDir | Where-Object { $_.PSIsContainer } | Select-Object -First 1
if ($top) {
Get-ChildItem $top.FullName | Move-Item -Destination $pdDir -Force
Remove-Item $top.FullName -Recurse -Force
}
$pd = "$pdDir\bin\pd.com"
"PD=$pd" | Out-File -FilePath $env:GITHUB_ENV -Append
"PD=$pd" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: Download zerr-core library
uses: actions/download-artifact@v4
with:
name: zerr-core-windows
path: core/lib/
run-id: ${{ github.event.workflow_run.id || inputs.core_run_id }}
github-token: ${{ github.token }}
- name: Set up Conan
shell: bash
run: |
set -euo pipefail
pip install conan
PROFILE_DIR="$HOME/.conan2/profiles"
mkdir -p "$PROFILE_DIR"
PROFILE="$PROFILE_DIR/mingw"
cat > "$PROFILE" << 'EOF'
[settings]
os=Windows
arch=x86_64
build_type=Release
compiler=gcc
compiler.version=13
compiler.libcxx=libstdc++11
[conf]
tools.build:compiler_executables={"c":"x86_64-w64-mingw32-gcc","cpp":"x86_64-w64-mingw32-g++"}
EOF
conan profile show mingw
- name: Install Dependencies
shell: bash
working-directory: puredata
run: |
mkdir -p build
conan install . --output-folder=build --build=missing -pr:b=mingw -pr:h=mingw
- name: Build External
shell: bash
working-directory: puredata
run: |
mingw32-make
mingw32-make install PDLIBDIR=build
- name: Upload Windows artifacts
uses: actions/upload-artifact@v4
with:
name: zerr-pd-windows
path: puredata/build/zerr