Skip to content

Commit ef39145

Browse files
committed
move lib dir to /libvcell/lib, add cibuildwheel to Github Action
1 parent 7904b4f commit ef39145

File tree

6 files changed

+52
-39
lines changed

6 files changed

+52
-39
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
"target/sbml-input"
8383
8484
mvn --batch-mode -P shared-dll package
85-
cp target/libvcell.so ../libvcell/_internal/libs
85+
cp target/libvcell.so ../libvcell/lib
8686
if: ${{ startsWith(matrix.os, 'ubuntu') }}
8787

8888
- name: test, record, and build/install native library (macos)
@@ -96,7 +96,7 @@ jobs:
9696
"target/sbml-input"
9797
9898
mvn --batch-mode -P shared-dll package
99-
cp target/libvcell.dylib ../libvcell/_internal/libs
99+
cp target/libvcell.dylib ../libvcell/lib
100100
if: ${{ startsWith(matrix.os, 'macos') }}
101101

102102
- name: test, record, and build/install native library (windows)
@@ -107,7 +107,7 @@ jobs:
107107
java -agentlib:native-image-agent=config-output-dir=target\recording -jar "target\vcell-native-1.0-SNAPSHOT.jar" "src\test\resources\TinySpacialProject_Application0.xml" "target\sbml-input"
108108
109109
mvn --batch-mode -P shared-dll package
110-
cp target/libvcell.dll ../libvcell/_internal/libs
110+
cp target/libvcell.dll ../libvcell/lib
111111
if: ${{ startsWith(matrix.os, 'windows') }}
112112

113113
- name: Install python dependencies

.github/workflows/on-release-main.yml

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
name: release-main
22

33
on:
4+
workflow_dispatch:
45
release:
56
types: [published]
67
branches: [main]
78

89
jobs:
9-
publish:
10+
build:
1011
strategy:
11-
matrix: # python-version: ["3.9", "3.10", "3.11", "3.12"]
12+
matrix:
13+
# python-version: ["3.9", "3.10", "3.11", "3.12"]
1214
python-version: ["3.11", "3.12"]
1315
# os: [macos-13, windows-latest, ubuntu-latest, macos-14]
1416
os: [ubuntu-latest, macos-14]
@@ -17,6 +19,7 @@ jobs:
1719
defaults:
1820
run:
1921
shell: bash
22+
2023
steps:
2124
- name: Check out
2225
uses: actions/checkout@v4
@@ -25,7 +28,8 @@ jobs:
2528
fetch-depth: 2
2629

2730

28-
- uses: actions/setup-python@v5
31+
- name: Set up Python
32+
uses: actions/setup-python@v5
2933
with:
3034
python-version: ${{ matrix.python-version }}
3135

@@ -42,12 +46,12 @@ jobs:
4246
native-image-job-reports: "true"
4347
cache: "maven"
4448

