Skip to content

JerOrc is building on all platform 🚀 #40

JerOrc is building on all platform 🚀

JerOrc is building on all platform 🚀 #40

name: libzedmd-python-pybind11-extension
run-name: ${{ github.actor }} is building on all platform 🚀
on: [workflow_dispatch]
defaults:
run:
shell: bash
jobs:
version:
name: Detect libzedmd version
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- id: version
working-directory: extern/libzedmd/
run: |
VERSION_MAJOR=$(grep -Eo "ZEDMD_VERSION_MAJOR\s+[0-9]+" src/ZeDMD.h | grep -Eo "[0-9]+")
VERSION_MINOR=$(grep -Eo "ZEDMD_VERSION_MINOR\s+[0-9]+" src/ZeDMD.h | grep -Eo "[0-9]+")
VERSION_PATCH=$(grep -Eo "ZEDMD_VERSION_PATCH\s+[0-9]+" src/ZeDMD.h | grep -Eo "[0-9]+")
TAG="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
echo "${TAG}"
echo "tag=${TAG}" >> $GITHUB_OUTPUT
# - name: Check git tag
# if: startsWith(github.ref, 'refs/tags/v')
# run: |
# GIT_TAG="${GITHUB_REF#refs/tags/}"
# EXPECTED_TAG="v${{ steps.version.outputs.tag }}"
# if [[ "${GIT_TAG}" != "${EXPECTED_TAG}" ]]; then
# echo "Error: Git tag (${GIT_TAG}) does not match version from ZeDMD.h (v${{ steps.version.outputs.tag }})"
# exit 1
# fi
build:
name: Build libzedmd-${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.type }}
runs-on: ${{ matrix.os }}
needs: [ version ]
strategy:
fail-fast: false
matrix:
include:
# - { os: windows-latest, platform: win, arch: x64, type: Release }
- { os: windows-latest, platform: win, arch: x86, type: Release }
# - { os: macos-latest, platform: macos, arch: arm64, type: Release }
- { os: macos-latest, platform: macos, arch: x64, type: Release }
# - { os: ubuntu-latest, platform: linux, arch: x64, type: Release }
# - { os: ubuntu-24.04-arm, platform: linux, arch: aarch64, type: Release }
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- if: (matrix.platform == 'win')
name: Add msbuild to path (win runner)
uses: microsoft/setup-msbuild@v2
- if: (matrix.platform == 'macos')&&(matrix.arch == 'x64')
name: Set up Python x64
uses: actions/setup-python@v5
with:
architecture: 'x64'
python-version: 3.11.9
- if: (matrix.platform == 'macos')
name: Add autoconf and automake (mac runner)
run: |
brew install autoconf automake libtool
- name: Display Python version
run: python --version
- name: Which python
run: which -a python
- name: Build libzedmd-${{ matrix.platform }}-${{ matrix.arch }}
working-directory: extern/libzedmd/
run: |
./platforms/${{ matrix.platform }}/${{ matrix.arch }}/external.sh
if [[ "${{ matrix.platform }}" == "win" ]]; then
if [[ "${{ matrix.arch }}" == "x64" ]]; then
cmake -G "Visual Studio 17 2022" -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} -B build
elif [[ "${{ matrix.arch }}" == "x86" ]]; then
cmake -G "Visual Studio 17 2022" -A Win32 -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} -B build
elif [[ "${{ matrix.arch }}" == "arm64" ]]; then
cmake -G "Visual Studio 17 2022" -A ARM64 -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} -B build
fi
cmake --build build --config ${{ matrix.type }}
else
if [[ "$(uname)" == "Darwin" ]]; then
NUM_PROCS=$(sysctl -n hw.ncpu)
else
NUM_PROCS=$(nproc)
fi
cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} -B build
cmake --build build -- -j${NUM_PROCS}
fi
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Build libzedmd-python-python-extension
working-directory: build/
run: |
pwd
echo '--------------------------------------'
ls ../extern/libzedmd/build
echo '--------------------------------------'
rm -Rf ./*
if [[ "${{ matrix.platform }}" == "win" ]]; then
if [[ "${{ matrix.arch }}" == "x64" ]]; then
cmake -G "Visual Studio 17 2022" -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} ..
elif [[ "${{ matrix.arch }}" == "x86" ]]; then
cmake -G "Visual Studio 17 2022" -A Win32 -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} ..
elif [[ "${{ matrix.arch }}" == "arm64" ]]; then
cmake -G "Visual Studio 17 2022" -A ARM64 -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} ..
fi
cmake --build . --config ${{ matrix.type }}
else
if [[ "$(uname)" == "Darwin" ]]; then
NUM_PROCS=$(sysctl -n hw.ncpu)
else
NUM_PROCS=$(nproc)
fi
cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} ..
cmake --build . -- -j${NUM_PROCS}
fi
- name: List files in build
working-directory: build/
run: ls -a
# - name: Prepare artifacts