Build_macOS_x64 #5
This file contains hidden or 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: Build_macOS_x64 | |
| on: workflow_dispatch #[push, pull_request] | |
| jobs: | |
| build_macOS_x64: | |
| runs-on: macos-13 | |
| env: | |
| _PYTHON_HOST_PLATFORM: "macosx-13.0-x86_64" | |
| ARCHFLAGS: "-arch x86_64" | |
| MACOSX_DEPLOYMENT_TARGET: "13.0" | |
| CPPFLAGS: "-I/usr/local/include" | |
| LDFLAGS: "-L/usr/local/lib" | |
| strategy: | |
| matrix: | |
| python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ] | |
| steps: | |
| - name: Check architecture | |
| run: uname -m && arch | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| brew update | |
| brew upgrade | |
| brew --prefix | |
| brew install fontconfig freetype glfw htslib jpeg-turbo libpng xz | |
| - name: Checkout gw | |
| run: | | |
| git submodule init | |
| git submodule update | |
| cd gw | |
| git checkout master | |
| git branch | |
| cd ../ | |
| - name: Build gw submodule | |
| run: | | |
| cd ./gw | |
| make prep > /dev/null 2>&1 | |
| CPPFLAGS+="-I$(brew --prefix)/include" LDFLAGS+="-L$(brew --prefix)/lib" make shared -j3 | |
| echo "LibGW compiled" | |
| cp libgw/*.* $(brew --prefix)/lib | |
| cp libgw/libskia.a ../gwplot/ | |
| cp -rf libgw/GW $(brew --prefix)/include | |
| cd .. | |
| ls $(brew --prefix)/include/GW | |
| ls -lh $(brew --prefix)/lib/libgw* | |
| ls -lh $(brew --prefix)/lib/libskia.a | |
| ls -lh ./gwplot | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install wheel setuptools delocate | |
| python -m pip install -r requirements.txt | |
| - name: Build wheel file | |
| run: | | |
| CPPFLAGS+="-I$(brew --prefix)/include -I$(brew --prefix)/include/GW" LDFLAGS+="-L$(brew --prefix)/lib" pip wheel . --wheel-dir dist | |
| - name: Delocate wheel file | |
| run: | | |
| DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$(brew --prefix)/lib" delocate-wheel -w dist -v dist/*.whl | |
| - name: Install and test wheel | |
| run: | | |
| mkdir -p test_env | |
| cd test_env | |
| cp ../dist/gwplot*.whl . | |
| python -m wheel unpack gwplot*.whl --dest wheel_contents | |
| echo "Unpacked wheel contents:" | |
| ls -Ra wheel_contents | |
| echo "Checking interface.so dependencies:" | |
| otool -L wheel_contents/gwplot-*/gwplot/interface.*.so | |
| echo "Checking libgw dependencies:" | |
| otool -L wheel_contents/gwplot-*/gwplot/.dylibs/libgw.*dylib | |
| PYTHON_VERSION=${{ matrix.python-version }} | |
| PYTHON_VERSION_NO_DOT=$(echo $PYTHON_VERSION | tr -d '.') | |
| python${PYTHON_VERSION} -m venv .venv | |
| source .venv/bin/activate | |
| python -m pip install *cp${PYTHON_VERSION_NO_DOT}*.whl | |
| python -c "import gwplot" | |
| - name: Archive wheel files | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels_macOS_x64_py${{ matrix.python-version }} | |
| path: dist/gwplot*.whl |