Skip to content

Commit

Permalink
ci: various ci including new python-package.yml supporting coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
timcera committed Jul 19, 2022
1 parent d231b80 commit 197dfc3
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 30 deletions.
62 changes: 39 additions & 23 deletions .github/workflows/python-package.yml
Expand Up @@ -7,9 +7,9 @@ name: Python package

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]
workflow_dispatch:


Expand All @@ -20,32 +20,48 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ '3.7', '3.8', '3.9' ]
python-version: [ '3.7', '3.8', '3.9', '3.10' ]

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest pytest-cov
python -m pip install coverage[toml]
python -m pip install coveralls
python -m pip install -e .
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install gdal-bin libgdal-dev libgdal-doc proj-bin
python -m pip install --upgrade pip
python -m pip install flake8 pytest pytest-cov pytest-mpl
python -m pip install coverage[toml]
python -m pip install coveralls
python -m pip install -e .
- name: Test with pytest
run: |
python -m pytest --cov
- name: Test with pytest
run: |
python -m pytest --cov --mpl
- name: Coveralls
env:
- name: Upload coverage data to coveralls.io
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.test-name }}
COVERALLS_PARALLEL: true

coveralls:
name: Indicate completion to coveralls.io
needs: test
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
coveralls --service=github
pip3 install --upgrade coveralls
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Expand Up @@ -22,7 +22,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: 22.3.0 # Replace by any tag/version: https://github.com/psf/black/tags
rev: 22.6.0 # Replace by any tag/version: https://github.com/psf/black/tags
hooks:
- id: black
language_version: python # Should be a command that runs python3.6+
Expand Down Expand Up @@ -53,12 +53,12 @@ repos:
- id: blacken-docs

- repo: https://github.com/asottile/pyupgrade
rev: v2.34.0
rev: v2.35.0
hooks:
- id: pyupgrade

- repo: https://github.com/commitizen-tools/commitizen
rev: v2.27.1
rev: v2.28.0
hooks:
- id: commitizen
stages: [commit-msg]
14 changes: 10 additions & 4 deletions setup.py
@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
#
import os
import shlex
import subprocess
import sys

import setuptools
Expand All @@ -16,10 +18,14 @@
version = open("VERSION").readline().strip()

if sys.argv[-1] == "publish":
os.system("cleanpy .")
os.system("python setup.py sdist")
os.system(f"twine upload dist/{pkg_name}-{version}.tar.gz")
os.system(f"twine upload dist/{pkg_name}-{version}*.whl")
subprocess.run(shlex.split("cleanpy ."), check=True)
subprocess.run(shlex.split("python setup.py sdist"), check=True)
subprocess.run(
shlex.split(f"twine upload dist/{pkg_name}-{version}.tar.gz"), check=True
)
subprocess.run(
shlex.split(f"twine upload dist/{pkg_name}-{version}*.whl"), check=True
)
sys.exit()

README = open("README.rst").read()
Expand Down

0 comments on commit 197dfc3

Please sign in to comment.