-
Notifications
You must be signed in to change notification settings - Fork 2
104 lines (85 loc) · 2.79 KB
/
python.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Python Build
"on":
push:
branches: ["main"]
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
pull_request:
jobs:
from-sdist:
name: python source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install build packages and pytest
run: |
python -m pip install --upgrade pip wheel setuptools
python -m pip install "conan<2" scikit-build pytest cython numpy>=2
- name: Create sdist
run: python setup.py sdist
- name: Install pyssht
run: "pip install dist/pyssht-*.tar.gz"
- name: run pytest
run: pytest tests/test_pyssht.py
- uses: actions/upload-artifact@v2
if: ${{ startsWith(github.ref, 'refs/tags') }}
with:
path: ./dist/*.tar.gz
name: source-distribution
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: ${{ matrix.python-version }}
- name: Setup environment
run: |
python -m pip install --upgrade pip wheel
python -m pip install "conan<2" pytest ducc0
conan profile new default --detect
- name: Build wheels
run: pip wheel . --use-pep517 --no-deps -w dist
- name: install wheel
run: "pip install dist/*.whl"
- name: run pytests
run: pytest tests
- uses: actions/upload-artifact@v2
if: ${{ startsWith(github.ref, 'refs/tags') }}
with:
path: ./dist/*.whl
name: wheel-${{matrix.os}}-${{matrix.python-version}}
publication:
name: publish to pypi
if: ${{ startsWith(github.ref, 'refs/tags') }}
runs-on: ubuntu-latest
needs: [build_wheels, from-sdist]
steps:
- name: Download wheels and sdist
uses: actions/download-artifact@v4.1.7
- name: Move wheels and source distribution to dist/
run: |
mkdir -p dist
mv source-distribution/*.tar.gz wheel-*/*.whl dist
- name: Publish distribution 📦 to Test PyPI
if: ${{ github.ref != 'refs/tags/v1.5.2' }}
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: ${{ github.ref == 'refs/tags/v1.5.2' }}
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_TOKEN }}