Skip to content

only create release once #440

only create release once

only create release once #440

name: Build and upload artifacts
on: [push, pull_request]
env:
PD_VERSION: 0.55-0
PDINCLUDEDIR: ./pure-data/src
PDLIBDIR: ./build
LIBNAME: simplex
LIBSLUG: simplex # for github release zip files
jobs:
build_linux:
runs-on: ubuntu-20.04 # <-- FIXME: revert this to latest?
strategy:
matrix:
os: [linux]
arch: [amd64, arm, arm64]
floatsize: [32, 64]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up cross-compilation environment for ARM
if: matrix.arch == 'arm' || matrix.arch == 'arm64'
run: |
sudo apt-get update
if [ "${{ matrix.arch }}" = "arm64" ]; then
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
# ARM64 flags from pdlibbuilder
echo "ARCH_FLAGS=-mcpu=cortex-a53" >> $GITHUB_ENV
else
sudo apt-get install -y gcc-arm-linux-gnueabihf
echo "CC=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV
# ARM32 (armv7) flags from pdlibbuilder
echo "ARCH_FLAGS=-march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard" >> $GITHUB_ENV
fi
- name: Set architecture flags for amd64
if: matrix.arch == 'amd64'
run: |
echo "ARCH_FLAGS=-march=core2 -mfpmath=sse -msse -msse2 -msse3" >> $GITHUB_ENV
- name: Clone Pd
run: git clone --branch=${{ env.PD_VERSION }} --depth=1 https://github.com/pure-data/pure-data.git
- name: Compile amd64 external
if: matrix.arch == 'amd64'
run: |
if [ ${{ matrix.floatsize }} -eq 32 ]; then
make install floatsize=${{ matrix.floatsize }} extension=pd_${{ matrix.os }} \
CFLAGS="${ARCH_FLAGS}"
else
make install floatsize=${{ matrix.floatsize }} \
extension=${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.floatsize }}.so \
CFLAGS="${ARCH_FLAGS}"
fi
- name: Compile ARM external
if: matrix.arch == 'arm' || matrix.arch == 'arm64'
run: |
make install floatsize=${{ matrix.floatsize }} \
extension=${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.floatsize }}.so \
CFLAGS="${ARCH_FLAGS}"
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: ${{env.LIBNAME}}-${{ matrix.os }}-${{ matrix.arch }}-pd${{ matrix.floatsize }}
path: build/${{env.LIBNAME}}
build_macos:
runs-on: macos-latest
strategy:
matrix:
os: [darwin]
arch: [amd64, arm64]
floatsize: [32, 64]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Clone Pd
run: git clone --branch=${{ env.PD_VERSION }} --depth=1 https://github.com/pure-data/pure-data.git
- name: Set up environment
run: brew install make
- name: Compile external
run: |
ARCH=${{ matrix.arch == 'amd64' && 'x86_64' || matrix.arch }}
if [ ${{ matrix.floatsize }} -eq 32 ]; then
make install floatsize=${{ matrix.floatsize }} extension=d_${{ matrix.arch }} arch=${ARCH}
elif [ ${{ matrix.floatsize }} -eq 64 ]; then
make install floatsize=${{ matrix.floatsize }} extension=${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.floatsize }}.so arch=${ARCH}
fi
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: ${{env.LIBNAME}}-${{ matrix.os }}-${{ matrix.arch }}-pd${{ matrix.floatsize }}
path: build/${{env.LIBNAME}}
build_windows:
runs-on: windows-latest
strategy:
matrix:
os: [windows]
arch: [amd64]
floatsize: [32, 64]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Download Pure-Data Binaries
run: |
if (${{ matrix.floatsize }} -eq 32) {
Invoke-WebRequest -Uri "http://msp.ucsd.edu/Software/pd-${{env.PD_VERSION}}.msw.zip" -OutFile "pd${{ matrix.floatsize }}-${{env.PD_VERSION}}.msw.zip"
} else {
Invoke-WebRequest -Uri "https://puredata.info/downloads/pure-data/releases/${{env.PD_VERSION}}-pd64/Pd64-${{env.PD_VERSION}}.msw.zip" -OutFile "pd${{ matrix.floatsize }}-${{env.PD_VERSION}}.msw.zip"
}
Expand-Archive -Path "pd${{ matrix.floatsize }}-${{env.PD_VERSION}}.msw.zip" -DestinationPath .
- name: Set up compiler environment
run: |
echo "C:\\msys64\\usr\\bin" >> $GITHUB_PATH # Ensure make and GCC are in PATH
- name: Compile external
shell: bash
run: |
export PATH="/c/msys64/mingw64/bin:$PATH" # Ensure MinGW GCC is preferred if needed
if [ ${{ matrix.floatsize }} -eq 32 ]; then
make install CC=gcc PDINCLUDEDIR="pd-${{env.PD_VERSION}}/src" PDDIR="pd-${{env.PD_VERSION}}" PDBINDIR="pd-${{env.PD_VERSION}}/bin" floatsize=${{ matrix.floatsize }} extension=m_${{ matrix.arch }}
else
make install CC=gcc PDINCLUDEDIR="Pd-0.55.0/src" PDDIR="Pd-0.55.0" PDBINDIR="Pd-0.55.0/bin" floatsize=${{ matrix.floatsize }} extension=${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.floatsize }}.dll
fi
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: ${{env.LIBNAME}}-${{ matrix.os }}-${{ matrix.arch }}-pd${{ matrix.floatsize }}
path: build/${{env.LIBNAME}}
package_and_release:
runs-on: ubuntu-latest
needs: [build_linux, build_macos, build_windows]
permissions:
contents: write
actions: read
strategy:
matrix:
os: [windows, darwin, linux]
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Merge Artifacts to Package
run: |
mkdir -p ${{env.LIBNAME}}
cp -rn artifacts/${{env.LIBNAME}}-${{ matrix.os }}*/* ${{env.LIBNAME}}
- name: Upload Package
uses: actions/upload-artifact@v4
with:
name: ${{env.LIBNAME}}-${{ matrix.os }}
path: ${{env.LIBNAME}}
create_release:
runs-on: ubuntu-latest
needs: package_and_release
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Zip Files
run: |
for os in windows darwin linux; do
zip -r ${{env.LIBSLUG}}-${os}.zip artifacts/${{env.LIBNAME}}-${os}
done
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: ${{env.LIBSLUG}}-*.zip
deken_check_and_upload:
runs-on: ubuntu-latest
needs: [package_and_release]
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
with:
path: ${{env.LIBNAME}}-src
- uses: actions/download-artifact@v4
with:
name: ${{env.LIBNAME}}-windows
path: ${{env.LIBNAME}}-windows
- uses: actions/download-artifact@v4
with:
name: ${{env.LIBNAME}}-darwin
path: ${{env.LIBNAME}}-darwin
- uses: actions/download-artifact@v4
with:
name: ${{env.LIBNAME}}-linux
path: ${{env.LIBNAME}}-linux
- name: Check Deken Package
shell: bash
run: |
SHORT=${GITHUB_REF:11} # remove the 'refs/tags/v' prefix
SLUG=${SHORT//\//_} # replace '/' with '_'
for os in linux darwin windows; do
echo "## ${os}" | tee -a $GITHUB_STEP_SUMMARY
mkdir -p package-${os}
docker run --rm --user $(id -u) --volume ./${{env.LIBNAME}}-${os}:/${{env.LIBNAME}} \
--volume ./package-${os}:/package registry.git.iem.at/pd/deken \
deken package --output-dir /package --version "${SLUG}" /${{env.LIBNAME}}
dek_files=$(ls package-${os}/*.dek)
for dek_file in $dek_files; do
filename=$(basename "$dek_file")
echo -e "#### \`$filename\`" | tee -a $GITHUB_STEP_SUMMARY
echo '```' | tee -a $GITHUB_STEP_SUMMARY
unzip -l "$dek_file" | awk 'NR>3 {print $4}' | sed '/^$/d' | sort | tee -a $GITHUB_STEP_SUMMARY
echo '```' | tee -a $GITHUB_STEP_SUMMARY
done
done
- name: Upload Deken Package
if: ${{ !contains(github.ref, 'test') }}
shell: bash
env:
DEKEN_USERNAME: ${{ secrets.DEKEN_USERNAME }}
DEKEN_PASSWORD: ${{ secrets.DEKEN_PASSWORD }}
run: |
for os in linux darwin windows; do
docker run --rm -e DEKEN_USERNAME -e DEKEN_PASSWORD \
--volume ./${{env.LIBNAME}}-${os}:/${{env.LIBNAME}} registry.git.iem.at/pd/deken \
deken upload --version "${SLUG}" --name ${{env.LIBNAME}} --no-source-error /${{env.LIBNAME}}
done
docker run --rm -e DEKEN_USERNAME -e DEKEN_PASSWORD \
--volume ./${{env.LIBNAME}}-src:/${{env.LIBNAME}} registry.git.iem.at/pd/deken \
deken upload --version "${SLUG}" --name ${{env.LIBNAME}} /${{env.LIBNAME}}