Skip to content

Commit 58963e7

Browse files
Merge pull request #80 from Computer-Aided-Validation-Laboratory/test-github-actions
Initial setup for Github Actions
2 parents 434ff93 + 5c15a5e commit 58963e7

5 files changed

Lines changed: 194 additions & 2 deletions

File tree

.github/workflows/docs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ jobs:
3737
3838
- name: Setup Doxygen
3939
run: |
40-
sudo apt install doxygen
40+
sudo apt update
41+
sudo apt install -y doxygen
4142
cd docs/source
4243
doxygen Doxyfile
4344
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Install from source and linting
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
check-lint:
12+
name: Lint Code
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.11'
21+
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install pylint
26+
pip install -e .
27+
28+
- name: Lint with pylint
29+
run: |
30+
pylint src/pyvale --fail-under=8.0
31+
32+
install:
33+
name: Test Installation ${{ matrix.os }}
34+
runs-on: ${{ matrix.os }}
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-13, macos-14]
39+
40+
steps:
41+
- uses: actions/checkout@v3
42+
43+
- name: Set up Python
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: '3.11'
47+
48+
- name: Install libomp and set compiler on macos-13
49+
if: matrix.os == 'macos-13'
50+
run: |
51+
brew install libomp
52+
echo "CC=$(brew --prefix llvm@15)/bin/clang" >> $GITHUB_ENV
53+
echo "CXX=$(brew --prefix llvm@15)/bin/clang++" >> $GITHUB_ENV
54+
echo "LDFLAGS=-L$(brew --prefix libomp)/lib" >> $GITHUB_ENV
55+
echo "CPPFLAGS=-I$(brew --prefix libomp)/include" >> $GITHUB_ENV
56+
57+
- name: Install libomp and set compiler on macos-14
58+
if: matrix.os == 'macos-14'
59+
run: |
60+
brew install libomp
61+
echo "CC=$(brew --prefix llvm@15)/bin/clang" >> $GITHUB_ENV
62+
echo "CXX=$(brew --prefix llvm@15)/bin/clang++" >> $GITHUB_ENV
63+
echo "LDFLAGS=-L$(brew --prefix libomp)/lib" >> $GITHUB_ENV
64+
echo "CPPFLAGS=-I$(brew --prefix libomp)/include" >> $GITHUB_ENV
65+
66+
- name: Test package installation
67+
run: |
68+
python -m pip install --upgrade pip
69+
pip install -e .
70+
71+
- name: Smoke test
72+
run: |
73+
python -c "import pyvale"
74+
75+
- name: Run Blender pytests
76+
run: |
77+
pytest -v tests/blender/.

.github/workflows/wheels.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Build Wheels
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
release:
9+
types:
10+
- published
11+
jobs:
12+
build_wheels:
13+
name: Build wheels on ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
# macos13 is intel macos14 is arm
18+
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-13, macos-14]
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
# Set GCC and Deployment Target for macOS 13
24+
- name: Set GCC and MACOSX_DEPLOYMENT_TARGET for macOS 13
25+
if: matrix.os == 'macos-13'
26+
run: |
27+
echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> $GITHUB_ENV
28+
29+
# Set GCC and Deployment Target for macOS 14
30+
- name: Set GCC and MACOSX_DEPLOYMENT_TARGET for macOS 14
31+
if: matrix.os == 'macos-14'
32+
run: |
33+
echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> $GITHUB_ENV
34+
35+
- name: Install libomp for clang (macOS only)
36+
if: startsWith(matrix.os, 'macos')
37+
run: |
38+
brew install libomp
39+
40+
- name: Build wheels
41+
uses: pypa/cibuildwheel@v2.23.3
42+
with:
43+
package-dir: .
44+
output-dir: wheelhouse
45+
config-file: "{package}/pyproject.toml"
46+
env:
47+
CIBW_SKIP: "pp*"
48+
CIBW_ENVIRONMENT_MACOS: >
49+
CC=$(brew --prefix llvm@15)/bin/clang
50+
CXX=$(brew --prefix llvm@15)/bin/clang++
51+
LDFLAGS="-L$(brew --prefix libomp)/lib"
52+
CPPFLAGS="-I$(brew --prefix libomp)/include"
53+
- uses: actions/upload-artifact@v4
54+
with:
55+
name: pyvale-wheels-${{ matrix.os }}-${{ strategy.job-index }}
56+
path: ./wheelhouse/*.whl
57+
58+
59+
build_sdist:
60+
name: Build source distribution
61+
runs-on: ubuntu-latest
62+
steps:
63+
- uses: actions/checkout@v4
64+
65+
- name: Build sdist
66+
run: pipx run build --sdist
67+
68+
- uses: actions/upload-artifact@v4
69+
with:
70+
name: pyvale-sdist
71+
path: dist/*.tar.gz
72+
73+
upload_pypi:
74+
needs: [build_wheels, build_sdist]
75+
runs-on: ubuntu-latest
76+
environment: pypi
77+
permissions:
78+
id-token: write
79+
if: github.event_name == 'release' && github.event.action == 'published'
80+
steps:
81+
- uses: actions/download-artifact@v4
82+
with:
83+
pattern: pyvale-*
84+
path: dist
85+
merge-multiple: true
86+
87+
# upload to pypi
88+
- uses: pypa/gh-action-pypi-publish@release/v1
89+
#with:
90+
# repository-url: https://test.pypi.org/legacy/

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "pyvale"
7-
version = "2025.5.2"
7+
version = "2025.5.3"
88
description = "An all-in-one package for sensor simulation, sensor uncertainty quantification, sensor placement optimisation and simulation calibration or validation."
99
authors = [
1010
{ name = "scepticalrabbit et al.", email = "thescepticalrabbit@gmail.com" },
@@ -30,6 +30,7 @@ dependencies = [
3030
"bpy>=4.2.0",
3131
"pyyaml>=6.0.2",
3232
"pytest>=8.3.5",
33+
"pybind11>=2.13.6",
3334
]
3435

3536
[project.urls]

setup.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from setuptools import setup, Extension
2+
from Cython.Build import cythonize
3+
import numpy
4+
import sys
5+
6+
if sys.platform.startswith("win"):
7+
openmp_arg = '/openmp'
8+
else:
9+
openmp_arg = '-fopenmp'
10+
11+
ext_modules = [
12+
Extension(
13+
"pyvale.cython.rastercyth",
14+
["src/pyvale/cython/rastercyth.py",],
15+
include_dirs=[numpy.get_include()],
16+
extra_compile_args=["-ffast-math",openmp_arg],
17+
extra_link_args=[openmp_arg],
18+
),
19+
]
20+
21+
setup(
22+
ext_modules=cythonize(ext_modules, annotate=True),
23+
)

0 commit comments

Comments
 (0)