Skip to content

Commit 74c3017

Browse files
committed
test if publish to testpypi is ok.
1 parent 57a10d9 commit 74c3017

File tree

4 files changed

+88
-37
lines changed

4 files changed

+88
-37
lines changed

.github/workflows/pypi.yml

Lines changed: 69 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ on:
99
jobs:
1010

1111
# Job 1: Build & Test with Pip
12-
build_and_test:
12+
testing:
1313
runs-on: ${{ matrix.platform }}
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
platform: [windows-latest, macos-latest] # , ubuntu-latest
18-
python-version: ["3.x"]
17+
platform: [windows-latest, macos-latest, ubuntu-latest]
18+
python-version: ["3.8", "3.11"]
1919

2020
steps:
2121
- uses: actions/checkout@v4
@@ -32,35 +32,69 @@ jobs:
3232
- name: Run tests
3333
run: python -m pytest
3434

35-
# # Job 2: Build SDist & Wheels and Publish to TestPyPI
36-
# publish:
37-
# needs: build_and_test
38-
# runs-on: ${{ matrix.os }}
39-
# strategy:
40-
# matrix:
41-
# os: [ubuntu-22.04, windows-2022, macos-11]
42-
43-
# steps:
44-
# - uses: actions/checkout@v4
45-
46-
# - name: Set up Python
47-
# uses: actions/setup-python@v4
48-
49-
# - name: Build SDist & Wheels
50-
# run: |
51-
# pip install build
52-
# python -m build
53-
54-
# - name: Check metadata
55-
# run: |
56-
# pip install twine
57-
# twine check dist/*
58-
59-
# - name: Publish to TestPyPI
60-
# if: github.ref == 'refs/heads/master' # Only if on master branch
61-
# run: |
62-
# pip install twine
63-
# twine upload --repository testpypi dist/* --skip-existing
64-
# env:
65-
# TWINE_USERNAME: __token__
66-
# TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
35+
build_sdist:
36+
name: Build SDist
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v4
40+
with:
41+
submodules: true
42+
43+
- name: Build SDist
44+
run: pipx run build --sdist
45+
46+
- name: Check metadata
47+
run: pipx run twine check dist/*
48+
49+
- uses: actions/upload-artifact@v3
50+
with:
51+
path: dist/*.tar.gz
52+
53+
build_wheels:
54+
name: Wheels on ${{ matrix.os }}
55+
runs-on: ${{ matrix.os }}
56+
strategy:
57+
fail-fast: false
58+
matrix:
59+
os: [ubuntu-latest, macos-latest, windows-latest]
60+
61+
steps:
62+
- uses: actions/checkout@v4
63+
with:
64+
submodules: true
65+
66+
- uses: pypa/cibuildwheel@v2.13.0
67+
env:
68+
# Cross-compile on macOS
69+
CIBW_ARCHS_MACOS: x86_64 arm64
70+
71+
# Temporary: use pre-release Python 3.12 for stable ABI builds
72+
CIBW_PRERELEASE_PYTHONS: True
73+
74+
- name: Verify clean directory
75+
run: git diff --exit-code
76+
shell: bash
77+
78+
- name: Upload wheels
79+
uses: actions/upload-artifact@v3
80+
with:
81+
path: wheelhouse/*.whl
82+
83+
upload_all:
84+
name: Upload if release
85+
needs: [build_wheels, build_sdist]
86+
runs-on: ubuntu-latest
87+
# if: github.event_name == 'release' && github.event.action == 'published'
88+
89+
steps:
90+
- uses: actions/setup-python@v4
91+
92+
- uses: actions/download-artifact@v3
93+
with:
94+
name: artifact
95+
path: dist
96+
97+
- uses: pypa/gh-action-pypi-publish@release/v1
98+
with:
99+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
100+
repository-url: https://test.pypi.org/legacy/

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
dztimer
22
---
3+
<!-- <a href="https://github.com/KTH-RPL/dztimer"><img src="https://img.shields.io/github/v/release/KTH-RPL/dztimer?label=version" /> <a href="https://github.com/KTH-RPL/dztimer/blob/master/LICENSE"><img src="https://img.shields.io/github/license/KTH-RPL/dztimer" /> -->
4+
<img src="https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black" />
5+
<img src="https://img.shields.io/badge/Windows-0078D6?st&logo=windows&logoColor=white" />
6+
<img src="https://img.shields.io/badge/mac%20os-000000?&logo=apple&logoColor=white" />
7+
<!-- <img src="https://img.shields.io/pypi/pyversions/dztimer.svg" /></a> -->
38

49
A beautiful timer from ufomap by [Daniel Duberg](https://www.kth.se/profile/dduberg), nanobind by [Qingwen Zhang](https://kin-zhang.github.io/).
510

@@ -31,4 +36,11 @@ timer.print(random_colors=True, bold=True)
3136

3237
![image](https://github.com/Kin-Zhang/Kin-Zhang/assets/35365764/ca5ab0e7-e79d-47e0-bf77-9f837397f72a)
3338

34-
<!-- Tutorial on nanobind and pypi release in [Chinese blog](TODO) -->
39+
<!-- Tutorial on nanobind and pypi release in [Chinese blog](TODO) -->
40+
41+
42+
43+
### Issue I met when write this package
44+
1. multiple platform support, especially for windows, there is an error: error C2668: 'fpclassify': ambiguous call to overloaded function,[https://stackoverflow.com/questions/61646166/how-to-resolve-fpclassify-ambiguous-call-to-overloaded-function](https://stackoverflow.com/questions/61646166/how-to-resolve-fpclassify-ambiguous-call-to-overloaded-function). It's turn out if you want to `std::isnan()` in windows, you need to include `<cmath>` and `std::isnan(static_cast<double> (you_value))`.
45+
2. If you use `std::array` except linux, you need to include `#include <array>` and `std::array<int, 2> my_array;` instead of `std::array my_array;`
46+
3.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"
44

55
[project]
66
name = "dztimer"
7-
version = "0.0.4"
7+
version = "0.0.5"
88
description = "A beautiful timer from ufomap by Daniel Duberg, nanobind by Qingwen Zhang"
99
readme = "README.md"
1010
requires-python = ">=3.8"

src/timer.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
/*!
22
* UFOMap: An Efficient Probabilistic 3D Mapping Framework That Embraces the Unknown
33
*
4+
* @author Qingwen Zhang (qingwen@kth.se)
5+
* @version 2.0
6+
* @date 2023-10-21
7+
* @log support multiple platforms, compile with c++17 in windows, linux and macos
8+
*
49
* @author Daniel Duberg (dduberg@kth.se)
510
* @see https://github.com/UnknownFreeOccupied/ufomap
611
* @version 1.0

0 commit comments

Comments
 (0)