Skip to content

Commit

Permalink
change ci
Browse files Browse the repository at this point in the history
  • Loading branch information
tammoippen committed Nov 7, 2024
1 parent e854aad commit af13a56
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 38 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: CI

on:
push:
branches:
- "master"
pull_request:
branches:
- "master"

jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['pypy-3.9', 3.9, '3.10', 'pypy-3.10', '3.11', '3.12', '3.13']
cython: ['yes', 'no']
include:
- os: ubuntu-latest
path: ~/.cache/pip
- os: macos-latest
path: ~/Library/Caches/pip
- os: windows-latest
path: ~\AppData\Local\pip\Cache
exclude:
- os: macos-latest
python-version: 'pypy-3.9'
- os: macos-latest
python-version: 'pypy-3.10'
- os: windows-latest
python-version: 'pypy-3.9'
- os: windows-latest
python-version: 'pypy-3.10'
defaults:
run:
shell: bash

runs-on: ${{ matrix.os }}
env:
PYTHONIOENCODING: UTF-8
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Cache Install
id: restore-cache
uses: actions/cache@v4
with:
path: |
${{ matrix.path }}
poetry.lock
key: ${{ matrix.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('tests/requirements.txt') }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: '1.8.3' # ${{ startsWith(matrix.python-version, 'pypy') && '1.2.2' || '1.8.3' }}
virtualenvs-create: false

- name: Install
run: poetry install

- name: Build Cython file
run: |
poetry run pip install cython
poetry run cythonize -i geohash_hilbert/*.pyx
poetry show
python -c 'import geohash_hilbert as ghh; print(ghh._hilbert.CYTHON_AVAILABLE)'
- name: Style
if: ${{ ! startsWith(matrix.python-version, 'pypy-') && startsWith(matrix.os, 'ubuntu') }}
run: make check

- name: Tests
run: make test

- uses: codecov/codecov-action@v4
with:
file: coverage.xml
name: coverage-${{ matrix.os }}-${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
37 changes: 37 additions & 0 deletions .github/workflows/Publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish

on:
push:
tags:
- v*
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
environment: pypi

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set Up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.3

- name: Build
run: poetry build -vvv -f sdist

- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
path: dist/*.tar.gz

- name: Publish
run: poetry publish -vvv -n -u __token__ -p ${{ secrets.PYPI_PASS }}
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.PHONY: fmt check test

fmt:
poetry run ruff format .
poetry run ruff check --fix .

check:
poetry run ruff format --check .
poetry run ruff check .
# poetry run mypy geohash_hilbert

test:
PYTHONDEVMODE=1 poetry run pytest -vvv -s
46 changes: 19 additions & 27 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]

name = "geohash-hilbert"
version = "1.4.0"
version = "2.0.0"
description = "Geohash a lng/lat coordinate using the hilbert curve."
authors = ["Tammo Ippen <[email protected]>"]
license = "MIT"
Expand All @@ -22,38 +22,30 @@ classifiers = [
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy'
]

[tool.poetry.dependencies]

python = "~2.7 || ^3.5"

[tool.poetry.dev-dependencies]

coveralls = "^1.5.1"
flake8 = "^3.5.0"
flake8-bugbear = { version = "^18.8.0", python = "^3.5" }
flake8-commas = "^2.0.0"
flake8-comprehensions = "^1.4.1"
flake8-import-order = "^0.18"
flake8-pep3101 = "^1.2.1"
flake8-polyfill = "^1.0.2"
flake8-quotes = "^1.0.0"
pep8-naming = "^0.7"
pytest = "^3.7.3"
pytest-benchmark = "^3.1.1"
pytest-cov = "^2.5.1"
pytest-flake8 = "^1.0.2"
pytest-mccabe = "^0.1"
pytest-pythonpath = "^0.7.3"
six = "^1.11.0"
python = "^3.9"

[tool.poetry.group.dev.dependencies]

ruff = "*"
coveralls = "*"
pytest = "*"
pytest-benchmark = "*"
pytest-cov = "*"
cython = { version = "*", optional = true }

[tool.poetry.extras]
cython = ["cython"]

[build-system]
requires = ["poetry>=0.12"]
Expand Down
12 changes: 1 addition & 11 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
[flake8]
application_import_names = geohash_hilbert
max-line-length = 159
max-complexity = 10
import-order-style = google
exclude =
.venv/
venv/

[tool:pytest]
python_paths = .
addopts = --cov=geohash_hilbert --cov-report term-missing --cov-report html:cov_html --mccabe -v
addopts = --cov=geohash_hilbert --cov-branch --cov-report term-missing --cov-report html:cov_html --cov-report=xml:coverage.xml

[bdist_wheel]
universal = 0
Expand Down

0 comments on commit af13a56

Please sign in to comment.