--- name: Compile PureData Object on: push: branches: [main] #╭──────────────────────────────────────╮ #│ Uncomment if you want to trigger a │ #│ release │ #╰──────────────────────────────────────╯ # workflow_dispatch: # inputs: # publish_release: # description: Publish a GitHub Release using LIBVERSION after build # required: false # type: boolean # default: false env: LIBNAME: examples LIBVERSION: 0.0.0 permissions: contents: write jobs: macos: runs-on: ${{ matrix.machines }} strategy: matrix: precision: [32, 64] machines: [macos-latest] steps: - uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 - name: Install PureData and Deps run: | brew install pd - name: Build run: | cmake . -B build -DPDLIBDIR=./ -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DPD_FLOATSIZE=${{ matrix.precision }} cmake --build build --parallel cmake --install build - name: Upload Object uses: actions/upload-artifact@v4 with: name: ${{env.LIBNAME}}-${{env.LIBVERSION}}-${{matrix.machines}}-universal-pd${{matrix.precision}} path: ${{env.LIBNAME}} linux-build: runs-on: ubuntu-latest strategy: matrix: arch: [amd64, arm, aarch64] precision: [32, 64] steps: - uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 1 - name: PureData Sources run: | sudo apt-get update sudo add-apt-repository ppa:pure-data/pure-data -y sudo apt-get install puredata -y - name: Install compiler id: compiler run: | arch="" test "${{ matrix.arch }}" != "aarch64" || arch="aarch64-linux-gnu" test "${{ matrix.arch }}" != "arm" || arch="arm-linux-gnueabihf" if test -n "${arch}"; then sudo apt-get install -y g++-${arch} echo "arch=${arch}" >> $GITHUB_OUTPUT fi - name: Configure run: | arch="${{ steps.compiler.outputs.arch }}" cmake . -B build -DPD_FLOATSIZE=${{ matrix.precision }} -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} -DPDLIBDIR=./ -DCMAKE_BUILD_TYPE=Release ${arch:+-DCMAKE_C_COMPILER=${arch}-gcc -DCMAKE_CXX_COMPILER=${arch}-g++} - name: Build Object run: | cmake --build build -- -j$(nproc) cmake --install build - name: Upload Object uses: actions/upload-artifact@v4 with: name: ${{env.LIBNAME}}-${{env.LIBVERSION}}-ubuntu-latest-${{matrix.arch}}-pd${{matrix.precision}} path: ${{env.LIBNAME}} windows-build: runs-on: windows-latest strategy: matrix: compiler: [mingw] arch: [amd64] precision: [32, 64] steps: - name: Checkout repository uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 - if: matrix.compiler == 'mingw' name: Set up Msys2 uses: msys2/setup-msys2@v2 with: msystem: mingw64 install: make mingw-w64-x86_64-gcc mingw64/mingw-w64-x86_64-cmake update: false - name: Install PureData Float 32 if: matrix.precision == '32' run: | winget install -e --id MillerPuckette.PureData --accept-source-agreements - name: Install PureData Float 64 if: matrix.precision == '64' run: | winget install -e --id MillerPuckette.Pd64 --accept-source-agreements - name: Configure and build Mingw shell: msys2 {0} if: matrix.compiler == 'mingw' run: | cmake . -B build -DPD_FLOATSIZE=${{ matrix.precision }} -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} -DPDLIBDIR=./ -DCMAKE_BUILD_TYPE=Release cmake --build build --parallel cmake --install build - name: Upload uses: actions/upload-artifact@v4 with: name: ${{env.LIBNAME}}-${{env.LIBVERSION}}-windows-latest-${{matrix.arch}}-pd${{matrix.precision}} path: ${{env.LIBNAME}} #╭──────────────────────────────────────╮ #│ Here an example to how publish a │ #│ release, uncomment the input or │ #│ remove the if │ #╰──────────────────────────────────────╯ # publish-release: # if: ${{ github.event.inputs.publish_release == 'true' }} # needs: [macos, linux-build, windows-build] # runs-on: ubuntu-latest # steps: # - name: Download all artifacts # uses: actions/download-artifact@v4 # with: # path: artifacts # - name: Create unified onnx directory and archive # run: | # set -e # TOPDIR="$LIBNAME" # mkdir -p "$TOPDIR" # for artifact_dir in artifacts/*; do # [ -d "$artifact_dir" ] || continue # cp -r "$artifact_dir/"* "$TOPDIR/" # done # ls -1 "$TOPDIR" # ZIP_NAME="${LIBNAME}-${LIBVERSION}-all-platforms.zip" # zip -r "$ZIP_NAME" "$TOPDIR" # - name: Create / Update GitHub Release # uses: softprops/action-gh-release@v2 # with: # tag_name: v${{ env.LIBVERSION }} # name: ${{ env.LIBNAME }} v${{ env.LIBVERSION }} # target_commitish: ${{ github.sha }} # files: | # ${{ env.LIBNAME }}-${{ env.LIBVERSION }}-all-platforms.zip # draft: true # prerelease: false