Skip to content

Commit

Permalink
Merge branch 'master' into use-esmf-install-action
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/bump-version.yml
#	.github/workflows/gh-pages.yml
#	.github/workflows/main.yml
#	.github/workflows/publish-pypi.yml
#	.github/workflows/tag-testpypi.yml
#	setup.py
#	tox.ini
  • Loading branch information
Zeitsperre committed Dec 1, 2023
2 parents a02947b + f54ed0f commit 7d0c925
Show file tree
Hide file tree
Showing 40 changed files with 720 additions and 482 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": "64eceda7d95aeb8937fa9961989d3d617a525c04",
"checkout": null,
"context": {
"cookiecutter": {
Expand All @@ -14,6 +14,7 @@
"version": "0.3.0",
"use_pytest": "y",
"use_black": "y",
"use_conda": "y",
"add_pyup_badge": "n",
"make_docs": "y",
"command_line_interface": "No command-line interface",
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
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- This PR fixes #xyz
- [ ] (If applicable) Documentation has been added / updated (for bug fixes / features).
- [ ] (If applicable) Tests have been added.
- [ ] HISTORY.rst has been updated (with summary of main changes).
- [ ] CHANGES.rst has been updated (with summary of main changes).
- [ ] Link to issue (:issue:`number`) and pull request (:pull:`number`) has been added.

### What kind of change does this PR introduce?
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/[email protected]
with:
# This requires a personal access token with the privileges to push directly to `main`
token: ${{ secrets.BUMPVERSION_TOKEN }}
persist-credentials: true
- name: Run GitHub Actions Version Updater
uses: saadmk11/[email protected]
with:
token: ${{ secrets.BUMPVERSION_TOKEN }}
committer_email: 'bumpversion[bot]@ouranos.ca'
committer_username: 'update-github-actions[bot]'
pull_request_title: '[bot] Update GitHub Action Versions'
13 changes: 7 additions & 6 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ on:
- HISTORY.rst
- Makefile
- MANIFEST.in
- pyproject.toml
- requirements_upstream.txt
- setup.cfg
- setup.py
Expand All @@ -34,10 +35,10 @@ jobs:
bump_patch_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4.1.1
with:
persist-credentials: false
- uses: actions/setup-python@v4
- uses: actions/setup-python@v4.7.1
with:
python-version: "3.x"
- name: Config Commit Bot
Expand All @@ -48,13 +49,13 @@ jobs:
run: echo "current_version=$(grep -E '__version__' xdatasets/__init__.py | cut -d ' ' -f3)"
- name: Bump Patch Version
run: |
pip install bump2version
pip install bump-my-version
echo "Bumping version"
bump2version patch
bump-my-version bump --tag patch
echo "new_version=$(grep -E '__version__' xdatasets/__init__.py | cut -d ' ' -f3)"
- name: Push Changes
uses: ad-m/github-push-action@master
uses: ad-m/github-push-action@v0.8.0
with:
force: false
github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.BUMPVERSION_TOKEN }}
branch: ${{ github.ref }}
2 changes: 1 addition & 1 deletion .github/workflows/first_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
name: Welcome
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
- uses: actions/github-script@v7.0.1
with:
script: |
// Get a list of all issues created by the PR opener
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,27 @@ jobs:
shell: bash -l {0}
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
uses: actions/checkout@v4.1.1
with:
persist-credentials: false
- name: Setup Conda (Micromamba)
uses: mamba-org/setup-micromamba@v1
uses: mamba-org/setup-micromamba@v1.6.0
with:
cache-downloads: true
environment-file: environment_docs.yml
environment-file: environment-docs.yml
- name: Install xdatasets (docs)
run: |
python -m ipykernel install --user --name=xdatasets
pip install --editable ".[docs]"
- name: Check versions
run: |
pip check
pip check || true
- name: Build docs
shell: bash -l {0}
run: |
make docs
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.2.2
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs/_build/html # The folder the action should deploy.
108 changes: 77 additions & 31 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ on:
branches:
- main
paths-ignore:
- HISTORY.rst
- MANIFEST.in
- CHANGES.rst
- README.rst
- setup.py
- pyproject.toml
- setup.cfg
- xdatasets/__init__.py
pull_request:
Expand All @@ -18,32 +17,33 @@ concurrency:
cancel-in-progress: true

jobs:
# Temporarily bypass checks until code passes linting
# black:
# name: Black (Python${{ matrix.python-version }})
# runs-on: ubuntu-latest
# strategy:
# matrix:
# python-version:
# - "3.8"
# steps:
# - name: Cancel previous runs
# uses: styfle/[email protected]
# with:
# access_token: ${{ secrets.GITHUB_TOKEN }}
# - uses: actions/checkout@v3
# - 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: Run linting suite
# run: tox -e black
lint:
name: Lint (Python${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.x"
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/[email protected]
- name: Set up Python${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
run: |
python -m pip install tox
- name: Run linting suite
run: |
python -m tox -e lint
test:
name: test-${{ matrix.tox-env }} (Python${{ matrix.python-version }})
# needs: black
needs: lint
runs-on: ubuntu-latest
env:
ESMF_VERSION: "v8.5.0"
Expand All @@ -59,7 +59,7 @@ jobs:
- tox-env: "py311"
python-version: "3.11"
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4.1.1
- name: Install NetCDF
run: |
sudo apt-get -y update
Expand All @@ -72,23 +72,69 @@ jobs:
cache: true
version: ${{ env.ESMF_VERSION }}
- name: Set up Python${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v4.7.1
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
run: pip install tox
run: |
pip install tox
- name: Test with tox
run: tox -e ${{ matrix.tox-env }}
run: |
tox -e ${{ matrix.tox-env }}
env:
ESMF_VERSION: ${{ env.ESMF_VERSION }}
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.9", "3.10", "3.11"]
# defaults:
# run:
# shell: bash -l {0}
# steps:
# - uses: actions/[email protected]
# - 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: Install xdatasets
# 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 pytest --cov xdatasets
# - name: Report coverage
# run: |
# 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
# - test-pypi
# - test-conda
# runs-on: ubuntu-latest
# container: python:3-slim
# steps:
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,21 @@ jobs:
build-n-publish-pypi:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
environment: production
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4.1.1
- name: Set up Python3
uses: actions/setup-python@v4
uses: actions/setup-python@v4.7.1
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
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
uses: pypa/[email protected]
Loading

0 comments on commit 7d0c925

Please sign in to comment.