-
Notifications
You must be signed in to change notification settings - Fork 4
180 lines (154 loc) · 4.92 KB
/
Copy pathpython-package.yml
File metadata and controls
180 lines (154 loc) · 4.92 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# This workflow builds binary wheels using cibuildwheel and a source distribution.
# cibuildwheel handles manylinux and Windows wheel building across Python versions.
# Publishes to TestPyPI on pushes to dev, and PyPI on pushes to main.
name: Build Packages
on:
push:
branches: [ "main", "dev" ]
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches: [ "main" ]
jobs:
make-wheels:
name: Build wheels for ${{ matrix.python }} on ${{ matrix.os }} (compiler ${{ matrix.compiler-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python: ['cp310', 'cp311', 'cp312', 'cp313', 'cp314']
include:
- os: ubuntu-latest
compiler: gcc
compiler-version: 15
- os: windows-latest
compiler: gcc
compiler-version: 15
steps:
- name: Fortran Setup
uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.compiler-version }}
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0
- name: Show compiler versions
run: |
gcc --version
gfortran --version
- name: Build wheels
uses: pypa/cibuildwheel@v3.4.1
env:
CIBW_BUILD: ${{ matrix.python }}-*
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux*"
CIBW_ARCHS_LINUX: x86_64
CIBW_ARCHS_WINDOWS: AMD64
# Use manylinux_2_28 to get a gfortran-15-capable image
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_28_x86_64
# Install build dependencies inside the wheel-build environment
CIBW_BEFORE_BUILD_LINUX: |
dnf install -y gcc-gfortran ninja-build &&
pip install click numpy pandas build wheel setuptools setuptools_scm meson-python ninja patchelf
CIBW_BEFORE_BUILD_WINDOWS: |
pip install click numpy pandas build wheel setuptools setuptools_scm meson-python ninja
CIBW_BUILD_FRONTEND: "build"
CIBW_BUILD_VERBOSITY: 1
with:
output-dir: dist
- name: Store wheels
uses: actions/upload-artifact@v7
with:
name: pyfvs-${{ matrix.os }}-${{ matrix.python }}-wheels
path: dist/*.whl
if-no-files-found: warn
overwrite: true
make-sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
architecture: x64
cache: pip
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install click numpy pandas build wheel \
setuptools setuptools_scm meson-python ninja patchelf
- name: Create sdist
run: python -m build --sdist --no-isolation
- name: Store sdist
uses: actions/upload-artifact@v7
with:
name: pyfvs-sdist
path: dist/*.tar.gz
if-no-files-found: warn
overwrite: true
publish-testpypi:
name: Publish to TestPyPI (dev branch)
if: github.event_name == 'push' && github.ref == 'refs/heads/dev'
needs: [ make-wheels, make-sdist ]
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/pyfvs
permissions:
id-token: write # Required for OIDC trusted publishing
steps:
- name: Download all wheels
uses: actions/download-artifact@v4
with:
pattern: pyfvs-*-wheels
path: dist
merge-multiple: true
- name: Download sdist
uses: actions/download-artifact@v4
with:
name: pyfvs-sdist
path: dist
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
verbose: true
publish-pypi:
name: Publish to PyPI (main branch)
# Run on push to main branch or on tag push (for releases)
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
needs: [ make-wheels, make-sdist ]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pyfvs
permissions:
id-token: write # Required for OIDC trusted publishing
steps:
- name: Download all wheels
uses: actions/download-artifact@v4
with:
pattern: pyfvs-*-wheels
path: dist
merge-multiple: true
- name: Download sdist
uses: actions/download-artifact@v4
with:
name: pyfvs-sdist
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: true