Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: General repo update, move to pyproject.toml #58

Merged
merged 4 commits into from
Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"template": "https://github.com/tlambert03/pyrepo-cookiecutter",
"commit": "a9545077bbb7a5c6d62addbe8a3484f844e7d5b2",
"context": {
"cookiecutter": {
"full_name": "Talley Lambert",
"email": "talley.lambert@gmail.com",
"github_username": "tlambert03",
"project_name": "nd2",
"project_slug": "nd2",
"project_short_description": "Yet another nd2 (Nikon NIS Elements) file reader",
"pypi_username": "talley",
"version_control": "setuptools-scm",
"_copy_without_render": [
".github/workflows/*"
],
"_template": "https://github.com/tlambert03/pyrepo-cookiecutter"
}
},
"directory": null
}
7 changes: 7 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
profile = black
exclude = docs,.eggs,examples
max-line-length = 88
docstring-convention = numpy
docstring_style = numpy
ignore = D100, D213, D401, D413, D107, W503
12 changes: 12 additions & 0 deletions .github/TEST_FAIL_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: "{{ env.TITLE }}"
labels: [bug]
---
The {{ workflow }} workflow failed on {{ date | date("YYYY-MM-DD HH:mm") }} UTC

The most recent failing test was on {{ env.PLATFORM }} py{{ env.PYTHON }}
with commit: {{ sha }}

Full run: https://github.com/{{ payload.repository.full_name }}/actions/runs/{{ env.RUN_ID }}

(This post will be updated if another test fails, as long as this issue remains open.)
18 changes: 13 additions & 5 deletions .github/workflows/test.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: CI

on:
push:
Expand All @@ -12,6 +12,14 @@ on:
workflow_dispatch:

jobs:
check-manifest:
name: Check Manifest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- run: pip install check-manifest && check-manifest

test:
name: ${{ matrix.platform }} (${{ matrix.python-version }})
runs-on: ${{ matrix.platform }}
Expand All @@ -22,14 +30,14 @@ jobs:
platform: [macos-latest, windows-latest, "ubuntu-latest"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

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

- uses: actions/cache@v2
- uses: actions/cache@v3
id: cache
with:
path: tests/data
Expand All @@ -43,7 +51,7 @@ jobs:

- name: Build
# -e seems necessary for coverage to work
run: pip install -e .[testing]
run: pip install -e .[test]
env:
CYTHON_TRACE: "1"

Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: --pre Test
# An "early warning" cron job that will install dependencies
# with `pip install --pre` periodically to test for breakage
# (and open an issue if a test fails)

on:
schedule:
- cron: '0 */12 * * *' # every 12 hours
workflow_dispatch:

jobs:

test:
name: ${{ matrix.platform }} (${{ matrix.python-version }})
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10']
platform: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v3

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

- uses: actions/cache@v3
id: cache
with:
path: tests/data
key: ${{ hashFiles('scripts/download_samples.py') }}

- name: Download Samples
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install requests
python scripts/download_samples.py

- name: Build
run: pip install --pre -e .[test]
env:
CYTHON_TRACE: "1"

- name: Test
run: pytest -v --cov=nd2 --cov-report=xml --cov-report=term

# If something goes wrong, we can open an issue in the repo
- name: Report Failures
if: ${{ failure() }}
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLATFORM: ${{ matrix.platform }}
PYTHON: ${{ matrix.python }}
RUN_ID: ${{ github.run_id }}
TITLE: '[test-bot] pip install --pre is failing'
with:
filename: .github/TEST_FAIL_TEMPLATE.md
update_existing: true
16 changes: 8 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
os: [ubuntu-20.04, windows-2019, macos-10.15]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/setup-python@v2
- uses: actions/setup-python@v3
name: Install Python
with:
python-version: "3.9"
Expand All @@ -30,7 +30,7 @@ jobs:
python -m pip install --upgrade pip
pip install build

- uses: actions/cache@v2
- uses: actions/cache@v3
id: cache
with:
path: tests/data
Expand All @@ -43,9 +43,9 @@ jobs:
python scripts/download_samples.py

- name: Build wheels
uses: pypa/cibuildwheel@v2.2.0a1
uses: pypa/cibuildwheel@2.6.0

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

Expand All @@ -56,7 +56,7 @@ jobs:
check-manifest
python -m build --sdist

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-20.04'
with:
path: dist/*.tar.gz
Expand All @@ -66,12 +66,12 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@v1.4.2
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TWINE_API_KEY }}
Expand Down
5 changes: 5 additions & 0 deletions .github_changelog_generator
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
user=tlambert03
project=nd2
issues=false
exclude-labels=duplicate,question,invalid,wontfix,hide
add-sections={"tests":{"prefix":"**Tests & CI:**","labels":["tests"]}}
51 changes: 36 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,41 +1,62 @@
ci:
autoupdate_schedule: monthly
autofix_commit_msg: "style: [pre-commit.ci] auto fixes [...]"
autoupdate_commit_msg: "ci: [pre-commit.ci] autoupdate"

default_install_hook_types: [pre-commit, commit-msg]

exclude: src/sdk

repos:

- repo: https://github.com/compilerla/conventional-pre-commit
rev: v1.3.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: check-docstring-first
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.20.1
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
additional_dependencies: [flake8-typing-imports==1.7.0]

- repo: https://github.com/myint/autoflake
rev: v1.4
hooks:
- id: autoflake
args: ["--in-place", "--remove-all-unused-imports"]

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black

- repo: https://github.com/asottile/pyupgrade
rev: v2.32.1
hooks:
- id: pyupgrade
args: [--py37-plus, --keep-runtime-typing]

- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black

- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
args: [--min-python-version=3.7.0]
additional_dependencies:
- flake8-typing-imports
- flake8-bugbear

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.950
rev: v0.960
hooks:
- id: mypy
additional_dependencies: [numpy]
files: "^src/"
exclude: scripts
additional_dependencies: [numpy]
Loading