Skip to content

Commit

Permalink
scikit-build-core first steps
Browse files Browse the repository at this point in the history
  • Loading branch information
boeschf committed Aug 10, 2023
1 parent dbecb09 commit 7e4f07b
Show file tree
Hide file tree
Showing 2 changed files with 206 additions and 0 deletions.
139 changes: 139 additions & 0 deletions .github/workflows/build-pip-wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
ame: GHEX Release Artifacts

on:
push:
branches:
- ciwheel
tags:
- v*

schedule:
- cron: '0 2 * * 0' # run at 2 AM every sunday

jobs:
get_timestamp:
name: Prep pyproject.toml
runs-on: ubuntu-latest

steps:
- name: Get GHEX
uses: actions/checkout@v3
with:
submodules: recursive
- name: Create unique version in pyproject.toml
if: startsWith(github.ref, 'refs/tags/v') == false
run: python3 -c 'import time;f=open("pyproject.toml","r+");c = f.readlines();d=[i.split("#")[0].strip()[:-1]+time.strftime("%Y%m%d%H%I%S")+"\"\n" if i.startswith("version") else i for i in c];f.seek(0);f.writelines(d);f.truncate()'
- uses: actions/upload-artifact@v3
with:
name: ghexver
path: ${{ github.workspace }}/pyproject.toml

build_binary_wheels:
name: Build wheels on ${{ matrix.os }}
needs: get_timestamp
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]

steps:
- name: Get GHEX
uses: actions/checkout@v3
with:
submodules: recursive
- name: Delete pyproject.toml
run: rm -f pyproject.toml
- name: Get pyproject.toml
uses: actions/download-artifact@v3
with:
name: ghexver
- name: Check pyproject.toml
run: cat pyproject.toml
- name: Install cibuildwheel
run: python3 -m pip install cibuildwheel
- name: Build wheels
run: python3 -m cibuildwheel --output-dir dist
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist/*.whl

build_sdist:
name: Build sdist
needs: get_timestamp
runs-on: ubuntu-latest

steps:
- name: Update pip and setup venv
run: python -m pip install --upgrade pip && python -m venv ~/env && . ~/env/bin/activate && echo PATH=$PATH >> $GITHUB_ENV
- name: Get packages
run: python3 -m pip install build
- name: Get GHEX
uses: actions/checkout@v3
with:
submodules: recursive
- name: Delete pyproject.toml
run: rm -f pyproject.toml
- name: Get pyproject.toml
uses: actions/download-artifact@v3
with:
name: ghexver
- name: Check pyproject.toml
run: cat pyproject.toml
- name: Make sdist
run: python3 -m build -s
- name: Install sdist
run: python3 -m pip install dist/ghex*.tar.gz
#- name: Run Python tests
# run: python3 -m unittest discover -v -s python
#- name: Run Python examples
# run: scripts/run_python_examples.sh
#- name: Test executables
# run: scripts/test_executables.sh
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist/*.tar.gz

#upload_test_pypi:
# name: upload to test pypi
# runs-on: ubuntu-latest
# needs: [build_binary_wheels, build_sdist]
# steps:
# - uses: actions/download-artifact@v3
# with:
# name: dist
# - name: Publish distribution 📦 to Test PyPI
# run: |
# pip install twine
# twine upload -r testpypi ./*
# env:
# TWINE_USERNAME: __token__
# TWINE_PASSWORD: ${{ secrets.TESTPYPI_SECRET }}

#make_release:
# name: draft new GitHub release
# if: startsWith(github.ref, 'refs/tags/v')
# runs-on: ubuntu-latest
# needs: [build_binary_wheels, build_sdist]
# steps:
# - name: "Clone w/ submodules"
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
# submodules: "recursive"
# path: arbor
# - name: Make full tarball
# run: |
# the_ref=${{ github.ref }}
# the_tag="${the_ref/refs\/tags\//}"
# $GITHUB_WORKSPACE/arbor/scripts/create_tarball $GITHUB_WORKSPACE/arbor $the_tag $GITHUB_WORKSPACE/arbor-$the_tag-full.tar.gz
# - name: "Make Release"
# uses: ncipollo/release-action@v1
# with:
# omitBody: false
# draft: true
# prerelease: false
# generateReleaseNotes: true
# artifacts: '*.whl,*full.tar.gz'
# token: ${{ secrets.GITHUB_TOKEN }}
67 changes: 67 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[build-system]
requires = [
"scikit-build-core",
]
build-backend = "scikit_build_core.build"

[project]
name = "pyghex"
version = "0.3.0" # will be replaced during build process
description = "Generic Halo Exchanges: Python API"
readme = {file = "README.md", content-type = "text/markdown"}
license = {file = "LICENSE"}
requires-python = ">=3.7"
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: C++"
]
dependencies = [
"numpy",
]

[project.urls]
repository = "https://github.com/ghex-org/GHEX"

#[project.optional-dependencies]
#test = [
# "pytest",
#]

[tool.scikit-build]
wheel.expand-macos-universal-tags = true
cmake.args = [
"GHEX_BUILD_PYTHON_BINDINGS=ON",
"GHEX_USE_BUNDLED_LIBS=ON",
"GHEX_USE_BUNDLED_GRIDTOOLS=ON",
"GHEX_USE_BUNDLED_OOMPH=ON",
]
wheel.install-dir = "ghex"
wheel.packages = []

[tool.cibuildwheel]
build-frontend = "build"
build = ["*linux*","*macosx*"]
skip = ["cp36*", "*musllinux*"]
#test-command = "python -m unittest discover -v -s {project}/python"
dependency-versions = "latest"

[tool.cibuildwheel.macos]
archs = ["universal2"]

[tool.cibuildwheel.macos.environment]
MACOSX_DEPLOYMENT_TARGET = "10.15"

[tool.cibuildwheel.linux]
archs = ["x86_64"]

[[tool.cibuildwheel.overrides]]
select = "*-musllinux*"
#TBD

0 comments on commit 7e4f07b

Please sign in to comment.