-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea74fc1
commit f6751f1
Showing
17 changed files
with
126 additions
and
119 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,39 @@ | ||
name: CMake build | ||
name: Build python wheels | ||
|
||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: '0 0 * * 1' # 0h mondays | ||
workflow_dispatch: | ||
inputs: | ||
git-ref: | ||
description: Git Ref (Optional) | ||
required: false | ||
|
||
# Show the git ref in the workflow name if it is invoked manually. | ||
run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0} ', inputs.git-ref) || '' }} | ||
|
||
|
||
permissions: | ||
contents: read | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
|
||
build-python: | ||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
continue-on-error: true | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-2019] | ||
# env: | ||
# BUILD_PYTHON_CI: 1 # Or maybe just a cmake option BUILD_PYTHON? Defaulted to false? And maybe we can set shared libs to false for this build? | ||
os: [ubuntu-20.04, windows-2019, macos-11] | ||
|
||
steps: | ||
|
||
- name: Clone Repository (Latest) | ||
uses: actions/checkout@v4 | ||
if: github.event.inputs.git-ref == '' | ||
with: | ||
ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS | ||
submodules: recursive | ||
- name: Clone Repository (Custom Ref) | ||
uses: actions/checkout@v4 | ||
if: github.event.inputs.git-ref != '' | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.inputs.git-ref }} | ||
ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS | ||
submodules: recursive | ||
fetch-depth: 0 # Get tags for use with git describe | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- run: pip install numpy pytest | ||
- run: python -c "import sys; print('PYTHON_EXECUTABLE=' + sys.executable)" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Install Ninja / Ubuntu | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
run: sudo apt update && sudo apt install ninja-build | ||
- name: Install Ninja / MacOS | ||
if: ${{ matrix.os == 'macos-latest' }} | ||
run: brew install ninja | ||
- name: Install Ninja / Windows | ||
if: ${{ matrix.os == 'windows-2022' }} | ||
run: choco install ninja | ||
- name: Checkout pybind11 submodule | ||
run: git submodule update --init python/pybind11 | ||
|
||
- name: Win_amd64 - install rtools | ||
if: ${{ matrix.os == 'windows-2022' }} | ||
run: | | ||
# mingw-w64 | ||
choco install rtools -y --no-progress --force --version=4.0.0.20220206 | ||
echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH | ||
# TODO: I need to move the mingw folder so that it doesn't pick up the wrong gcc, yes? | ||
- uses: fortran-lang/setup-fortran@main | ||
id: setup-fortran | ||
with: | ||
compiler: gcc | ||
version: 8 | ||
|
||
- name: Build | ||
run: | | ||
cmake --version | ||
cmake -G Ninja -DPython_EXECUTABLE=$PYTHON_EXECUTABLE -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=. -LAH . | ||
cmake --build . --target prima_pybind | ||
cmake --build . --target tests | ||
ctest --output-on-failure -V -R python-tests | ||
shell: bash | ||
- name: Build wheels | ||
uses: pypa/cibuildwheel@v2.16.2 | ||
|
||
# This is a work in progress, more to come. | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: ./wheelhouse/*.whl | ||
env: | ||
# On windows we get a complaint from CMake: | ||
# "CMake Error at python/pybind11/tools/FindPythonLibsNew.cmake:191 (message): | ||
# Python config failure: Python is 32-bit, chosen compiler is 64-bit" | ||
# I do not see a way to install a 32-bit compiler with the setup-fortran action, | ||
# so we will just build 64-bit wheels on windows. | ||
CIBW_ARCHS_WINDOWS: "AMD64" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,6 +109,7 @@ parts/ | |
sdist/ | ||
var/ | ||
wheels/ | ||
wheelhouse | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,33 @@ | ||
[build-system] | ||
requires = ["scikit-build-core", "numpy"] | ||
# scikit-build-core claims there's no need to explicitly specify Ninja, | ||
# as it will "automatically be downloaded if needed", but I don't know | ||
# how it determines "if needed", all I know is that we need it, particularly | ||
# for Windows. | ||
requires = ["scikit-build-core", "numpy", "ninja"] | ||
build-backend = "scikit_build_core.build" | ||
|
||
[project] | ||
name = "prima" | ||
dependencies = ["numpy"] | ||
dynamic = ["version"] | ||
requires-python = ">= 3.7" # Driving factor is availavility of scikit-build-core | ||
|
||
[tool.scikit-build] | ||
cmake.targets = ["_prima"] | ||
cmake.args = ["-G Ninja"] | ||
cmake.verbose = true | ||
logging.level = "INFO" | ||
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm" | ||
sdist.include = [".git-archival.txt"] | ||
install.components = ["Prima_Python_C_Extension"] | ||
|
||
[tool.setuptools_scm] # Section required | ||
version_file = "_version.txt" | ||
write_to = "_version.txt" | ||
|
||
[tool.cibuildwheel] | ||
build-verbosity = 3 | ||
test-command = "pytest -s {project}/python/tests" | ||
test-requires = ["pytest", "scipy", "pdfo"] | ||
|
||
|
||
[tool.cibuildwheel.windows] | ||
archs = ["AMD64"] |
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.