-
Notifications
You must be signed in to change notification settings - Fork 21
Unit tests + coverage reports, type checking, pre-commit, and requested fixes #81
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
Merged
Merged
Changes from 76 commits
Commits
Show all changes
77 commits
Select commit
Hold shift + click to select a range
35c25d6
integrate mypy type checking into CI
2bndy5 1374f8b
resolve #75
2bndy5 cf96533
resolve #73
2bndy5 4656598
run pylint workflow on changes to workflow file
2bndy5 fb5b09b
resolve #76
2bndy5 09034c3
add unit tests for ignored paths
2bndy5 cd60a49
run pytest in CI
2bndy5 1b9b31b
resolve #74 and add unit tests for it
2bndy5 a9d911a
improve and test CLI arg parsing
2bndy5 9e37e03
add unit test for database
2bndy5 b5c721f
switch to pre-commit; run pytest in a matrix
2bndy5 4b4e18a
parametrize unit tests
2bndy5 b48ac79
fix changes to dev-test yaml
2bndy5 b0c3ebb
make database path absolute
2bndy5 8c89f45
use pathlib to resolve() relative paths in test
2bndy5 6fe57ef
let db path be independent of repo-root w/o docker
2bndy5 c0b20bc
this fails locally
2bndy5 cf295d6
show me value for RUNNER_WORKSPACE
2bndy5 a656f05
use gh workspace if not in docker env
2bndy5 b2c751a
simplify the paths' concatenation
2bndy5 454e158
fix assignment of `Globals.FILES`
2bndy5 6911a49
treat unsupport events like a push
2bndy5 767417a
explicitly set a env var when using docker
2bndy5 9518985
ammend some logic
2bndy5 ccf8f33
show me some contents of folders on docker
2bndy5 903d351
hardcode the correct worspace dir
2bndy5 99bbfd9
remove unused import
2bndy5 8fa467e
try detecting the docker env better
2bndy5 400b615
set the docker env var w/ a str
2bndy5 0367cf4
assume that RUNNER_WORKSPACE is abs
2bndy5 37e3083
use only relativer path to db on docker
2bndy5 120919b
Revert "use only relativer path to db on docker"
2bndy5 0810b1a
better test coverage
2bndy5 d51d8c9
mkdocstring doesn't support `Tuple[x, x]` type
2bndy5 d5e3969
fix workflow
2bndy5 ae5bcae
revert changes to `get_line_cnt_from_cols()`
2bndy5 8851435
upload without codecov token??
2bndy5 20f0be0
ensure LF used on demo src
2bndy5 540a7d7
update workflow
2bndy5 f8d03ab
re-implement newer `get_line_cnt_from_cols()`
2bndy5 d88b54c
switch to pyproject.toml (setup.py is a dummy now)
2bndy5 11f44ac
resolve version exe path better
2bndy5 91aa28b
ammend make_annotations() (& its tests)
2bndy5 f35ea72
adjust for pypi releases
2bndy5 ac8b4f0
allow running locally & fix duplicate log cmds
2bndy5 d802afb
use pathlib.Path to open files
2bndy5 b670e9c
rely on pathlib, update pkg name & CI workflows
2bndy5 6af4794
`is_relative_to()` introduced in python v3.9
2bndy5 3787de4
`lstrip(".")` from file's extension
2bndy5 8867252
tidy v13 use abs path to std libs in output error
2bndy5 f7dad01
build/install wheel in test CI
2bndy5 2c8fb6d
oops, use correct artifact name
2bndy5 6a1f91d
remove identifying info from test's event payload
2bndy5 da9da35
make files list simpler for any event
2bndy5 269b22c
ammend walking the repo files/folders
2bndy5 8f48baa
replace os.walk() with pathlib's rglob()
2bndy5 97f48db
only upload coverage report once from test CI
2bndy5 b9aa4cc
use OS dependent path separators for DB path
2bndy5 0a8a7a4
resolve #82
2bndy5 7d8b850
ensure tidy fixit_lines end w/ a LF
2bndy5 6e781f1
workflow continue only if `latest` tag was added
2bndy5 25df187
include v7-9 for CI tests
2bndy5 6425065
fix docs about `parse_ignore_option()`
2bndy5 9e75bbe
fix `TidyNotification.__repr__()`
2bndy5 d8f9bff
Merge branch 'master' into backlogged-updates
2bndy5 31c332f
tell CI to download clang-tools v7-9
2bndy5 3925f76
support older versions of clang-tidy YML output
2bndy5 0608d9b
don't try to traverse a `None` obj
2bndy5 2a3240d
add common hooks to pre-commit config
2bndy5 ef5b6e8
add more configs to toml
2bndy5 2923972
update event triggers on dev-test CI workflow
2bndy5 23622e1
sort requirements.txt contents
2bndy5 02abc8f
split pre-commit step into its own CI workflow
2bndy5 e68e928
pleasing pre-commit hooks
2bndy5 a178730
fix run-test.yml (trailing whitespaces)
2bndy5 d3a8585
revise README & remove .ci-ignore file
2bndy5 b36ee44
add code coverage badge to README
2bndy5 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,5 @@ | |
*.py text eol=lf | ||
*.rst text eol=lf | ||
*.sh text eol=lf | ||
*.cpp text eol=lf | ||
*.hpp text eol=lf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Pre-commit | ||
|
||
on: | ||
push: | ||
pull_request: | ||
types: opened | ||
|
||
jobs: | ||
check-source-files: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
- run: python3 -m pip install pre-commit | ||
- run: pre-commit run --all-files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# This workflow will upload a Python Package using Twine when a release is created | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
name: Upload Python Package | ||
|
||
on: | ||
release: | ||
branches: [master] | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
deploy: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
# use fetch --all for setuptools_scm to work | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: python -m pip install --upgrade pip twine | ||
- name: Build wheel | ||
run: python -m pip wheel -w dist --no-deps . | ||
- name: Check distribution | ||
run: twine check dist/* | ||
- name: Publish package (to TestPyPI) | ||
if: github.event_name == 'workflow_dispatch' && github.repository == 'cpp-linter/cpp-linter-action' | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }} | ||
run: twine upload --repository testpypi dist/* | ||
- name: Publish package (to PyPI) | ||
if: github.event_name != 'workflow_dispatch' && github.repository == 'cpp-linter/cpp-linter-action' | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | ||
run: twine upload dist/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
name: "Check python code" | ||
|
||
on: | ||
push: | ||
paths: | ||
- "**.py" | ||
- pyproject.toml | ||
- pre-commit-config.yaml | ||
- ".github/workflows/run-dev-tests.yml" | ||
pull_request: | ||
types: opened | ||
paths: | ||
- "**.py" | ||
- "**requirements*.txt" | ||
- pyproject.toml | ||
- pre-commit-config.yaml | ||
- ".github/workflows/run-dev-tests.yml" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
- name: Build wheel | ||
run: python3 -m pip wheel --no-deps -w dist . | ||
- name: Upload wheel as artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: cpp-linter-action_wheel | ||
path: ${{ github.workspace }}/dist/*.whl | ||
|
||
test: | ||
needs: [build] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
py: ['3.7', '3.8', '3.9', '3.10'] | ||
os: ['windows-latest', ubuntu-latest] | ||
version: ['13', '12', '11', '10', '9', '8', '7'] | ||
include: | ||
- tools_dir: 'N/A' | ||
- os: 'windows-latest' | ||
version: '10' | ||
tools_dir: temp | ||
- os: 'windows-latest' | ||
version: '10' | ||
tools_dir: temp | ||
- os: 'windows-latest' | ||
version: '11' | ||
tools_dir: temp | ||
- os: 'windows-latest' | ||
version: '12' | ||
tools_dir: temp | ||
- os: 'ubuntu-latest' | ||
version: '13' | ||
tools_dir: temp | ||
# - version: '14' | ||
# tools_dir: temp | ||
- version: '7' | ||
tools_dir: temp | ||
- version: '8' | ||
tools_dir: temp | ||
- version: '9' | ||
tools_dir: temp | ||
|
||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.py }} | ||
|
||
- name: download wheel artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: cpp-linter-action_wheel | ||
path: dist | ||
|
||
- name: Install workflow deps | ||
# using a wildcard as filename on Windows requires a bash shell | ||
shell: bash | ||
run: python3 -m pip install pytest coverage[toml] dist/*.whl | ||
|
||
- name: Install clang-tools | ||
if: matrix.tools_dir == 'temp' | ||
run: | | ||
python -m pip install clang-tools | ||
clang-tools --install ${{ matrix.version }} --directory ${{ runner.temp }}/clang-tools | ||
|
||
- name: Collect Coverage (native clang install) | ||
if: matrix.tools_dir == 'N/A' | ||
env: | ||
CLANG_VERSION: ${{ matrix.version }} | ||
run: coverage run -m pytest | ||
|
||
- name: Collect Coverage (non-native clang install) | ||
if: matrix.tools_dir == 'temp' | ||
env: | ||
CLANG_VERSION: ${{ runner.temp }}/clang-tools | ||
run: coverage run -m pytest | ||
|
||
- run: coverage report && coverage xml | ||
|
||
- uses: codecov/codecov-action@v3 | ||
if: matrix.os == 'ubuntu-latest' && matrix.version == '12' && matrix.py == '3.10' | ||
with: | ||
files: ./coverage.xml | ||
fail_ci_if_error: true # optional (default = false) | ||
verbose: true # optional (default = false) |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,12 +23,13 @@ jobs: | |
git push origin latest | ||
|
||
test-action: | ||
needs: [add-tag] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: convictional/[email protected] | ||
with: | ||
owner: cpp-linter | ||
repo: test-cpp-linter-action | ||
repo: test-cpp-linter-action | ||
github_token: ${{ secrets.PAT_TOKEN }} | ||
workflow_file_name: cpp-lint-action.yml | ||
ref: master | ||
|
@@ -38,12 +39,13 @@ jobs: | |
trigger_workflow: true | ||
wait_workflow: true | ||
test-package: | ||
needs: [add-tag] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: convictional/[email protected] | ||
with: | ||
owner: cpp-linter | ||
repo: test-cpp-linter-action | ||
repo: test-cpp-linter-action | ||
github_token: ${{ secrets.PAT_TOKEN }} | ||
workflow_file_name: cpp-lint-package.yml | ||
ref: master | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
tasks: | ||
- init: pip install -r requirements.txt | ||
- init: pip install -r requirements.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-docstring-first | ||
- id: check-added-large-files | ||
- id: check-yaml | ||
- id: check-toml | ||
- id: requirements-txt-fixer | ||
- repo: https://github.com/python/black | ||
rev: '22.6.0' | ||
hooks: | ||
- id: black | ||
args: ["--diff"] | ||
- repo: https://github.com/pycqa/pylint | ||
rev: v2.14.5 | ||
hooks: | ||
- id: pylint | ||
name: pylint (action code) | ||
types: [python] | ||
exclude: "^(docs/|tests/|setup.py$)" | ||
additional_dependencies: [pyyaml, requests] | ||
- repo: local | ||
# this is a "local" hook to run mypy (see https://pre-commit.com/#repository-local-hooks) | ||
# because the mypy project doesn't seem to be compatible with pre-commit hooks | ||
hooks: | ||
- id: mypy | ||
name: mypy | ||
description: type checking with mypy tool | ||
language: python | ||
types: [python] | ||
entry: mypy | ||
exclude: "^(docs/|setup.py$)" | ||
additional_dependencies: [mypy, types-pyyaml, types-requests, rich, requests, pytest, pyyaml, '.'] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.