45-
- name: build entire project
49+
- name: build VCell Java project from submodule
4650
working-directory: vcell_submodule
4751
run: |
4852
mvn --batch-mode clean install dependency:copy-dependencies -DskipTests=true
4953
50-
- name: test, record, and build/install native library (ubuntu)
54+
- name: test, record, and build/install native library (ubuntu or macos)
5155
working-directory: vcell-native
5256
run: |
5357
mvn --batch-mode clean install
@@ -58,22 +62,9 @@ jobs:
5862
"target/sbml-input"
5963
6064
mvn --batch-mode -P shared-dll package
61-
cp target/libvcell.so ../libvcell/_internal/libs
62-
if: ${{ startsWith(matrix.os, 'ubuntu') }}
63-
64-
- name: test, record, and build/install native library (macos)
65-
working-directory: vcell-native
66-
run: |
67-
mvn --batch-mode clean install
68-
69-
java -agentlib:native-image-agent=config-output-dir=target/recording \
70-
-jar target/vcell-native-1.0-SNAPSHOT.jar \
71-
"src/test/resources/TinySpacialProject_Application0.xml" \
72-
"target/sbml-input"
73-
74-
mvn --batch-mode -P shared-dll package
75-
cp target/libvcell.dylib ../libvcell/_internal/libs
76-
if: ${{ startsWith(matrix.os, 'macos') }}
65+
cp target/libvcell.so ../libvcell/lib || true
66+
cp target/libvcell.dylib ../libvcell/lib || true
67+
if: ${{ startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos') }}
7768

7869
- name: test, record, and build/install native library (windows)
7970
working-directory: vcell-native
@@ -83,7 +74,7 @@ jobs:
8374
java -agentlib:native-image-agent=config-output-dir=target\recording -jar "target\vcell-native-1.0-SNAPSHOT.jar" "src\test\resources\TinySpacialProject_Application0.xml" "target\sbml-input"
8475
8576
mvn --batch-mode -P shared-dll package
86-
cp target/libvcell.dll ../libvcell/_internal/libs
77+
cp target/libvcell.dll ../libvcell/lib
8778
if: ${{ startsWith(matrix.os, 'windows') }}
8879

8980
- name: Install python dependencies
@@ -96,14 +87,33 @@ jobs:
9687
id: vars
9788
run: echo tag=${GITHUB_REF#refs/*/} >> $GITHUB_OUTPUT
9889

99-
- name: Build and publish
90+
- name: Build wheels
10091
run: |
101-
source .venv/bin/activate
102-
poetry version $RELEASE_VERSION
103-
make build-and-publish
104-
env:
105-
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
106-
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
92+
pip install cibuildwheel
93+
cibuildwheel --output-dir wheelhouse
94+
95+
- name: Upload wheels as artifacts
96+
uses: actions/upload-artifact@v3
97+
with:
98+
name: wheels
99+
path: wheelhouse/*.whl
100+
101+
publish:
102+
needs: build
103+
runs-on: ubuntu-latest
104+
steps:
105+
- name: Download wheels
106+
uses: actions/download-artifact@v3
107+
with:
108+
name: wheels
109+
path: wheelhouse
110+
111+
- name: Publish to PyPI
112+
uses: pypa/[email protected]
113+
with:
114+
password: ${{ secrets.PYPI_TOKEN }}
115+
packages_dir: wheelhouse
116+
107117
deploy-docs:
108118
needs: publish
109119
runs-on: ubuntu-latest

libvcell/_internal/libs/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

libvcell/_internal/native_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def _load_library(self) -> ctypes.CDLL:
2020
if lib_ext is None:
2121
raise OSError(f"Unsupported operating system: {system}")
2222

23-
libs_dir = files(libvcell).joinpath("_internal/libs")
23+
libs_dir = files(libvcell).joinpath("lib")
2424
if not libs_dir.is_dir():
2525
raise OSError(f"Could not find the shared library directory {libs_dir}")
2626

pyproject.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ packages = [
1010
{include = "libvcell"}
1111
]
1212
include = [
13-
{path="libvcell/_internal/libs/*", format="wheel"}
13+
{path="libvcell/lib/libvcell*", format="wheel"}
1414
]
1515

1616
[tool.poetry.dependencies]
@@ -30,6 +30,13 @@ mkdocs = "^1.6.1"
3030
mkdocs-material = "^9.5.50"
3131
mkdocstrings = {extras = ["python"], version = "^0.27.0"}
3232

33+
[tool.cibuildwheel]
34+
build = "cp311-manylinux_x86_64 cp311-macosx_x86_64 cp311-macosx_arm64 cp311-win_amd64"
35+
skip = "cp36-* cp37-* cp38-* cp310-*"
36+
37+
[tool.setuptools.package-data]
38+
libvcell = ["lib/*"]
39+
3340
[build-system]
3441
requires = ["poetry-core>=1.0.0"]
3542
build-backend = "poetry.core.masonry.api"

scripts/build_native.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ java -agentlib:native-image-agent=config-output-dir=target/recording \
4040
mvn package -P shared-dll
4141

4242
# install vcell-native as shared object library
43-
cp target/libvcell.dylib "$ROOT_DIR/libvcell/_internal/libs/libvcell.dylib"
43+
cp target/libvcell.dylib "$ROOT_DIR/libvcell/lib/libvcell.dylib"

0 commit comments

Comments
 (0)