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

precommit: update & add prettier #39

Merged
merged 5 commits into from
Nov 15, 2023
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
5 changes: 2 additions & 3 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Validation check:
# $ curl --data-binary @.codecov.yml https://codecov.io/validate


# https://docs.codecov.io/docs/codecovyml-reference
codecov:
bot: "codecov-io"
Expand All @@ -12,7 +11,7 @@ codecov:
wait_for_ci: yes

coverage:
precision: 0 # 2 = xx.xx%, 0 = xx%
precision: 0 # 2 = xx.xx%, 0 = xx%
round: nearest # how coverage is rounded: down/up/nearest
range: 60...100 # custom range of coverage colors from red -> yellow -> green
status:
Expand Down Expand Up @@ -44,4 +43,4 @@ parsers:
comment:
layout: header, diff
require_changes: false
behavior: default # update if exists else create new
behavior: default # update if exists else create new
7 changes: 3 additions & 4 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pull_request_rules:

- name: warn on conflicts
conditions:
- conflict
Expand All @@ -9,7 +8,7 @@ pull_request_rules:
# comment:
# message: This pull request is now in conflict... :(
label:
add: [ "has conflicts" ]
add: ["has conflicts"]

- name: resolved conflicts
conditions:
Expand All @@ -20,13 +19,13 @@ pull_request_rules:
- -closed
actions:
label:
remove: [ "has conflicts" ]
remove: ["has conflicts"]

- name: update PR
conditions:
- -conflict
- -draft # filter-out GH draft PRs
- base=master # apply only on master
- base=master # apply only on master
- -title~=(?i)wip # skip all PR that title contains “WIP” (ignoring case)
- "#approved-reviews-by>=1" # number of review approvals
actions:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_install-pkg.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Install pkg

# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on: # Trigger the workflow on push or pull request, but only for the main branch
on: # Trigger the workflow on push or pull request, but only for the main branch
push: {}
pull_request:
branches: [ main ]
branches: [main]

jobs:
pkg-check:
Expand Down
90 changes: 44 additions & 46 deletions .github/workflows/ci_testing.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
name: CI testing

# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on: # Trigger the workflow on push or pull request, but only for the main branch
on: # Trigger the workflow on push or pull request, but only for the main branch
push: {}
pull_request:
branches: [ main ]
branches: [main]

jobs:

pytester:
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -18,57 +17,56 @@ jobs:
# Timeout: https://stackoverflow.com/a/59076067/4521646
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install requirements
run: |
pip install -r tests/requirements.txt
pip list
shell: bash
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Tests
run: |
phmdoctest README.md --outfile tests/test_readme.py
python -m pytest . -v --cov=deprecate --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml
- name: Install requirements
run: |
pip install -r tests/requirements.txt
pip list
shell: bash

- name: Upload pytest test results
uses: actions/upload-artifact@v3
with:
name: pytest-results-${{ runner.os }}-${{ matrix.python-version }}
path: junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml
if: failure()
- name: Tests
run: |
phmdoctest README.md --outfile tests/test_readme.py
python -m pytest . -v --cov=deprecate --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml

- name: Statistics
if: success()
run: |
coverage report
coverage xml
- name: Upload pytest test results
uses: actions/upload-artifact@v3
with:
name: pytest-results-${{ runner.os }}-${{ matrix.python-version }}
path: junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml
if: failure()

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: success()
continue-on-error: true
with:
# token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.xml
flags: pytest,python${{ matrix.python-version }}
fail_ci_if_error: false
- name: Statistics
if: success()
run: |
coverage report
coverage xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: success()
continue-on-error: true
with:
# token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.xml
flags: pytest,python${{ matrix.python-version }}
fail_ci_if_error: false

testing-guardian:
runs-on: ubuntu-latest
needs: pytester
if: always()
steps:
- run: echo "${{ needs.pytester.result }}"
- name: failing...
if: needs.pytester.result == 'failure'
run: exit 1
- name: cancelled or skipped...
if: contains(fromJSON('["cancelled", "skipped"]'), needs.pytester.result)
timeout-minutes: 1
run: sleep 90
- run: echo "${{ needs.pytester.result }}"
- name: failing...
if: needs.pytester.result == 'failure'
run: exit 1
- name: cancelled or skipped...
if: contains(fromJSON('["cancelled", "skipped"]'), needs.pytester.result)
timeout-minutes: 1
run: sleep 90
5 changes: 2 additions & 3 deletions .github/workflows/code-format.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
name: Code formatting

# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on: # Trigger the workflow on push or pull request, but only for the main branch
on: # Trigger the workflow on push or pull request, but only for the main branch
push: {}
pull_request:
branches: [ main ]
branches: [main]

jobs:

typing-mypy:
runs-on: ubuntu-20.04
steps:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: "CodeQL"

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]
schedule:
- cron: "10 10 * * 6"

Expand All @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ python ]
language: [python]

steps:
- name: Checkout
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: Greetings
# https://github.com/marketplace/actions/first-interaction

on: [issues] # pull_request
on: [issues] # pull_request

jobs:
greeting:
runs-on: ubuntu-latest
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: 'Hi! thanks for your contribution!, great first issue!'
pr-message: 'Hey thanks for the input! Please give us a bit of time to review it!'
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "Hi! thanks for your contribution!, great first issue!"
pr-message: "Hey thanks for the input! Please give us a bit of time to review it!"
52 changes: 26 additions & 26 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: PyPI Release

# https://help.github.com/en/actions/reference/events-that-trigger-workflows
on: # Trigger the workflow on push or pull request, but only for the main branch
on: # Trigger the workflow on push or pull request, but only for the main branch
push:
branches: [ main ]
branches: [main]
release:
types: [published]

Expand All @@ -13,30 +13,30 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.8
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Install dependencies
run: python -m pip install build
- name: Build package
run: python -m build
- name: List package
run: ls -lh dist/
- name: Install dependencies
run: python -m pip install build
- name: Build package
run: python -m build
- name: List package
run: ls -lh dist/

# We do this, since failures on test.pypi aren't that bad
- name: Publish to Test PyPI
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
# We do this, since failures on test.pypi aren't that bad
- name: Publish to Test PyPI
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/

- name: Publish distribution 📦 to PyPI
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
- name: Publish distribution 📦 to PyPI
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
19 changes: 13 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ default_language_version:

ci:
autofix_prs: true
autoupdate_commit_msg: '[pre-commit.ci] pre-commit suggestions'
autoupdate_commit_msg: "[pre-commit.ci] pre-commit suggestions"
autoupdate_schedule: quarterly
# submodules: true

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
Expand All @@ -23,14 +23,21 @@ repos:
- id: detect-private-key

- repo: https://github.com/asottile/pyupgrade
rev: v3.13.0
rev: v3.15.0
hooks:
- id: pyupgrade
args: ["--py37-plus"]
name: Upgrade code

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
hooks:
- id: prettier
# https://prettier.io/docs/en/options.html#print-width
args: ["--print-width=120"]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
rev: v2.2.6
hooks:
- id: codespell
additional_dependencies: [tomli]
Expand All @@ -44,7 +51,7 @@ repos:
args: [--in-place]

- repo: https://github.com/psf/black
rev: 23.9.1
rev: 23.11.0
hooks:
- id: black
name: Format code
Expand Down Expand Up @@ -74,7 +81,7 @@ repos:
- flake8-bandit

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
rev: v0.1.5
hooks:
- id: ruff
args: ["--fix"]
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore all MD files:
**/*.md
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ include *.md
include LICENSE

exclude *.sh
exclude .prettierignore

# Exclude build configs
exclude *.yml
Expand Down
Loading