Build wheel #3
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: Build wheel | |
on: [workflow_dispatch, workflow_call] | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
fail-fast: true | |
matrix: | |
platform: [windows-latest, ubuntu-latest, macos-13, macos-14] | |
env: | |
CIBW_SKIP: 'pp*' | |
CIBW_ARCHS: 'auto64' | |
CIBW_PROJECT_REQUIRES_PYTHON: '>=3.9' | |
CIBW_TEST_REQUIRES: 'pytest' | |
defaults: | |
run: | |
shell: bash -l {0} | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up Python version ${{ matrix.version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: Install OMP (MacOS Intel) | |
if: matrix.platform == 'macos-13' | |
run: | | |
brew install llvm libomp | |
echo "export CC=/usr/local/opt/llvm/bin/clang" >> ~/.bashrc | |
echo "export CFLAGS=\"$CFLAGS -I/usr/local/opt/libomp/include\"" >> ~/.bashrc | |
echo "export CXXFLAGS=\"$CXXFLAGS -I/usr/local/opt/libomp/include\"" >> ~/.bashrc | |
echo "export LDFLAGS=\"$LDFLAGS -Wl,-rpath,/usr/local/opt/libomp/lib -L/usr/local/opt/libomp/lib -lomp\"" >> ~/.bashrc | |
source ~/.bashrc | |
- name: Install OMP (MacOS M1) | |
if: matrix.platform == 'macos-14' | |
run: | | |
brew install llvm libomp | |
echo "export CC=/opt/homebrew/opt/llvm/bin/clang" >> ~/.bashrc | |
echo "export CFLAGS=\"$CFLAGS -I/opt/homebrew/opt/libomp/include\"" >> ~/.bashrc | |
echo "export CXXFLAGS=\"$CXXFLAGS -I/opt/homebrew/opt/libomp/include\"" >> ~/.bashrc | |
echo "export LDFLAGS=\"$LDFLAGS -Wl,-rpath,/opt/homebrew/opt/libomp/lib -L/opt/homebrew/opt/libomp/lib -lomp\"" >> ~/.bashrc | |
source ~/.bashrc | |
- name: Install OMP (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt install libomp-dev | |
- name: Build Wheel | |
run: | | |
# Hack to ensure installed RAT package is used for test instead | |
# of local package. | |
mkdir tmp | |
cp -r tests tmp/tests/ | |
CIBW_TEST_COMMAND='cd ${pwd}/tmp && python -m pytest tests' | |
echo "CIBW_TEST_COMMAND=${CIBW_TEST_COMMAND}" >> $GITHUB_ENV | |
python -m pip install cibuildwheel==2.16.5 | |
python -m cibuildwheel --output-dir ./wheelhouse | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{ runner.os }}-${{ strategy.job-index }} | |
path: ./wheelhouse/*.whl |