fix package upload for CI #187
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
--- | |
name: C/C++ CI | |
on: | |
workflow_dispatch: | |
push: | |
tags: [v*] | |
branches: [main] | |
paths: ['**/*.cpp', '**/*.hpp', '**/*.yml'] | |
pull_request: | |
branches: [main] | |
paths: ['**/*.cpp', '**/*.hpp', '**,*.yml'] | |
env: | |
LIBNAME: o.scofo~ | |
jobs: | |
build: | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, macos-13, windows-latest, ubuntu-latest] | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 1 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Mac Build | |
if: runner.os == 'macOS' | |
run: | | |
pip install build scikit-build-core cibuildwheel twine | |
CMAKE_BUILD_PARALLEL_LEVEL=8 cibuildwheel --output-dir dist | |
- name: Linux Build | |
if: runner.os == 'Linux' | |
run: | | |
pip install build scikit-build-core cibuildwheel twine | |
CMAKE_BUILD_PARALLEL_LEVEL=8 cibuildwheel --output-dir dist | |
- name: Windows Build | |
if: runner.os == 'Windows' | |
run: | | |
python -m pip install build scikit-build-core cibuildwheel twine | |
$env:CMAKE_BUILD_PARALLEL_LEVEL = "8" | |
cibuildwheel --output-dir dist | |
- name: Upload to PyPI | |
run: | | |
twine upload dist/* -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} | |
macos-build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, macos-13] | |
precision: [32, 64] | |
newTag: | |
- ${{ startsWith(github.ref, 'refs/tags/') }} | |
exclude: | |
- newTag: false | |
os: macos-13 | |
precision: 32 | |
- newTag: false | |
os: macos-13 | |
precision: 64 | |
- newTag: false | |
os: macos-latest | |
precision: 64 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 1 | |
- name: Install PureData and Deps arm64 Mac | |
run: | | |
brew install pd | |
brew install pybind11 | |
brew install tree-sitter | |
- name: Set Architecture Name | |
run: | | |
if [[ "${{ matrix.os }}" == "macos-latest" ]]; then | |
echo "ARCH_NAME=arm" >> $GITHUB_ENV | |
else | |
echo "ARCH_NAME=x86" >> $GITHUB_ENV | |
fi | |
- name: Build Object | |
run: | | |
mkdir -p max | |
cmake . -B build -DPD_FLOATSIZE=${{ matrix.precision }} -DPDLIBDIR=./ -DBUILD_ALL_OBJECTS=ON -DCMAKE_BUILD_TYPE=Release | |
cmake --build build -j $(sysctl -n hw.logicalcpu) | |
cmake --install build | |
zip -r 'pd-${{env.LIBNAME}}-macos-${{env.ARCH_NAME}}-pd${{matrix.precision}}.zip' o.scofo~ | |
rm -dfr o.scofo~ | |
cp ./Resources/tests/bwv-1013.mp3 ./max/ | |
cp ./Resources/tests/bwv-1013.txt ./max/ | |
mv max o.scofo~ | |
zip -r 'max-${{env.LIBNAME}}-macos-${{env.ARCH_NAME}}.zip' o.scofo~ | |
- name: Release Pd External | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
body_path: ./Resources/CHANGELOG.md | |
tag_name: ${{ github.ref_name }} | |
files: | | |
pd-${{ env.LIBNAME }}-macos-${{ env.ARCH_NAME }}-pd${{ matrix.precision }}.zip | |
draft: true | |
prerelease: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release Max External | |
uses: softprops/action-gh-release@v2 | |
if: matrix.precision == '64' && startsWith(github.ref, 'refs/tags/') | |
with: | |
body_path: ./Resources/CHANGELOG.md | |
tag_name: ${{ github.ref_name }} | |
files: | | |
max-${{ env.LIBNAME }}-macos-${{ env.ARCH_NAME }}.zip | |
draft: true | |
prerelease: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
windows-build: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
compiler: [mingw] | |
arch: [amd64] | |
precision: [32, 64] # pd double and single float | |
newTag: | |
- ${{startsWith(github.ref, 'refs/tags/')}} | |
exclude: | |
- newTag: false | |
precision: 64 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 1 | |
- if: matrix.compiler == 'mingw' | |
name: Set up Msys2 | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: mingw64 | |
update: false | |
install: make mingw-w64-x86_64-gcc mingw64/mingw-w64-x86_64-cmake mingw-w64-x86_64-boost | |
mingw-w64-x86_64-tree-sitter mingw-w64-x86_64-pybind11 zip | |
- name: Install winget | |
if: matrix.compiler == 'mingw' | |
uses: Cyberboss/install-winget@v1 | |
- name: Install PureData Float 32 | |
if: matrix.compiler == 'mingw' && matrix.precision == '32' | |
run: | | |
winget install -e --id MillerPuckette.PureData --accept-source-agreements | |
npm install tree-sitter-cli | |
- name: Install PureData Float 64 | |
if: matrix.compiler == 'mingw' && matrix.precision == '64' | |
run: | | |
winget install -e --id MillerPuckette.Pd64 --accept-source-agreements | |
npm install tree-sitter-cli | |
- name: Configure and build Mingw | |
shell: msys2 {0} | |
if: matrix.compiler == 'mingw' | |
run: | | |
cmake . -B build -DPD_FLOATSIZE=${{ matrix.precision }} -DPDLIBDIR=./ -DBUILD_ALL_OBJECTS=ON -DCMAKE_BUILD_TYPE=Release | |
cmake --build build | |
cmake --install build | |
zip -r 'pd-${{env.LIBNAME}}-windows-pd${{matrix.precision}}.zip' o.scofo~ | |
rm -dfr o.scofo~ | |
cp ./Resources/tests/bwv-1013.mp3 ./max/ | |
cp ./Resources/tests/bwv-1013.txt ./max/ | |
cp -r max o.scofo~ | |
zip -r 'max-${{env.LIBNAME}}-windows.zip' o.scofo~ | |
- name: Release Pd External | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
body_path: ./Resources/CHANGELOG.md | |
tag_name: ${{ github.ref_name }} | |
files: | | |
pd-${{ env.LIBNAME }}-windows-pd${{ matrix.precision }}.zip | |
draft: true | |
prerelease: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release Max External | |
uses: softprops/action-gh-release@v2 | |
if: matrix.precision == '64' && startsWith(github.ref, 'refs/tags/') | |
with: | |
body_path: ./Resources/CHANGELOG.md | |
tag_name: ${{ github.ref_name }} | |
files: | | |
max-${{ env.LIBNAME }}-windows.zip | |
draft: true | |
prerelease: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
linux-build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
newTag: | |
- ${{ startsWith(github.ref, 'refs/tags/') }} | |
arch: [amd64, aarch64, arm] | |
precision: [32, 64] | |
exclude: | |
- newTag: false | |
arch: aarch64 | |
precision: 32 | |
- newTag: false | |
arch: arm | |
precision: 32 | |
- newTag: false | |
arch: aarch64 | |
precision: 64 | |
- newTag: false | |
arch: arm | |
precision: 64 | |
- newTag: false | |
arch: amd64 | |
precision: 64 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 1 | |
- name: PureData Sources | |
run: | | |
sudo apt update | |
sudo add-apt-repository ppa:pure-data/pure-data -y | |
sudo apt install puredata -y | |
sudo apt install libboost-all-dev | |
sudo apt install python3-pybind11 -y | |
npm install tree-sitter | |
- name: Install aarch64 gcc | |
if: matrix.arch == 'aarch64' | |
run: | | |
sudo apt install gcc-aarch64-linux-gnu -y | |
sudo apt install g++-aarch64-linux-gnu -y | |
- name: Install arm gcc | |
if: matrix.arch == 'arm' | |
run: | | |
sudo apt install gcc-arm-linux-gnueabihf -y | |
sudo apt install g++-arm-linux-gnueabihf -y | |
- name: Build Object | |
if: matrix.arch == 'amd64' | |
run: | | |
cmake . -B build -DPD_FLOATSIZE=${{ matrix.precision }} -DPDLIBDIR=./ -DBUILD_ALL_OBJECTS=ON -DCMAKE_BUILD_TYPE=Release | |
cmake --build build -- -j$(nproc) | |
sudo cmake --install build | |
zip -r 'pd-${{env.LIBNAME}}-linux-${{matrix.arch}}-pd${{matrix.precision}}.zip' o.scofo~ | |
- name: Build Object | |
if: matrix.arch == 'aarch64' | |
run: | | |
cmake . -B build -DPD_FLOATSIZE=${{ matrix.precision }} -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DPDLIBDIR=./ -DBUILD_ALL_OBJECTS=ON -DCMAKE_BUILD_TYPE=Release | |
cmake --build build -- -j$(nproc) | |
sudo cmake --install build | |
zip -r 'pd-${{env.LIBNAME}}-linux-${{matrix.arch}}-pd${{matrix.precision}}.zip' o.scofo~ | |
- name: Build Object | |
if: matrix.arch == 'arm' | |
run: | | |
cmake . -B build -DPD_FLOATSIZE=${{ matrix.precision }} -DCMAKE_SYSTEM_PROCESSOR=arm -DPDLIBDIR=./ -DBUILD_ALL_OBJECTS=ON -DCMAKE_BUILD_TYPE=Release | |
cmake --build build -- -j$(nproc) | |
sudo cmake --install build | |
zip -r 'pd-${{env.LIBNAME}}-linux-${{matrix.arch}}-pd${{matrix.precision}}.zip' o.scofo~ | |
- name: Release Pd External | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
body_path: ./Resources/CHANGELOG.md | |
tag_name: ${{ github.ref_name }} | |
files: | | |
pd-${{ env.LIBNAME }}-linux-${{ matrix.arch }}-pd${{ matrix.precision }}.zip | |
draft: true | |
prerelease: true | |
token: ${{ secrets.GITHUB_TOKEN }} |