Skip to content

Commit 27fc5dd

Browse files
authored
Merge pull request #70 from jcapriot/wheel_building
Wheel building
2 parents 74f5ddd + 611ea0a commit 27fc5dd

File tree

7 files changed

+282
-114
lines changed

7 files changed

+282
-114
lines changed

.github/workflows/release.yml

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
name: Release
2+
on:
3+
push:
4+
# Sequence of patterns matched against refs/tags
5+
tags:
6+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
7+
8+
jobs:
9+
build_manylinux_x86_64_wheels:
10+
name: Build manylinux_x86_64
11+
runs-on: ubuntu-20.04
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Build wheels
15+
uses: pypa/cibuildwheel@v2.16.2
16+
env:
17+
CIBW_BUILD: "*manylinux_x86_64"
18+
CIBW_ARCHS_LINUX: x86_64
19+
- uses: actions/upload-artifact@v3
20+
with:
21+
path: ./wheelhouse/*.whl
22+
- name: Upload wheels to pypi
23+
uses: pypa/gh-action-pypi-publish@release/v1
24+
with:
25+
user: __token__
26+
password: ${{ secrets.PYPI_API_TOKEN }}
27+
skip_existing: true
28+
packages-dir: ./wheelhouse/
29+
30+
build_manylinux_aarch64_wheels:
31+
name: Build manylinux_aarch64
32+
runs-on: ubuntu-20.04
33+
steps:
34+
- uses: actions/checkout@v4
35+
- name: Set up QEMU
36+
uses: docker/setup-qemu-action@v3
37+
with:
38+
platforms: all
39+
- name: Build wheels
40+
uses: pypa/cibuildwheel@v2.16.2
41+
env:
42+
CIBW_ARCHS_LINUX: aarch64
43+
CIBW_BUILD: "*manylinux_aarch64"
44+
- uses: actions/upload-artifact@v3
45+
with:
46+
path: ./wheelhouse/*.whl
47+
- name: Upload wheels to pypi
48+
uses: pypa/gh-action-pypi-publish@release/v1
49+
with:
50+
user: __token__
51+
password: ${{ secrets.PYPI_API_TOKEN }}
52+
skip_existing: true
53+
packages-dir: ./wheelhouse/
54+
55+
build_musllinux_x86_64_wheels:
56+
name: Build musllinux_x86_64 wheels
57+
runs-on: ubuntu-20.04
58+
steps:
59+
- uses: actions/checkout@v4
60+
- name: Build wheels
61+
uses: pypa/cibuildwheel@v2.16.2
62+
env:
63+
CIBW_BUILD: "*musllinux_x86_64"
64+
CIBW_ARCHS_LINUX: x86_64
65+
- uses: actions/upload-artifact@v3
66+
with:
67+
path: ./wheelhouse/*.whl
68+
- name: Upload wheels to pypi
69+
uses: pypa/gh-action-pypi-publish@release/v1
70+
with:
71+
user: __token__
72+
password: ${{ secrets.PYPI_API_TOKEN }}
73+
skip_existing: true
74+
packages-dir: ./wheelhouse/
75+
76+
build_mac_wheels:
77+
name: Build macos wheels
78+
runs-on: macos-11
79+
steps:
80+
- uses: actions/checkout@v4
81+
- name: Build wheels
82+
uses: pypa/cibuildwheel@v2.16.2
83+
env:
84+
CIBW_ARCHS_MACOS: x86_64 arm64
85+
- uses: actions/upload-artifact@v3
86+
with:
87+
path: ./wheelhouse/*.whl
88+
- name: Upload wheels to pypi
89+
uses: pypa/gh-action-pypi-publish@release/v1
90+
with:
91+
user: __token__
92+
password: ${{ secrets.PYPI_API_TOKEN }}
93+
skip_existing: true
94+
packages-dir: ./wheelhouse/
95+
96+
build_windows_wheels:
97+
name: Build Windows wheels
98+
runs-on: windows-2019
99+
steps:
100+
- uses: actions/checkout@v4
101+
- name: Build wheels
102+
uses: pypa/cibuildwheel@v2.16.2
103+
env:
104+
CIBW_ARCHS_WINDOWS: AMD64
105+
- uses: actions/upload-artifact@v3
106+
with:
107+
path: ./wheelhouse/*.whl
108+
- name: Upload wheels to pypi
109+
uses: pypa/gh-action-pypi-publish@release/v1
110+
with:
111+
user: __token__
112+
password: ${{ secrets.PYPI_API_TOKEN }}
113+
skip_existing: true
114+
packages-dir: ./wheelhouse/
115+
116+
# Don't upload this one to pypi, otherwise it will be preferred over every compiled one
117+
# We can host it here on github though for those that need it (re: jupyter-light).
118+
pure_python:
119+
name: Create pure-python wheel
120+
runs-on: ubuntu-20.04
121+
steps:
122+
- uses: actions/checkout@v4
123+
- name: Set up Python
124+
uses: actions/setup-python@v2
125+
with:
126+
python-version: 3.11
127+
- name: Build pure python wheel and install
128+
run: |
129+
python -m pip install --user --upgrade build
130+
python -m build
131+
find ./dist/*.whl | xargs pip install
132+
python -c "import geoana; geoana.show_config()"
133+
- uses: actions/upload-artifact@v3
134+
with:
135+
path: ./dist/geoana*.whl
136+
137+
distribute:
138+
name: distribute source and documentation
139+
runs-on: ubuntu-latest
140+
defaults:
141+
run:
142+
shell: bash -l {0}
143+
steps:
144+
- uses: actions/checkout@v2
145+
- name: Setup environment
146+
uses: mamba-org/setup-micromamba@v1
147+
with:
148+
environment-name: geoana-test
149+
create-args: >-
150+
python=3.11
151+
numpy>=1.20
152+
scipy>=1.8
153+
libdlf
154+
cython
155+
setuptools_scm
156+
meson-python>=0.14.0
157+
meson
158+
ninja
159+
build
160+
discretize
161+
numba
162+
matplotlib
163+
jupyter
164+
utm
165+
pytest
166+
pytest-cov
167+
sphinx
168+
sphinx-gallery>=0.1.13
169+
pydata-sphinx-theme=0.13.3
170+
numpydoc>=1.5
171+
graphviz
172+
pillow
173+
cache-environment: true
174+
- name: Prepare source distribution
175+
run: |
176+
python -m build --no-isolation --skip-dependency-check --sdist .
177+
- name: Publish package
178+
uses: pypa/gh-action-pypi-publish@release/v1
179+
with:
180+
user: __token__
181+
password: ${{ secrets.PYPI_API_TOKEN }}
182+
skip_existing: true
183+
- name: Install Our Package
184+
run: |
185+
pip install --no-build-isolation --editable . --config-settings=setup-args="-Dwith_extensions=true"
186+
- name: Build documentation
187+
run: |
188+
cd docs
189+
make html
190+
cd ..
191+
- name: GitHub Pages
192+
uses: crazy-max/ghaction-github-pages@v2.5.0
193+
with:
194+
build_dir: docs/_build/html
195+
fqdn: geoana.simpeg.xyz
196+
jekyll: false
197+
env:
198+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
199+
200+
201+
release:
202+
name: Create Release
203+
needs: [
204+
build_manylinux_x86_64_wheels,
205+
build_manylinux_aarch64_wheels,
206+
build_musllinux_x86_64_wheels,
207+
build_mac_wheels,
208+
build_windows_wheels,
209+
pure_python
210+
]
211+
runs-on: ubuntu-latest
212+
steps:
213+
- uses: actions/download-artifact@v3
214+
name: Retrieve assets
215+
with:
216+
name: artifact
217+
path: dist
218+
- name: Release to github
219+
uses: softprops/action-gh-release@v1
220+
with:
221+
files: dist/*
222+
generate_release_notes: true
223+
prerelease: false
Lines changed: 1 addition & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
name: TestingWithConda
1+
name: Testing With Conda
22

33
on:
44
push:
55
branches:
66
- '*'
7-
tags:
8-
- 'v*'
97
pull_request:
108
branches:
119
- '*'
@@ -70,91 +68,3 @@ jobs:
7068
with:
7169
token: ${{ secrets.CODECOV_TOKEN }}
7270
fail_ci_if_error: true
73-
distribute:
74-
name: Publish Source to Pypi
75-
needs: build_and_test
76-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
77-
runs-on: ubuntu-latest
78-
defaults:
79-
run:
80-
shell: bash -l {0}
81-
steps:
82-
- uses: actions/checkout@v2
83-
- name: Setup environment
84-
uses: mamba-org/setup-micromamba@v1
85-
with:
86-
environment-name: geoana-test
87-
create-args: >-
88-
python=3.10
89-
numpy>=1.20
90-
scipy>=1.8
91-
libdlf
92-
cython
93-
setuptools_scm
94-
meson-python>=0.14.0
95-
meson
96-
ninja
97-
build
98-
discretize
99-
matplotlib
100-
jupyter
101-
utm
102-
numba
103-
pytest
104-
pytest-cov
105-
sphinx
106-
sphinx-gallery>=0.1.13
107-
pydata-sphinx-theme=0.13.3
108-
numpydoc>=1.5
109-
graphviz
110-
pillow
111-
cache-environment: true
112-
- name: Prepare source distribution
113-
run: |
114-
python -m build --no-isolation --skip-dependency-check --sdist . --config-settings=setup-args="-Dwith_extensions=true"
115-
- name: Publish package
116-
uses: pypa/gh-action-pypi-publish@release/v1
117-
with:
118-
user: __token__
119-
password: ${{ secrets.PYPI_API_TOKEN }}
120-
skip_existing: true
121-
- name: Install package
122-
run: |
123-
pip install --no-build-isolation --editable . --config-settings=setup-args="-Dwith_extensions=true"
124-
- name: Build documentation
125-
run: |
126-
cd docs
127-
make html
128-
cd ..
129-
- name: GitHub Pages
130-
# You may pin to the exact commit or the version.
131-
uses: crazy-max/ghaction-github-pages@v2.5.0
132-
with:
133-
# Git domain (default github.com)
134-
# domain: # optional, default is github.com
135-
# GitHub repository where assets will be deployed (default $GITHUB_REPOSITORY)
136-
# repo: # optional
137-
# Git branch where assets will be deployed
138-
# target_branch: # optional, default is gh-pages
139-
# Create incremental commit instead of doing push force
140-
# keep_history: # optional, default is false
141-
# Allow an empty commit to be created
142-
# allow_empty_commit: # optional, default is true
143-
# Build directory to deploy
144-
build_dir: docs/_build/html
145-
# The committer name and email address
146-
# committer: # optional
147-
# The author name and email address
148-
# author: # optional
149-
# Commit message
150-
# commit_message: # optional
151-
# Write the given domain name to the CNAME file
152-
fqdn: geoana.simpeg.xyz
153-
# Allow Jekyll to build your site
154-
jekyll: false # optional, default is true
155-
# If enabled, nothing will be pushed
156-
# dry_run: true # optional, default is false
157-
# Enable verbose output
158-
# verbose: true # optional, default is false
159-
env:
160-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

geoana/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,18 @@
2121
from datetime import datetime
2222

2323
__version__ = "unknown-" + datetime.today().strftime("%Y%m%d")
24+
25+
26+
try:
27+
import geoana.kernels._extensions.rTE
28+
import geoana.kernels._extensions.potential_field_prism
29+
compiled = True
30+
except ImportError:
31+
compiled = False
32+
def show_config():
33+
info_dict = {
34+
'version': __version__,
35+
'compiled': compiled,
36+
}
37+
print(info_dict)
38+
return info_dict

geoana/kernels/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ py.install_sources(
1010
subdir: 'geoana/kernels'
1111
)
1212

13-
with_extensions = get_option('with_extensions')
13+
1414
if with_extensions
1515
subdir('_extensions')
1616
endif

0 commit comments

Comments
 (0)