Skip to content

Commit 44c5c02

Browse files
authored
Adds action to build wheel manually (#22)
1 parent 129b351 commit 44c5c02

File tree

3 files changed

+74
-2
lines changed

3 files changed

+74
-2
lines changed

.github/workflows/build_wheel.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import platform
44
import sys
55
import pybind11
6-
from setuptools import setup, Extension
6+
from setuptools import setup, Extension, find_packages
77
from setuptools.command.build_ext import build_ext
88
from setuptools.command.build_clib import build_clib
99

@@ -152,7 +152,7 @@ def build_libraries(self, libraries):
152152
author_email = '',
153153
url = 'https://github.com/RascalSoftware/python-RAT',
154154
description = 'Python extension for the Reflectivity Analysis Toolbox (RAT)',
155-
packages = ['RAT'],
155+
packages = find_packages(),
156156
include_package_data = True,
157157
package_data = {'': [get_shared_object_name(libevent[0])]},
158158
cmdclass = {'build_clib': BuildClib, 'build_ext': BuildExt},

0 commit comments

Comments
 (0)