Skip to content

Commit

Permalink
Merge 64119f1 into 77a289c
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeitsperre committed Nov 23, 2023
2 parents 77a289c + 64119f1 commit 1676d8e
Show file tree
Hide file tree
Showing 29 changed files with 656 additions and 414 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": "de751c55cd9a5df586e3d961535292cfb73e0397",
"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
30 changes: 30 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[flake8]
exclude =
.eggs,
.git,
build,
docs,
tests
ignore =
AZ100,
AZ200,
AZ300,
C,
D,
E,
F,
W503
per-file-ignores =
rst-roles =
doc,
mod,
py:attr,
py:attribute,
py:class,
py:const,
py:data,
py:func,
py:meth,
py:mod,
py:obj,
py:ref
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 bump-my-version
echo "Bumping version"
bump-my-version bump 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 }}
119 changes: 79 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,76 @@ 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
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=3.11
- 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 --cov figanos
- name: Report coverage
run: |
python -m pip install pytest
pytest
python -m coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: run-py311-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
31 changes: 25 additions & 6 deletions .github/workflows/tag-testpypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,47 @@ 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
if: startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '.0')
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
Loading

0 comments on commit 1676d8e

Please sign in to comment.