Skip to content

Commit

Permalink
Merge pull request #85 from kurtmckee/release-0.20
Browse files Browse the repository at this point in the history
Release 0.20
  • Loading branch information
kurtmckee authored Mar 29, 2024
2 parents 1910c45 + 57328b6 commit bb04265
Show file tree
Hide file tree
Showing 86 changed files with 3,348 additions and 1,004 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[{*.yaml,*.yml}]
indent_size = 2
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: "kurtmckee"
ko_fi: "kurtmckee"
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
groups:
github-actions:
patterns:
- "*"
230 changes: 230 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
name: "Test"

on:
pull_request:
push:
branches:
- "main"
- "releases"

jobs:
build:
name: "Build wheel"
runs-on: "ubuntu-latest"
outputs:
wheel-filename: "${{ steps.get-filename.outputs.wheel-filename }}"
steps:
- name: "Checkout branch"
uses: "actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11" # v4.1.1

- name: "Setup Python"
id: "setup-python"
uses: "actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c" # v5.0.0
with:
python-version: "3.12"

- name: "Build the project"
run: "pip wheel ."

- name: "Identify the wheel filename"
id: "get-filename"
run: |
echo "wheel-filename=$(find listparser-*.whl | head -n 1)" >> "$GITHUB_OUTPUT"
- name: "Upload the build artifact"
uses: "actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3" # v4.3.1
with:
name: "listparser-${{ github.sha }}.whl"
path: "${{ steps.get-filename.outputs.wheel-filename }}"
retention-days: 1

test:
name: "Test on ${{ matrix.run.os.name }}"
runs-on: "${{ matrix.run.os.id }}"
needs: "build"

strategy:
matrix:
run:
- os:
id: "ubuntu-latest"
name: "Ubuntu"
pythons: |
pypy3.9
3.8
3.9
3.10
3.11
3.12
tox-environments:
- "py312-http-lxml"
- "py311-http-lxml"
- "py310-http-lxml"
- "py39-http-lxml"
- "py38-http-lxml"
- "pypy39"

# Test lowest and highest versions on Windows.
- os:
id: "windows-latest"
name: "Windows"
pythons: |
3.8
3.11
tox-environments:
- "py38"
- "py311"

# Test lowest and highest versions on Mac.
- os:
name: "MacOS"
id: "macos-latest"
pythons: |
3.8
3.11
tox-environments:
- "py38"
- "py311"

steps:
# The week number is used for cache-busting.
- name: "Identify week number"
shell: "bash"
run: "date +'%V' > week-number.txt"

- name: "Checkout branch"
uses: "actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11" # v4.1.1

- name: "Setup Pythons"
id: "setup-python"
uses: "actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c" # v5.0.0
with:
python-version: "${{ matrix.run.pythons }}"
allow-prereleases: true

- name: "Restore cache"
id: "restore-cache"
uses: "actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319" # v4.0.1
with:
path: |
.tox/
.venv/
key: "test-os=${{ matrix.run.os.id }}-hash=${{ hashFiles('.github/workflows/test.yaml', 'pyproject.toml', 'tox.ini', 'week-number.txt', 'requirements/*/*.txt') }}"

- name: "Identify venv path"
shell: "bash"
run: |
echo 'venv-path=${{ runner.os == 'Windows' && '.venv/Scripts' || '.venv/bin' }}' >> "$GITHUB_ENV"
- name: "Create a virtual environment"
if: "steps.restore-cache.outputs.cache-hit == false"
run: |
python -m venv .venv
${{ env.venv-path }}/python -m pip install --upgrade pip setuptools wheel
${{ env.venv-path }}/pip install tox
- name: "Download the build artifact"
uses: "actions/download-artifact@87c55149d96e628cc2ef7e6fc2aab372015aec85" # v4.1.3
with:
name: "listparser-${{ github.sha }}.whl"

- name: "Test"
run: >
${{ env.venv-path }}/tox run
--installpkg "${{ needs.build.outputs.wheel-filename }}"
-e ${{ join(matrix.run.tox-environments, ',') }}
- name: "Upload coverage data files"
uses: "actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3" # v4.3.1
with:
name: "coverage-data-files-${{ matrix.run.os.id }}"
path: ".coverage.*"
retention-days: 1

coverage:
name: "Calculate code coverage"
needs: "test"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout branch"
uses: "actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11" # v4.1.1

- name: "Setup Pythons"
id: "setup-python"
uses: "actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c" # v5.0.0
with:
python-version: "3.12"

