|
| 1 | +name: Build wheel |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +concurrency: |
| 7 | + group: ${{ github.head_ref || github.run_id }} |
| 8 | + cancel-in-progress: true |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + platform: [windows-latest, ubuntu-latest, macos-latest, macos-14] |
| 16 | + env: |
| 17 | + CIBW_SKIP: 'pp*' |
| 18 | + CIBW_ARCHS: 'auto64' |
| 19 | + CIBW_PROJECT_REQUIRES_PYTHON: '>=3.9' |
| 20 | + CIBW_TEST_REQUIRES: 'pytest' |
| 21 | + # Appends the project path since build is not done in the project directory |
| 22 | + CIBW_TEST_COMMAND: 'pytest {project}/tmp/tests' |
| 23 | + |
| 24 | + defaults: |
| 25 | + run: |
| 26 | + shell: bash -l {0} |
| 27 | + |
| 28 | + runs-on: ${{ matrix.platform }} |
| 29 | + |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + submodules: true |
| 34 | + - name: Set up Python version ${{ matrix.version }} |
| 35 | + uses: actions/setup-python@v4 |
| 36 | + with: |
| 37 | + python-version: "3.x" |
| 38 | + - name: Install OMP (MacOS Intel) |
| 39 | + if: matrix.platform == 'macos-latest' |
| 40 | + run: | |
| 41 | + brew install llvm libomp |
| 42 | + echo "export CC=/usr/local/opt/llvm/bin/clang" >> ~/.bashrc |
| 43 | + echo "export CFLAGS=\"$CFLAGS -I/usr/local/opt/libomp/include\"" >> ~/.bashrc |
| 44 | + echo "export CXXFLAGS=\"$CXXFLAGS -I/usr/local/opt/libomp/include\"" >> ~/.bashrc |
| 45 | + echo "export LDFLAGS=\"$LDFLAGS -Wl,-rpath,/usr/local/opt/libomp/lib -L/usr/local/opt/libomp/lib -lomp\"" >> ~/.bashrc |
| 46 | + source ~/.bashrc |
| 47 | + - name: Install OMP (MacOS M1) |
| 48 | + if: matrix.platform == 'macos-14' |
| 49 | + run: | |
| 50 | + brew install llvm libomp |
| 51 | + echo "export CC=/opt/homebrew/opt/llvm/bin/clang" >> ~/.bashrc |
| 52 | + echo "export CFLAGS=\"$CFLAGS -I/opt/homebrew/opt/libomp/include\"" >> ~/.bashrc |
| 53 | + echo "export CXXFLAGS=\"$CXXFLAGS -I/opt/homebrew/opt/libomp/include\"" >> ~/.bashrc |
| 54 | + echo "export LDFLAGS=\"$LDFLAGS -Wl,-rpath,/opt/homebrew/opt/libomp/lib -L/opt/homebrew/opt/libomp/lib -lomp\"" >> ~/.bashrc |
| 55 | + source ~/.bashrc |
| 56 | + - name: Install OMP (Linux) |
| 57 | + if: runner.os == 'Linux' |
| 58 | + run: | |
| 59 | + sudo apt-get update |
| 60 | + sudo apt install libomp-dev |
| 61 | + - name: Build Wheel |
| 62 | + run: | |
| 63 | + # Hack to ensure installed RAT package is used for test instead |
| 64 | + # of local package. |
| 65 | + mkdir tmp |
| 66 | + cp -r tests tmp/tests/ |
| 67 | + python -m pip install cibuildwheel==2.16.5 |
| 68 | + python -m cibuildwheel --output-dir wheelhouse |
| 69 | + - uses: actions/upload-artifact@v4 |
| 70 | + with: |
| 71 | + name: wheels-${{ runner.os }}-${{ strategy.job-index }} |
| 72 | + path: ./wheelhouse/*.whl |
0 commit comments