Skip to content

Commit 6111599

Browse files
authored
ci: buildup ci/cd (#85)
* ci: adding black * ci: adding wheel builder
1 parent a0aee67 commit 6111599

File tree

5 files changed

+92
-9
lines changed

5 files changed

+92
-9
lines changed

.github/workflows/black.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Lint
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: psf/black@stable
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build_wheels:
7+
name: Build wheels on ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os: [ubuntu-20.04, macOS-10.15]
12+
# Exclude windows-2019
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
18+
- name: Build wheels
19+
uses: pypa/cibuildwheel@v2.7.0
20+
# to supply options, put them in 'env', like:
21+
env:
22+
CIBW_ARCHS_MACOS: x86_64 universal2
23+
CIBW_SKIP: pp*
24+
25+
- uses: actions/upload-artifact@v3
26+
with:
27+
path: ./wheelhouse/*.whl
28+
29+
build_sdist:
30+
name: Build source distribution
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v3
34+
35+
- name: Build sdist
36+
run: pipx run build --sdist
37+
38+
- uses: actions/upload-artifact@v3
39+
with:
40+
path: dist/*.tar.gz
41+
42+
upload_pypi:
43+
needs: [build_wheels, build_sdist]
44+
runs-on: ubuntu-latest
45+
# upload to PyPI on every tag starting with 'v'
46+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
47+
# alternatively, to publish when a GitHub Release is created, use the following rule:
48+
# if: github.event_name == 'release' && github.event.action == 'published'
49+
steps:
50+
- uses: actions/download-artifact@v3
51+
with:
52+
# unpacks default artifact into dist/
53+
# if `name: artifact` is omitted, the action will create extra parent dir
54+
name: artifact
55+
path: dist
56+
57+
- uses: pypa/gh-action-pypi-publish@v1.5.0
58+
with:
59+
user: __token__
60+
password: ${{ secrets.PYPI_API_TOKEN }}
61+
# To test: repository_url: https://test.pypi.org/legacy/

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
# Kite
2-
![Python3](https://img.shields.io/badge/Python-3.x-brightgreen.svg)
2+
33
[![Docs](https://img.shields.io/badge/kite-Documentation-blue.svg)](https://pyrocko.org/kite/docs/current/)
4+
[![Build](https://github.com/pyrocko/kite/actions/workflows/build-wheels.yaml/badge.svg)](https://github.com/pyrocko/kite/actions/workflows/build-wheels.yaml)
5+
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
6+
![Python3](https://img.shields.io/badge/Python-3.7-brightgreen.svg)
47

58
_Preparation of InSAR surface displacement maps for geophysical modelling_
69

10+
## Installation
11+
12+
Install from pip:
13+
14+
```sh
15+
pip install kite
16+
```
717
## Introduction
818
This framework is streamlining InSAR displacement processing routines for earthquake inversion through [Pyrocko](https://www.pyrocko.org) and Grond.
919

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[build-system]
2-
requires = ["setuptools ~= 61.0.0"]
2+
requires = ["setuptools >= 61.0.0", "oldest-supported-numpy"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "kite"
77
version = "1.5.0"
8-
requires-python = ">=3.6"
8+
requires-python = ">=3.7"
99
license = {text = "GPLv3"}
1010
description = "InSAR unwrapped surface displacement processing for earthquake modelling."
1111
readme = "README.md"

setup.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import platform
44
import tempfile
55

6+
from distutils.sysconfig import get_python_inc
7+
68
from setuptools import setup, Extension
79
from os.path import join as pjoin
810

@@ -122,17 +124,17 @@ def _have_openmp():
122124
Extension(
123125
"kite.covariance_ext",
124126
sources=[pjoin("kite/ext", "covariance.c")],
125-
include_dirs=[numpy.get_include()],
126-
extra_compile_args=[] + omp_arg,
127-
extra_link_args=[] + omp_lib,
127+
include_dirs=[numpy.get_include(), get_python_inc()],
128+
extra_compile_args=omp_arg,
129+
extra_link_args=omp_lib,
128130
language="c",
129131
),
130132
Extension(
131133
"kite.sources.disloc_ext",
132134
sources=[pjoin("kite/sources/ext", "disloc.c")],
133-
include_dirs=[numpy.get_include()],
134-
extra_compile_args=[] + omp_arg,
135-
extra_link_args=[] + omp_lib,
135+
include_dirs=[numpy.get_include(), get_python_inc()],
136+
extra_compile_args=omp_arg,
137+
extra_link_args=omp_lib,
136138
language="c",
137139
),
138140
]

0 commit comments

Comments
 (0)