Skip to content

Commit

Permalink
Merge pull request #20 from RuhiRG/relPrep
Browse files Browse the repository at this point in the history
REL: Prepare for first PyPI setup
  • Loading branch information
HaoZeke authored Aug 26, 2024
2 parents 3cc7d29 + 3c238d4 commit 007ca96
Show file tree
Hide file tree
Showing 8 changed files with 130 additions and 10 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,13 @@ jobs:
shell: bash -l {0}
run: |
micromamba activate pyseamsdev
meson wrap install fmt
meson wrap install eigen
meson setup bbdir
meson compile -C bbdir
- name: Run an import test (dev)
shell: bash -l {0}
run: |
python -c 'import bbdir.cyoda'
- name: Run standard tests
shell: bash -l {0}
run: |
pip install -v .[testing,adapters]
python -m pytest -vvv --approvaltests-add-reporter='PythonNativeReporter'
python -m pytest -vvv tests --approvaltests-add-reporter='PythonNativeReporter'
89 changes: 89 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Build on every branch push, tag push, and pull request change:
# From: https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml
# Also:
# https://github.com/airspeed-velocity/asv/blob/main/.github/workflows/build_wheels.yml
# include [wheel build] in the commit to trigger wheel builds
name: Build wheels
on: [push, pull_request, workflow_dispatch]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
get_commit_message:
name: Get commit message
runs-on: ubuntu-latest
# Once it is ready to be merged
# if: "github.repository == 'd-SEAMS/pydSEAMSlib'"
outputs:
message: ${{ steps.commit_message.outputs.message }}
steps:
- name: Checkout pydSEAMSlib
uses: actions/checkout@v4
# Gets the correct commit message for pull request
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Get commit message
id: commit_message
run: |
set -xe
COMMIT_MSG=$(git log --no-merges -1 --oneline)
echo "message=$COMMIT_MSG" >> $GITHUB_OUTPUT
echo github.ref ${{ github.ref }}
build_wheels:
name: Build wheels
needs: get_commit_message
if: >-
contains(needs.get_commit_message.outputs.message, '[wheel build]') ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0')))
runs-on: ${{ matrix.os }}
env: # Boost needs 13.0
MACOSX_DEPLOYMENT_TARGET: '13.0'
CIBW_BEFORE_ALL: "scripts/cibw_before_build.sh"
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
# TODO(ruhila) : windows-2022
os: [ubuntu-24.04, macos-13, macos-14]

steps:
- uses: actions/checkout@v4
- name: Echo build platform
run: echo Building wheels for ${{ matrix.os }}
- name: Build wheels
uses: pypa/[email protected]
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
needs: get_commit_message
if: >-
contains(needs.get_commit_message.outputs.message, '[wheel build]') ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0')))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build sdist
shell: bash -l {0}
run: |
pipx install meson
meson wrap install fmt
meson wrap install eigen
pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
2 changes: 2 additions & 0 deletions .github/workflows/ci_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
shell: bash -el {0}
run: |
# Will also install the package
meson wrap install fmt
meson wrap install eigen
pipx run pdm sync -v
pipx run pdm run sphinx-build -b html docs/source html
- name: Setup Pages
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ contributions but also questions or other clarifications. Note that we expect
all contributors to follow our [Code of Conduct](https://github.com/d-SEAMS/PydSEAMSlib/blob/main/CODE_OF_CONDUCT.md).

# Acknowledgments
This project was conceived as part of d-SEAM’s participation under the Python Software Foundation (PSF) in the [2023 iteration of the Google Summer of Code programme](https://summerofcode.withgoogle.com/programs/2023/projects/WAft7HXq).
This project was conceived as part of d-SEAM’s participation under the Python Software Foundation (PSF) in the [2023 iteration of the Google Summer of Code programme](https://summerofcode.withgoogle.com/programs/2023/projects/WAft7HXq). At that point it was called `pyseams`.

# License
[MIT](https://github.com/d-SEAMS/PydSEAMSlib/blob/main/LICENSE).
5 changes: 4 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ _linkto = [] # All the sub-libraries
_incdirs = [] # All the includes

# ---------------------- Library Dependencies
ydslib = subproject('seams-core', default_options: ['default_library=static']).get_variable(
ydslib = subproject(
'seams-core',
default_options: ['default_library=static', 'wrap_mode=forcefallback'],
).get_variable(
'yds_dep',
)
_deps += ydslib
Expand Down
17 changes: 16 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ build-backend = "mesonpy"
# Important, tells pip how to install the package
[tool.meson-python.args]
setup = [
#'-Dwrap_mode=forcefallback',
'-Dwrap_mode=forcefallback',
# ^-- collects subprojects, see https://github.com/ERGO-Code/HiGHS/pull/1343#discussion_r1252446966
]
# Skip during installation to prevent local RPATH stripping issues
Expand All @@ -52,4 +52,19 @@ install = ['--skip-subprojects']
# See: https://github.com/ERGO-Code/HiGHS/pull/1343/files
dist = ['--include-subprojects']

[tool.cibuildwheel]
skip = [ "pp*" ]

[tool.cibuildwheel.linux]
archs = ["auto64"]
manylinux-x86_64-image = "manylinux2014"
manylinux-aarch64-image = "manylinux2014"
musllinux-x86_64-image = "musllinux_1_2"

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

[tool.cibuildwheel.windows]
archs = [ "auto64" ]

[tool.pdm]
14 changes: 14 additions & 0 deletions scripts/cibw_before_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
brew install boost
else
# Linux (assuming yum-based system)
yum -y install boost-devel
fi

# Common commands for both systems
pip install meson
meson wrap install eigen
meson wrap install fmt
2 changes: 1 addition & 1 deletion subprojects/seams-core.wrap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[wrap-git]
directory=seams-core
url=https://github.com/RuhiRG/seams-core
revision=d3e4606400e6753153160bb8eb8cf6f405dc9737
revision=2b06b9a311648f9b87d41ae9e1fb04e214bfd0bc
[provide]
seams-core=git

0 comments on commit 007ca96

Please sign in to comment.