-
Notifications
You must be signed in to change notification settings - Fork 12
120 lines (99 loc) · 2.96 KB
/
Copy pathpython-package.yml
File metadata and controls
120 lines (99 loc) · 2.96 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Python package
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
release:
types:
- published
jobs:
sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install build dependencies
run: python -m pip install --upgrade pip build
- name: Build sdist
run: python -m build --sdist
- name: Upload sdist artifact
uses: actions/upload-artifact@v4
with:
name: dist-sdist
path: dist/*.tar.gz
wheel:
name: Build wheel on ${{ matrix.os }} / py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.9", "3.11", "3.13"]
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install build dependencies
run: python -m pip install --upgrade pip build pytest
- name: Build wheel
run: python -m build --wheel
- name: Install built wheel
run: python -m pip install --force-reinstall dist/*.whl
- name: Smoke test import and extension call
run: |
python - <<'PY'
import numpy as np
import okada4py as ok92
xs = np.array([0.0])
ys = np.array([0.0])
zs = np.array([0.0])
xc = np.array([0.0])
yc = np.array([0.0])
depth = np.array([2.12133])
length = np.array([10.0])
width = np.array([6.0])
dip = np.array([45.0])
strike = np.array([0.0])
ss = np.array([1.0])
ds = np.array([0.0])
ts = np.array([0.0])
mu = 30.0e9
nu = 0.25
outputs = ok92.okada92(xs, ys, zs, xc, yc, depth, length, width, dip, strike, ss, ds, ts, mu, nu)
print([item.shape if hasattr(item, 'shape') else item for item in outputs])
PY
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}-py${{ matrix.python-version }}
path: dist/*.whl
publish:
name: Publish to PyPI
if: github.event_name == 'release'
needs: [sdist, wheel]
runs-on: ubuntu-latest
environment:
name: pypi
permissions:
id-token: write
steps:
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
pattern: dist-*
path: dist
merge-multiple: true
- name: Show release artifacts
run: ls -1 dist
- name: Publish release distributions
uses: pypa/gh-action-pypi-publish@release/v1