Skip to content

Commit

Permalink
Merge f4cea11 into 77a289c
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeitsperre committed Nov 20, 2023
2 parents 77a289c + f4cea11 commit 7df78b1
Show file tree
Hide file tree
Showing 25 changed files with 515 additions and 287 deletions.
3 changes: 2 additions & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/Ouranosinc/cookiecutter-pypackage",
"commit": "240a2c784f89cb1e2c5952869413c5582e590345",
"commit": "04e4e20634c3a90cd796b4e7acfe92ae817a2b75",
"checkout": null,
"context": {
"cookiecutter": {
Expand All @@ -14,6 +14,7 @@
"version": "0.2.0",
"use_pytest": "y",
"use_black": "y",
"use_conda": "y",
"add_pyup_badge": "n",
"make_docs": "y",
"command_line_interface": "Click",
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/actions-versions-updater.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: GitHub Actions Version Updater

on:
schedule:
# 12:00 AM on the first of every month
- cron: '0 0 1 * *'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
with:
# This requires a personal access token with the privileges to push directly to `main`
token: ${{ secrets.WORKFLOW_TOKEN }}
persist-credentials: true
- name: Run GitHub Actions Version Updater
uses: saadmk11/github-actions-version-updater@v0.8.1
with:
token: ${{ secrets.WORKFLOW_TOKEN }}
committer_email: 'bumpversion[bot]@ouranos.ca'
committer_username: 'update-github-actions[bot]'
pull_request_title: '[bot] Update GitHub Action Versions'
58 changes: 58 additions & 0 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "Bump Patch Version"

on:
push:
branches:
- main
paths-ignore:
- .cruft.json
- .editorconfig
- .github/**.yml
- .gitignore
- .pre-commit-config.yaml
- .yamllint.yaml
- .zenodo.json
- AUTHORS.rst
- CONTRIBUTING.rst
- CHANGES.rst
- Makefile
- .readthedocs.yml
- docs/*.py
- docs/*.rst
- environment-docs.yml
- environment-dev.yml
- setup.cfg
- pyproject.toml
- tests/**.py
- tox.ini
- figanos/__init__.py
workflow_dispatch:

jobs:
bump_patch_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Config Commit Bot
run: |
git config --local user.email "bumpversion[bot]@ouranos.ca"
git config --local user.name "bumpversion[bot]"
- name: Current Version
run: echo "current_version=$(grep -E '__version__' figanos/__init__.py | cut -d ' ' -f3)"
- name: Bump Patch Version
run: |
pip install bump2version
echo "Bumping version"
bump2version patch
echo "new_version=$(grep -E '__version__' figanos/__init__.py | cut -d ' ' -f3)"
- name: Push Changes
uses: ad-m/github-push-action@master
with:
force: false
github_token: ${{ secrets.WORKFLOW_TOKEN }}
branch: ${{ github.ref }}
122 changes: 82 additions & 40 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,41 @@ on:
branches:
- main
paths-ignore:
- HISTORY.rst
- MANIFEST.in
- CHANGES.rst
- README.rst
- setup.py
- pyproject.toml
- setup.cfg
- figanos/__init__.py
pull_request:

jobs:
black:
name: Black (Python${{ matrix.python-version }})
lint:
name: Lint (Python${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.8"
- "3.x"
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
run: pip install tox
run: |
python -m pip install tox
- name: Run linting suite
run: tox -e black
run: |
python -m tox -e lint
test:
name: test-${{ matrix.tox-env }} (Python${{ matrix.python-version }})
needs: black
test-pypi:
name: Test with Python${{ matrix.python-version }} (Python${{ matrix.python-version }} + tox)
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -52,38 +53,79 @@ jobs:
- tox-env: "py311"
python-version: "3.11"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# - name: Install tox
# run: pip install tox
# - name: Test with tox
# run: tox -e ${{ matrix.tox-env }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# COVERALLS_FLAG_NAME: run-${{ matrix.tox-env }}
# COVERALLS_PARALLEL: true
# COVERALLS_SERVICE_NAME: github
- name: Install figanos (no dependencies)
- name: Install GDAL
run: |
sudo apt-get update
sudo apt-get install -y libgdal-dev
- name: Install tox
run: pip install tox
- name: Test with tox
run: tox -e ${{ matrix.tox-env }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: run-${{ matrix.tox-env }}
COVERALLS_PARALLEL: true
COVERALLS_SERVICE_NAME: github

test-conda:
name: Test with Python${{ matrix.python-version }} (Anaconda)
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Setup Conda (Micromamba) with Python${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
with:
cache-downloads: true
environment-file: environment-dev.yml
create-args: >-
mamba
python=${{ matrix.python-version }}
- name: Conda and Mamba versions
run: |
mamba --version
echo "micromamba $(micromamba --version)"
- name: Compile catalogs and install xscen
run: |
python -m pip install --no-deps .
- name: Check versions
run: |
conda list
python -m pip check || true
- name: Test with pytest
run: |
python -m pip install -e . --no-dependencies
- name: Smoke tests
python -m pytest tests
- name: Report coverage
run: |
python -m pip install pytest
pytest
python -m coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: run-Python${{ matrix.python-version }}-conda
COVERALLS_PARALLEL: true
COVERALLS_SERVICE_NAME: github

# finish:
# needs:
# - test
# runs-on: ubuntu-latest
# container: python:3-slim
# steps:
# - name: Coveralls Finished
# run: |
# pip install --upgrade coveralls
# coveralls --finish
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# COVERALLS_SERVICE_NAME: github
finish:
needs:
- test-pypi
- test-conda
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Coveralls Finished
run: |
python -m pip install --upgrade coveralls
python -m coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
8 changes: 4 additions & 4 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ on:
jobs:
build-n-publish-pypi:
name: Build and publish Python 🐍 distributions 📦 to PyPI
environment: production
runs-on: ubuntu-latest
environment: production
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python3
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install packaging libraries
run: |
pip install setuptools wheel
python -m pip install flit
- name: Build a binary wheel and a source tarball
run: |
python setup.py sdist bdist_wheel
python -m flit build
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
30 changes: 24 additions & 6 deletions .github/workflows/tag-testpypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,46 @@ name: Publish Python 🐍 distributions 📦 to TestPyPI
on:
push:
tags:
- '*'
- 'v*.*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
build-n-publish-testpypi:

release:
name: Create Release from tag
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Release
uses: softprops/action-gh-release@v1
env:
# This token is provided by Actions, you do not need to create your own token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
name: Release ${{ github.ref }}
draft: true
prerelease: false

deploy-testpypi:
name: Build and publish Python 🐍 distributions 📦 to TestPyPI
environment: staging
runs-on: ubuntu-latest
environment: staging
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python3
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install packaging libraries
run: |
pip install setuptools wheel
python -m pip install flit
- name: Build a binary wheel and a source tarball
run: |
python setup.py sdist bdist_wheel
python -m flit build
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
26 changes: 15 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ repos:
- id: pretty-format-json
args: [ '--autofix', '--no-ensure-ascii', '--no-sort-keys' ]
exclude: .ipynb
- id: check-toml
- id: check-yaml
args: [ '--allow-multiple-documents' ]
- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1
hooks:
- id: toml-sort-fix
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
Expand All @@ -29,11 +34,15 @@ repos:
hooks:
- id: black
exclude: ^docs/
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.4
hooks:
- id: ruff
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies: [ 'flake8-rst-docstrings' ]
additional_dependencies: [ 'flake8-alphabetize', 'flake8-rst-docstrings' ]
args: ['--config=setup.cfg']
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
Expand All @@ -57,21 +66,16 @@ repos:
- id: nbstripout
files: '.ipynb'
args: [ '--extra-keys=metadata.kernelspec' ]
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
args: [ '--config=setup.cfg' ]
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.33.0
hooks:
- id: yamllint
args: [ '--config-file=.yamllint.yaml' ]
# Git version too old on server
# - repo: https://github.com/mgedmin/check-manifest
# rev: "0.49"
# hooks:
# - id: check-manifest
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.1
hooks:
- id: check-github-workflows
- id: check-readthedocs
- repo: meta
hooks:
- id: check-hooks-apply
Expand Down
Loading

0 comments on commit 7df78b1

Please sign in to comment.