Skip to content

Commit

Permalink
ci: buildup ci/cd (#85)
Browse files Browse the repository at this point in the history
* ci: adding black
* ci: adding wheel builder
  • Loading branch information
miili authored Jul 4, 2022
1 parent a0aee67 commit 6111599
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 9 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/black.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Lint

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: psf/black@stable
61 changes: 61 additions & 0 deletions .github/workflows/build-wheels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build

on: [push, pull_request]

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macOS-10.15]
# Exclude windows-2019

steps:
- uses: actions/checkout@v3


- name: Build wheels
uses: pypa/[email protected]
# to supply options, put them in 'env', like:
env:
CIBW_ARCHS_MACOS: x86_64 universal2
CIBW_SKIP: pp*

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz

upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
# if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist

- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
# To test: repository_url: https://test.pypi.org/legacy/
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# Kite
![Python3](https://img.shields.io/badge/Python-3.x-brightgreen.svg)

[![Docs](https://img.shields.io/badge/kite-Documentation-blue.svg)](https://pyrocko.org/kite/docs/current/)
[![Build](https://github.com/pyrocko/kite/actions/workflows/build-wheels.yaml/badge.svg)](https://github.com/pyrocko/kite/actions/workflows/build-wheels.yaml)
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
![Python3](https://img.shields.io/badge/Python-3.7-brightgreen.svg)

_Preparation of InSAR surface displacement maps for geophysical modelling_

## Installation

Install from pip:

```sh
pip install kite
```
## Introduction
This framework is streamlining InSAR displacement processing routines for earthquake inversion through [Pyrocko](https://www.pyrocko.org) and Grond.

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[build-system]
requires = ["setuptools ~= 61.0.0"]
requires = ["setuptools >= 61.0.0", "oldest-supported-numpy"]
build-backend = "setuptools.build_meta"

[project]
name = "kite"
version = "1.5.0"
requires-python = ">=3.6"
requires-python = ">=3.7"
license = {text = "GPLv3"}
description = "InSAR unwrapped surface displacement processing for earthquake modelling."
readme = "README.md"
Expand Down
14 changes: 8 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import platform
import tempfile

from distutils.sysconfig import get_python_inc

from setuptools import setup, Extension
from os.path import join as pjoin

Expand Down Expand Up @@ -122,17 +124,17 @@ def _have_openmp():
Extension(
"kite.covariance_ext",
sources=[pjoin("kite/ext", "covariance.c")],
include_dirs=[numpy.get_include()],
extra_compile_args=[] + omp_arg,
extra_link_args=[] + omp_lib,
include_dirs=[numpy.get_include(), get_python_inc()],
extra_compile_args=omp_arg,
extra_link_args=omp_lib,
language="c",
),
Extension(
"kite.sources.disloc_ext",
sources=[pjoin("kite/sources/ext", "disloc.c")],
include_dirs=[numpy.get_include()],
extra_compile_args=[] + omp_arg,
extra_link_args=[] + omp_lib,
include_dirs=[numpy.get_include(), get_python_inc()],
extra_compile_args=omp_arg,
extra_link_args=omp_lib,
language="c",
),
]
Expand Down

0 comments on commit 6111599

Please sign in to comment.