name: Build Platform Wheels and Conda Packages on: push: branches: [ main, master ] paths: - 'OtherLanguages/Python/**' - 'src/**' - 'build/conda/**' - '.github/workflows/build_wheels.yml' tags: - 'v*' pull_request: paths: - 'OtherLanguages/Python/**' - 'src/**' - 'build/conda/**' - '.github/workflows/build_wheels.yml' workflow_dispatch: permissions: contents: read jobs: build_wheels: name: Build Wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] steps: - name: Checkout Code uses: actions/checkout@v4 - name: Build C++ Binaries (Linux Container Compatibility) if: matrix.os == 'ubuntu-latest' uses: addnab/docker-run-action@v3 with: image: rockylinux:8 options: -v ${{ github.workspace }}:/workspace run: | dnf install -y gcc-c++ cmake make cd /workspace mkdir -p cmake_build cd cmake_build cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_RPATH="\$ORIGIN/../../..\$ORIGIN/../lib" cmake --build . --config Release - name: Build C++ Binaries (Windows & macOS Native) if: matrix.os != 'ubuntu-latest' shell: bash env: MACOSX_DEPLOYMENT_TARGET: '11.0' run: | mkdir cmake_build cd cmake_build if [ "${{ matrix.os }}" = "macos-latest" ]; then cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" else cmake .. -DCMAKE_BUILD_TYPE=Release fi cmake --build . --config Release - name: Stage Binaries for setup.py shell: bash run: | mkdir -p bin/Linux bin/windows bin/MacOS if [ "${{ matrix.os }}" = "windows-latest" ]; then cp cmake_build/Release/Lerc.dll bin/windows/ || cp cmake_build/Lerc.dll bin/windows/ || echo "DLL not found" cp cmake_build/Release/Lerc.lib bin/windows/ || cp cmake_build/Lerc.lib bin/windows/ || echo "LIB not found" elif [ "${{ matrix.os }}" = "macos-latest" ]; then cp cmake_build/libLerc.dylib bin/MacOS/ || cp cmake_build/Release/libLerc.dylib bin/MacOS/ || echo "DYLIB not found" else cp cmake_build/libLerc.so.4 bin/Linux/ || cp cmake_build/Release/libLerc.so.4 bin/Linux/ || \ cp cmake_build/libLerc.so bin/Linux/libLerc.so.4 || \ cp cmake_build/Release/libLerc.so bin/Linux/libLerc.so.4 || echo "libLerc.so.4 not found" fi - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11' - name: Build Wheel env: MACOSX_DEPLOYMENT_TARGET: '11.0' run: | python -m pip install --upgrade pip setuptools wheel build cd OtherLanguages/Python python setup.py build python -m build --wheel - name: Standardize Wheel Platform Labels shell: bash run: | cd OtherLanguages/Python/dist/ if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then for f in *linux_x86_64.whl; do [ -e "$f" ] && mv "$f" "${f/linux_x86_64/manylinux_2_28_x86_64}"; done fi - name: Upload Platform Wheel Artifacts uses: actions/upload-artifact@v4 with: name: pylerc-wheels-${{ matrix.os }} path: OtherLanguages/Python/dist/*.whl - name: Upload Binary Snippets for Conda uses: actions/upload-artifact@v4 with: name: compiled-binaries-${{ matrix.os }} path: bin/ build_conda: name: Assemble Noarch Conda Package needs: build_wheels runs-on: ubuntu-latest steps: - name: Checkout Code uses: actions/checkout@v4 - name: Download Windows Binaries uses: actions/download-artifact@v4 with: name: compiled-binaries-windows-latest path: bin/ - name: Download MacOS Binaries uses: actions/download-artifact@v4 with: name: compiled-binaries-macos-latest path: bin/ - name: Download Linux Binaries uses: actions/download-artifact@v4 with: name: compiled-binaries-ubuntu-latest path: bin/ - name: Setup Miniconda Environment uses: conda-incubator/setup-miniconda@v4 with: auto-update-conda: true auto-activate: true activate-environment: "" - name: Install Conda Build Tooling shell: bash -el {0} run: conda install -y python=3.11 conda-build - name: Build Noarch Conda Distribution shell: bash -el {0} run: | cd OtherLanguages/Python python setup.py build cd ../.. mkdir -p conda-out conda build build/conda/lerc/ --output-folder conda-out/ - name: Upload Conda Distribution Artifacts uses: actions/upload-artifact@v4 with: name: pylerc-conda-package path: conda-out/noarch/*.conda