Skip to content

Commit

Permalink
Merge pull request #8 from sarnold/new-refactor
Browse files Browse the repository at this point in the history
code migration and cleanup
  • Loading branch information
sarnold authored Jul 15, 2023
2 parents 6635a96 + 387062f commit 43de42c
Show file tree
Hide file tree
Showing 22 changed files with 724 additions and 216 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
fetch-depth: 0

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

Expand Down
30 changes: 17 additions & 13 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,21 @@ jobs:
else
EXPORT_VALUE="${TMP_GITHUB_REF}"
fi
echo "##[set-output name=branch;]${EXPORT_VALUE}"
echo "branch=${EXPORT_VALUE}" >> $GITHUB_OUTPUT
- name: Set up Python 3.8
uses: actions/setup-python@v2
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: '3.10'

- name: Install tox
run: |
python -m pip install --upgrade pip wheel
pip install tox tox-gh-actions
pip install tox
#- name: Run tox bare-ass
#run: |
#tox -e lint

- name: Run pylint
id: analyze
Expand All @@ -55,33 +59,33 @@ jobs:
run: |
rating=$(bash -c 'tox -e lint' | grep 'Your code has been rated at' | cut -f7 -d " ")
echo "Pylint score: ${rating}"
echo "##[set-output name=rating;]${rating}"
echo "##[set-output name=path;]${BADGE_PATH}"
echo "rating=${rating}" >> $GITHUB_OUTPUT
echo "path=${BADGE_PATH}" >> $GITHUB_OUTPUT
badge:
# Only generate and publish if these conditions are met:
# - The previous job/analyze step ended successfully
# - At least one of these is true:
# - This is a push event and the push event is on branch 'master' or 'develop'
# - This is a push event and the push event is on branch 'main' or 'develop'
# Note: if this repo is personal (ie, not an org repo) then you can
# use the following to change the scope of the next 2 jobs
# instead of running on branch push as shown below:
# - This is a pull request event and the pull actor is the same as the repo owner
# if: ${{ ( github.event_name == 'pull_request' && github.actor == github.repository_owner ) || github.ref == 'refs/heads/master' }}
# if: ${{ ( github.event_name == 'pull_request' && github.actor == github.repository_owner ) || github.ref == 'refs/heads/main' }}
name: Generate badge image with pylint score
runs-on: ubuntu-20.04
needs: [pylint]
if: ${{ github.event_name == 'push' }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: badges
path: badges

# Use the output from the `analyze` step
- name: Create pylint badge
uses: emibcn/badge-action@v1
uses: emibcn/badge-action@v2.0.2
id: badge
with:
label: 'Pylint score'
Expand All @@ -95,8 +99,8 @@ jobs:
FILE: 'pylint-score.svg'
working-directory: ./badges
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
mkdir -p "${BRANCH}"
mv "${FILE}" "${BRANCH}"
git add "${BRANCH}/${FILE}"
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
fetch-depth: 0

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

Expand All @@ -43,11 +43,11 @@ jobs:
- name: Build dist pkgs
run: |
tox -e deploy
tox -e build
- name: Upload artifacts
if: matrix.python-version == 3.8 && runner.os != 'Windows'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: wheels
path: ./dist/*.whl
Expand All @@ -64,12 +64,12 @@ jobs:
echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
echo ${{ env.VERSION }}
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0

# download all artifacts to project dir
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3

- name: Generate changes file
uses: sarnold/gitchangelog-action@master
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: '3.9'

Expand All @@ -29,7 +29,7 @@ jobs:
tox -e docs-lint
tox -e docs
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: ApiDocsHTML
path: "docs/_build/html/"
Expand All @@ -40,7 +40,7 @@ jobs:
- name: Deploy docs to gh-pages
if: ${{ github.event_name == 'push' }}
uses: JamesIves/github-pages-deploy-action@3.7.1
uses: JamesIves/github-pages-deploy-action@v4.4.3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
fetch-depth: 0

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

Expand All @@ -43,11 +43,11 @@ jobs:
- name: Build dist pkgs
run: |
tox -e deploy,check
tox -e build,check
- name: Upload artifacts
if: matrix.python-version == 3.8 && runner.os == 'Linux'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: wheels
path: ./dist/*.whl
42 changes: 13 additions & 29 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
- id: check-useless-excludes
- id: check-hooks-apply
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand Down Expand Up @@ -37,54 +37,54 @@ repos:
language_version: python3

- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
args: [--settings-path=pyproject.toml]
args: ["--settings-path=pyproject.toml"]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.961
rev: v1.4.1
hooks:
- id: mypy
additional_dependencies:
- importlib_metadata
- importlib_resources
- munch
- munch-stubs
- ruamel.yaml
args:
- --follow-imports=normal
- --install-types
- --non-interactive
- --ignore-missing-imports
files: src/ymltoxml/ymltoxml.py

- repo: "https://github.com/asottile/blacken-docs"
rev: "v1.12.1"
rev: "1.15.0"
hooks:
- id: "blacken-docs"
name: "Format docs (blacken-docs)"
args: ["-l", "64"]
additional_dependencies:
- "black==21.9b0"
- "black==22.1.0"

- repo: https://github.com/PyCQA/doc8
rev: 0.11.2
rev: v1.1.1
hooks:
- id: doc8
args:
- '--max-line-length=90'
- '--ignore=D001'

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
rev: v1.10.0
hooks:
- id: rst-backticks
# exclude: ChangeLog\.rst$
- id: rst-directive-colons
- id: rst-inline-touching-normal

- repo: https://github.com/myint/autoflake
rev: v1.4
rev: v2.2.0
hooks:
- id: autoflake
files: src/ymltoxml/ymltoxml.py
Expand All @@ -94,15 +94,15 @@ repos:
- --remove-duplicate-keys
- --remove-unused-variables

- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
files: src/ymltoxml/ymltoxml.py
additional_dependencies: ["flake8-bugbear"]

- repo: https://github.com/PyCQA/bandit
rev: 1.7.4
rev: 1.7.5
hooks:
- id: bandit
args: ["-ll", "-q"]
Expand All @@ -112,19 +112,3 @@ repos:
# rev: v6.2.1
# hooks:
# - id: beautysh

ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
autofix_prs: false
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: weekly
skip: []
submodules: false

# re-running a pull request: you can trigger a re-run on a pull request by
# commenting pre-commit.ci run (must appear on a line by itself).
# skipping push runs: skip a run by putting [skip ci], [ci skip],
# [skip pre-commit.ci], or [pre-commit.ci skip] in the commit message.
Loading

0 comments on commit 43de42c

Please sign in to comment.