- name: "Restore cache"
id: "restore-cache"
uses: "actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319" # v4.0.1
with:
path: ".venv/"
key: "coverage-hash=${{ hashFiles('.github/workflows/test.yaml', 'pyproject.toml', 'week-number.txt', 'requirements/*/*.txt') }}"

- name: "Create a virtual environment"
if: "steps.restore-cache.outputs.cache-hit == false"
run: |
python -m venv .venv
.venv/bin/python -m pip install --upgrade pip setuptools wheel
.venv/bin/python -m pip install coverage[toml]
- name: "Download coverage data files"
uses: "actions/download-artifact@87c55149d96e628cc2ef7e6fc2aab372015aec85" # v4.1.3
with:
pattern: "coverage-data-files-*"
merge-multiple: true

- name: "Calculate coverage"
run: |
.venv/bin/coverage combine
.venv/bin/coverage report
quality:
name: "Quality"
runs-on: "ubuntu-latest"
needs: "build"
steps:
# The week number is used for cache-busting.
- name: "Identify week number"
run: "date +'%V' > week-number.txt"

- name: "Checkout branch"
uses: "actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11" # v4.1.1

- name: "Setup Pythons"
id: "setup-python"
uses: "actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c" # v5.0.0
with:
python-version: "3.12"

- name: "Restore cache"
id: "restore-cache"
uses: "actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319" # v4.0.1
with:
path: |
.mypy_cache/
.tox/
.venv/
key: "lint-hash=${{ hashFiles('.github/workflows/test.yaml', 'pyproject.toml', 'tox.ini', 'week-number.txt', 'requirements/*/*.txt') }}"

- name: "Create a virtual environment"
if: "steps.restore-cache.outputs.cache-hit == false"
run: |
python -m venv .venv
.venv/bin/python -m pip install --upgrade pip setuptools wheel
.venv/bin/pip install tox
- name: "Download the build artifact"
uses: "actions/download-artifact@87c55149d96e628cc2ef7e6fc2aab372015aec85" # v4.1.3
with:
name: "listparser-${{ github.sha }}.whl"

- name: "Lint type annotations"
run: >
.venv/bin/tox run
--installpkg "${{ needs.build.outputs.wheel-filename }}"
-e mypy
- name: "Lint documentation"
run: ".venv/bin/tox run -e docs"
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ build
listparser.egg-info/
.cache
htmlcov/
.coverage
venv/
.coverage*
.idea/
.venv/
poetry.lock
/poetry.lock
70 changes: 70 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
ci:
autoupdate_schedule: "quarterly"

default_language_version:
python: "python3.12"

repos:
- repo: "meta"
hooks:
- id: "check-hooks-apply"
- id: "check-useless-excludes"

- repo: "https://github.com/pre-commit/pre-commit-hooks"
rev: "v4.5.0"
hooks:
- id: "check-added-large-files"
- id: "check-merge-conflict"
- id: "check-yaml"
- id: "end-of-file-fixer"
- id: "mixed-line-ending"
args:
- "--fix=lf"
- id: "trailing-whitespace"

- repo: "https://github.com/asottile/pyupgrade"
rev: "v3.15.2"
hooks:
- id: "pyupgrade"
name: "Enforce Python 3.8+ idioms"
args:
- "--py38-plus"

- repo: "https://github.com/psf/black-pre-commit-mirror"
rev: "24.3.0"
hooks:
- id: "black"

- repo: "https://github.com/pycqa/isort"
rev: "5.13.2"
hooks:
- id: "isort"

- repo: "https://github.com/pycqa/flake8"
rev: "7.0.0"
hooks:
- id: "flake8"
additional_dependencies:
- "flake8-bugbear==24.2.6"

- repo: "https://github.com/editorconfig-checker/editorconfig-checker.python"
rev: "2.7.3"
hooks:
- id: "editorconfig-checker"

- repo: "https://github.com/python-jsonschema/check-jsonschema"
rev: "0.28.0"
hooks:
- id: "check-dependabot"
- id: "check-github-workflows"
- id: "check-readthedocs"

- repo: "https://github.com/rhysd/actionlint"
rev: "v1.6.27"
hooks:
- id: "actionlint"

- repo: "https://github.com/kurtmckee/pre-commit-hooks"
rev: "v0.1.1"
hooks:
- id: "verify-consistent-pyproject-toml-python-requirements"
16 changes: 16 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Configure ReadTheDocs.

version: 2

build:
os: "ubuntu-22.04"
tools:
python: "3.12"

python:
install:
- requirements: "requirements/docs/requirements.txt"

sphinx:
configuration: "docs/conf.py"
fail_on_warning: true
Loading

0 comments on commit bb04265

Please sign in to comment.