Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ci mainenance #74

Merged
merged 12 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/environment_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: geoana-test
channels:
- conda-forge
dependencies:
- numpy>=1.22.4
- scipy>=1.8
- libdlf

# optionals
- matplotlib
- utm

# documentation
- sphinx
- pydata-sphinx-theme==0.15.4
- sphinx-gallery>=0.1.13
- numpydoc>=1.5
- discretize
- jupyter
- graphviz
- pillow

# testing
- pytest
- pytest-cov

# Building
- pip
- meson-python>=0.15.0
- meson
- ninja
- cython>=3.0.8
- setuptools_scm
- python-build
123 changes: 25 additions & 98 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,76 +6,25 @@ on:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
build_manylinux_x86_64_wheels:
name: Build manylinux_x86_64
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: "*manylinux_x86_64"
CIBW_ARCHS_LINUX: x86_64
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

build_manylinux_aarch64_wheels:
name: Build manylinux_aarch64
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS_LINUX: aarch64
CIBW_BUILD: "*manylinux_aarch64"
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
os: [ubuntu-latest, windows-latest, macos-13, macos-14]

build_musllinux_x86_64_wheels:
name: Build musllinux_x86_64 wheels
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: "*musllinux_x86_64"
CIBW_ARCHS_LINUX: x86_64
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
fetch-depth: 0

build_mac_wheels:
name: Build macos wheels
runs-on: macos-11
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS_MACOS: x86_64 arm64
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
uses: pypa/[email protected]

build_windows_wheels:
name: Build Windows wheels
runs-on: windows-2019
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS_WINDOWS: AMD64
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

# Don't upload this one to pypi, otherwise it will be preferred over every compiled one
Expand All @@ -85,6 +34,8 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
Expand All @@ -95,7 +46,7 @@ jobs:
python -m build
find ./dist/*.whl | xargs pip install
python -c "import geoana; geoana.show_config()"
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: ./dist/geoana*.whl

Expand All @@ -106,36 +57,16 @@ jobs:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Setup environment
uses: mamba-org/setup-micromamba@v1
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v3
with:
environment-name: geoana-test
create-args: >-
python=3.11
numpy>=1.20
scipy>=1.8
libdlf
cython
setuptools_scm
meson-python>=0.14.0
meson
ninja
build
discretize
numba
matplotlib
jupyter
utm
pytest
pytest-cov
sphinx
sphinx-gallery>=0.1.13
pydata-sphinx-theme=0.13.3
numpydoc>=1.5
graphviz
pillow
cache-environment: true
auto-update-conda: true
environment-file: .github/environment_ci.yml
activate-environment: geoana-test
python-version: "3.11"
- name: Prepare source distribution
run: |
python -m build --no-isolation --skip-dependency-check --sdist .
Expand Down Expand Up @@ -166,19 +97,15 @@ jobs:
release:
name: Create Release
needs: [
build_manylinux_x86_64_wheels,
build_manylinux_aarch64_wheels,
build_musllinux_x86_64_wheels,
build_mac_wheels,
build_windows_wheels,
build_wheels,
pure_python
]
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
name: Retrieve assets
with:
name: artifact
Expand Down
53 changes: 18 additions & 35 deletions .github/workflows/test_with_conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,50 +18,33 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- name: Setup environment
uses: mamba-org/setup-micromamba@v1
- uses: actions/checkout@v4

- name: Setup Conda
uses: conda-incubator/setup-miniconda@v3
with:
environment-name: geoana-test
create-args: >-
python=${{ matrix.python-version }}
numpy>=1.20
scipy>=1.8
libdlf
cython
setuptools_scm
meson-python>=0.14.0
meson
ninja
build
discretize
matplotlib
jupyter
utm
pytest
pytest-cov
sphinx
sphinx-gallery>=0.1.13
pydata-sphinx-theme=0.13.3
numpydoc>=1.5
graphviz
pillow
cache-environment: true
- name: Install numba
if: matrix.python-version != '3.12'
# Numba doesn't work on python 3.12 just yet, so conditionally install it into the environment:
auto-update-conda: true
environment-file: .github/environment_ci.yml
activate-environment: geoana-test
python-version: ${{ matrix.python-version }}

- name: Conda information
run: |
micromamba install numba
conda info
conda list
conda config --show

- name: Install Our Package
run: |
pip install --no-build-isolation --editable . --config-settings=setup-args="-Dwith_extensions=true"
conda list
pip install . --config-settings=setup-args="-Dwith_extensions=true"

- name: Run Tests
run: |
pytest --cov-config=.coveragerc --cov=geoana --cov-report=xml -s -v -W ignore::DeprecationWarning

- name: "Upload coverage to Codecov"
if: matrix.python-version == '3.11'
uses: codecov/codecov-action@v3
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,5 @@ geoana/kernels/_extensions/potential_field_prism_api.h

# setuptools_scm
geoana/version.py

.idea/
40 changes: 3 additions & 37 deletions geoana/kernels/_extensions/meson.build
Original file line number Diff line number Diff line change
@@ -1,38 +1,7 @@

# NumPy include directory
# The try-except is needed because when things are
# split across drives on Windows, there is no relative path and an exception
# gets raised. There may be other such cases, so add a catch-all and switch to
# an absolute path. Relative paths are needed when for example a virtualenv is
# placed inside the source tree; Meson rejects absolute paths to places inside
# the source tree.
# For cross-compilation it is often not possible to run the Python interpreter
# in order to retrieve numpy's include directory. It can be specified in the
# cross file instead:
# [properties]
# numpy-include-dir = /abspath/to/host-pythons/site-packages/numpy/core/include
#
# This uses the path as is, and avoids running the interpreter.
incdir_numpy = meson.get_external_property('numpy-include-dir', 'not-given')
if incdir_numpy == 'not-given'
incdir_numpy = run_command(py,
[
'-c',
'''import os
import numpy as np
try:
incdir = os.path.relpath(np.get_include())
except Exception:
incdir = np.get_include()
print(incdir)
'''
],
check: true
).stdout().strip()
else
_incdir_numpy_abs = incdir_numpy
endif
inc_np = include_directories(incdir_numpy)
np_dep = declare_dependency(include_directories: inc_np)
np_dep = dependency('numpy')
numpy_nodepr_api = ['-DNPY_NO_DEPRECATED_API=NPY_1_9_API_VERSION']

# Deal with M_PI & friends; add `use_math_defines` to c_args or cpp_args
# Cython doesn't always get this right itself (see, e.g., gh-16800), so
Expand All @@ -44,7 +13,6 @@ else
use_math_defines = []
endif

numpy_nodepr_api = '-DNPY_NO_DEPRECATED_API=NPY_1_9_API_VERSION'
c_undefined_ok = ['-Wno-maybe-uninitialized']

cython_c_args = [numpy_nodepr_api, use_math_defines]
Expand All @@ -56,7 +24,6 @@ module_path = 'geoana/kernels/_extensions'
py.extension_module(
'potential_field_prism',
'potential_field_prism.pyx',
include_directories: incdir_numpy,
c_args: cython_c_args,
install: true,
subdir: module_path,
Expand All @@ -66,7 +33,6 @@ py.extension_module(
py.extension_module(
'rTE',
['rTE.pyx', '_rTE.cpp'],
include_directories: incdir_numpy,
cpp_args: cython_cpp_args,
install: true,
subdir: module_path,
Expand Down
Loading
Loading