Skip to content

Commit fc265da

Browse files
committed
Fix python workflow
1 parent 40b0012 commit fc265da

File tree

4 files changed

+87
-21
lines changed

4 files changed

+87
-21
lines changed

.github/workflows/python.yml

+81-13
Original file line numberDiff line numberDiff line change
@@ -9,62 +9,130 @@ name: Python Build
99
pull_request:
1010

1111
jobs:
12-
from-sdist:
13-
name: python unit-tests
12+
from_uv:
13+
name: python uv installation
1414
runs-on: ubuntu-latest
1515
steps:
16+
- uses: actions/checkout@v4
1617
- name: Install uv
1718
uses: astral-sh/setup-uv@v5
1819
with:
1920
version: "0.6.5"
2021
- name: "Set up Python"
2122
uses: actions/setup-python@v5
2223
with:
23-
python-version: 3.8
2424
python-version-file: "pyproject.toml"
2525

2626
- name: Install pyssht
2727
run: uv sync --all-extras --dev
2828

2929
- name: run pytest
30-
run: uv run pytest tests/test_pyssht.py
30+
run: uv run pytest
31+
32+
from_sdist:
33+
name: python source distribution
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
- name: Install uv
38+
uses: astral-sh/setup-uv@v5
39+
with:
40+
version: "0.6.5"
41+
42+
- name: "Set up Python"
43+
uses: actions/setup-python@v5
44+
with:
45+
python-version-file: "pyproject.toml"
46+
47+
- name: Build sdist
48+
run: uv build --sdist
49+
50+
- name: create venv
51+
run: uv venv
52+
53+
- name: install wheel
54+
run: "uv pip install dist/pyssht-*.tar.gz"
55+
56+
- name: run pytests
57+
run: uv pip install pytest && uv run pytest
3158

3259
build_wheels:
33-
name: Build wheels on ${{ matrix.os }}
60+
name: Build wheels
3461
runs-on: macos-latest
3562

3663
steps:
64+
- uses: actions/checkout@v4
3765
- name: Install uv
3866
uses: astral-sh/setup-uv@v5
3967
with:
4068
version: "0.6.5"
4169
- name: "Set up Python"
4270
uses: actions/setup-python@v5
4371
with:
44-
python-version: 3.8
72+
python-version-file: "pyproject.toml"
4573

4674
- name: Build wheels
4775
run: uv build --wheel
4876

77+
- name: create venv
78+
run: uv venv
79+
4980
- name: install wheel
50-
run: "pip install dist/*.whl"
81+
run: "uv pip install dist/*.whl"
5182

5283
- name: run pytests
53-
run: uv pip install pytest && pytest tests
84+
run: uv pip install pytest && uv run pytest
5485

55-
publication:
56-
name: publish to pypi
86+
publish_wheels:
87+
name: Build wheels and publish on ${{ matrix.os }}
5788
if: ${{ startsWith(github.ref, 'refs/tags') }}
58-
runs-on: macos-latest
89+
runs-on: ${{ matrix.os }}
90+
strategy:
91+
matrix:
92+
os: [ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-14]
93+
permissions:
94+
id-token: write
5995
steps:
96+
- uses: actions/checkout@v4
6097
- name: Install uv
6198
uses: astral-sh/setup-uv@v5
6299
with:
63100
version: "0.6.5"
101+
102+
- name: Build wheels
103+
uses: pypa/[email protected]
104+
env:
105+
CIBW_SKIP: "cp36-* cp37-* cp38-* pp* *musllinux*"
106+
CIBW_BUILD_FRONTEND: "build[uv]"
107+
108+
- name: Publish distribution 📦 to Test PyPI
109+
if: ${{ github.ref != 'refs/tags/v1.5.2' }}
110+
run: "uv publish --publish-url https://test.pypi.org/legacy/ wheelhouse/*.whl"
111+
112+
- name: Publish distribution 📦 to PyPI
113+
if: ${{ github.ref == 'refs/tags/v1.5.2' }}
114+
run: "uv publish wheelhouse/*.whl"
115+
116+
publish_sdist:
117+
name: Build sdist and publish on ubuntu
118+
if: ${{ startsWith(github.ref, 'refs/tags') }}
119+
runs-on: ubuntu-latest
120+
permissions:
121+
id-token: write
122+
steps:
123+
- uses: actions/checkout@v4
124+
- name: Install uv
125+
uses: astral-sh/setup-uv@v5
126+
with:
127+
version: "0.6.5"
128+
129+
- name: Build sdist
130+
run: uv build --sdist
131+
64132
- name: Publish distribution 📦 to Test PyPI
65133
if: ${{ github.ref != 'refs/tags/v1.5.2' }}
66-
run: "uv publish --publish-url https://test.pypi.org/legacy --token ${{ secrets.TEST_PYPI_TOKEN }}"
134+
run: "uv publish --publish-url https://test.pypi.org/legacy/ dist/*.tar.gz"
67135

68136
- name: Publish distribution 📦 to PyPI
69137
if: ${{ github.ref == 'refs/tags/v1.5.2' }}
70-
run: "uv publish --token ${{ secrets.TEST_PYPI_TOKEN }}"
138+
run: "uv publish dist/*.tar.gz"

CMakeLists.txt

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ project(
1111
HOMEPAGE_URL "http://astro-informatics.github.io/ssht/"
1212
LANGUAGES C)
1313

14-
option(conan_deps "Download dependencies using conan" OFF)
15-
1614
if(NOT CMAKE_BUILD_TYPE)
1715
set(CMAKE_BUILD_TYPE Debug)
1816
endif()
@@ -38,7 +36,7 @@ if(SKBUILD)
3836
COMPONENTS Interpreter Development.Module NumPy
3937
REQUIRED)
4038
add_subdirectory(src/pyssht)
41-
elseif(NOT CONAN_EXPORTED)
39+
else()
4240
include("${PROJECT_SOURCE_DIR}/cmake/exporting.cmake")
4341
endif()
4442

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ Then **SSHT** can be compiled with:
4747

4848
```bash
4949
git clone https://github.com/astro-informatics/ssht.git
50-
mkdir ssht/build && cd ssht/build
51-
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -Dconan_deps=True ..
52-
make
53-
make install
50+
cmake -B ./build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake
51+
cmake --build build
52+
ctest --test-dir build
53+
cmake --install build --install-prefix=/usr/local
5454
```
5555

5656
The above will also download [FFTW](http://www.fftw.org/), if necessary.

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ serialize =
1111

1212
[bumpversion:file:makefile]
1313

14-
[bumpversion:file:CMakelists.txt]
14+
[bumpversion:file:CMakeLists.txt]
1515

1616
[bumpversion:file:.github/workflows/python.yml]
1717

0 commit comments

Comments
 (0)