From 8d991d844af052f18271cb43005a8473f0c8f260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 10:05:58 +0100 Subject: [PATCH 01/27] use composite actions --- action.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index 0771b3f..4a38fee 100644 --- a/action.yml +++ b/action.yml @@ -80,14 +80,14 @@ inputs: runs: using: "composite" steps: + - name: + uses: actions/setup-python@v2 + with: + python-version: {{ inputs.conda-python-version }} + architecture: x64 - run: | - $CONDA/bin/conda --version - $CONDA/bin/conda install python=${{ inputs.conda-python-version }} - shell: bash - name: Install lintners - - run: | - $CONDA/bin/python --version - $CONDA/bin/pip install -r ${{ github.action_path }}/requirements.txt + python --version + pip install -r ${{ github.action_path }}/requirements.txt shell: bash name: Install lintners - run: > From 4ed95c97c324a82c2bcb97de8b372c1b8d9f024d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 10:08:05 +0100 Subject: [PATCH 02/27] bugfix --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 4a38fee..541d1b4 100644 --- a/action.yml +++ b/action.yml @@ -83,7 +83,7 @@ runs: - name: uses: actions/setup-python@v2 with: - python-version: {{ inputs.conda-python-version }} + python-version: ${{ inputs.conda-python-version }} architecture: x64 - run: | python --version From e93d512da8d918dff4c7d3b62f3d6c4629543aeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 10:20:01 +0100 Subject: [PATCH 03/27] bugfix --- .github/workflows/all-lints.yml | 2 +- action.yml | 4 +++- entrypoint.sh | 16 ++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/all-lints.yml b/.github/workflows/all-lints.yml index d812331..39fb20b 100644 --- a/.github/workflows/all-lints.yml +++ b/.github/workflows/all-lints.yml @@ -20,5 +20,5 @@ jobs: use-pylint: false use-flake8: false use-vulture: true - conda-python-version: "3.6" + python-version: "3.6" diff --git a/action.yml b/action.yml index 541d1b4..c51d153 100644 --- a/action.yml +++ b/action.yml @@ -83,8 +83,10 @@ runs: - name: uses: actions/setup-python@v2 with: - python-version: ${{ inputs.conda-python-version }} + python-version: ${{ inputs.python-version }} architecture: x64 + cache: pip + cache-dependency-path: ${{ github.action_path }}/requirements.txt - run: | python --version pip install -r ${{ github.action_path }}/requirements.txt diff --git a/entrypoint.sh b/entrypoint.sh index ef1596a..018b8cb 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -51,7 +51,7 @@ if [ "$2" = true ] ; then echo Running: pylint ${10} $1 - $CONDA/bin/pylint --output-format="colorized" ${10} $1 + pylint --output-format="colorized" ${10} $1 exit_code=$? if [ "$exit_code" = "0" ]; then @@ -66,7 +66,7 @@ if [ "$3" = true ] ; then echo Running: pycodestyle ${11} $1 - $CONDA/bin/pycodestyle ${11} $1 + pycodestyle ${11} $1 exit_code=$? if [ "$exit_code" = "0" ]; then @@ -81,7 +81,7 @@ if [ "$4" = true ] ; then echo Running: flake8 ${12} $1 - $CONDA/bin/flake8 ${12} $1 + flake8 ${12} $1 exit_code=$? if [ "$exit_code" = "0" ]; then @@ -96,7 +96,7 @@ if [ "$5" = true ] ; then echo Running: black --check ${13} $1 - $CONDA/bin/black --check ${13} $1 + black --check ${13} $1 exit_code=$? if [ "$exit_code" = "0" ]; then @@ -111,7 +111,7 @@ if [ "$6" = true ] ; then echo Running: mypy --ignore-missing-imports --follow-imports=silent --show-column-numbers ${14} $1 - $CONDA/bin/mypy --ignore-missing-imports --follow-imports=silent --show-column-numbers ${14} $1 + mypy --ignore-missing-imports --follow-imports=silent --show-column-numbers ${14} $1 exit_code=$? if [ "$exit_code" = "0" ]; then @@ -126,7 +126,7 @@ if [ "$7" = true ] ; then echo Running: isort ${15} $1 -c --diff - $CONDA/bin/isort ${15} $1 -c --diff + isort ${15} $1 -c --diff exit_code=$? if [ "$exit_code" = "0" ]; then @@ -141,7 +141,7 @@ if [ "$8" = true ] ; then echo Running: vulture ${16} $1 - $CONDA/bin/vulture ${16} $1 + vulture ${16} $1 exit_code=$? if [ "$exit_code" = "0" ]; then @@ -156,7 +156,7 @@ if [ "$9" = true ] ; then echo Running: pydocstyle ${17} $1 - $CONDA/bin/pydocstyle ${17} $1 + pydocstyle ${17} $1 exit_code=$? if [ "$exit_code" = "0" ]; then From d4096d2c7f185b730edef0529b4d1d1351dc8dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 10:23:10 +0100 Subject: [PATCH 04/27] bugfix --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index c51d153..ed441d5 100644 --- a/action.yml +++ b/action.yml @@ -72,8 +72,8 @@ inputs: description: "Extra options: pydocstyle $(extra-pydocstyle-options) $(python-root-list)" required: false default: "" - conda-python-version: - description: "Tests are run in Conda environment, set desired python version with this keyword" + python-version: + description: "Set desired python version with this keyword" required: false default: "3.8" From 24b8a314fd3f39e5103cfafd4f52744d0cb34201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 10:27:01 +0100 Subject: [PATCH 05/27] bugfix --- action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/action.yml b/action.yml index ed441d5..9a5dac3 100644 --- a/action.yml +++ b/action.yml @@ -86,7 +86,6 @@ runs: python-version: ${{ inputs.python-version }} architecture: x64 cache: pip - cache-dependency-path: ${{ github.action_path }}/requirements.txt - run: | python --version pip install -r ${{ github.action_path }}/requirements.txt From dc0eb5f3ee4c7043ba8ffa0ca5741f62a4e6b444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 10:30:07 +0100 Subject: [PATCH 06/27] text if python is not changed --- .github/workflows/all-lints.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/all-lints.yml b/.github/workflows/all-lints.yml index 39fb20b..8fc822f 100644 --- a/.github/workflows/all-lints.yml +++ b/.github/workflows/all-lints.yml @@ -7,6 +7,12 @@ jobs: name: Lint Python runs-on: ubuntu-20.04 steps: + - name: + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - run: | + python --version - uses: actions/checkout@v1 - uses: marian-code/pyaction@master with: @@ -21,4 +27,6 @@ jobs: use-flake8: false use-vulture: true python-version: "3.6" + - run: | + python --version From 1f6b6af15bf19a4071f1fab76878ccd134cdeaff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 11:03:05 +0100 Subject: [PATCH 07/27] test more os --- .github/workflows/all-lints.yml | 17 +++++++--------- README.md | 35 ++++++++++++++++++++++----------- action.yml | 2 +- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/.github/workflows/all-lints.yml b/.github/workflows/all-lints.yml index 8fc822f..5759280 100644 --- a/.github/workflows/all-lints.yml +++ b/.github/workflows/all-lints.yml @@ -5,14 +5,12 @@ name: Lint Python jobs: lintpython: name: Lint Python - runs-on: ubuntu-20.04 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: ['3.7', '3.8', '3.9', '3.10'] steps: - - name: - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - run: | - python --version - uses: actions/checkout@v1 - uses: marian-code/pyaction@master with: @@ -26,7 +24,6 @@ jobs: use-pylint: false use-flake8: false use-vulture: true - python-version: "3.6" - - run: | - python --version + python-version: ${{ matrix.python-version }} + diff --git a/README.md b/README.md index ac79752..2152cf3 100644 --- a/README.md +++ b/README.md @@ -46,14 +46,14 @@ steps: use-mypy: false use-vulture: true extra-pylint-options: "--output-format="colorized" - conda-python-version: "3.7" + python-version: "3.7" ``` ## Details -Uses conda environment with user selected python version. Only python `3.6` - `3.9` -version are tested since they are by far most common now. Other python `3.x` versions -should also work. Any python `2.x` versions are unsupported! +Uses `actions/setup-python@v2`. Only python `3.6` - `3.10` version are tested since +they are by far most common now. Other python `3.x` versions should also work. +Any python `2.x` versions are unsupported! The lintner versions are: @@ -70,12 +70,15 @@ isort==isort-5.7.0 ## IMPORTANT - test environment -The python version you set up in your action script with `actions/setup-python@v2` -or by other means will not affect the linting process. The python version used by -the linters can be set up only by `conda-python-version` argument! This also means -that if you modify the system conda environment it might affect the lintnig process. -So it is best to keep the lintnig action separated from others. It is also recomended -to run this on `ubuntu-latest`. Example: +The python version is set by `actions/setup-python@v2` using composite actions. This +means that the the action will change python you might have previously set with +`actions/setup-python@v2`. There are two ways to circumvent this. + +- Keep the lintnig action separated from others +- Use it at the and of your workflow when the change in python version will not + affect anything else + +Example: ```yml on: @@ -85,9 +88,15 @@ name: Lint Python jobs: lintpython: name: Lint Python - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 + - uses: actions/setup-python@v2 + with: + python-version: 3.9 + - run: | + python --version # this will output 3.9 now + run tests or other things using python ... - uses: marian-code/pyaction@v2 with: python-root-list: "./tests/*.py" @@ -100,7 +109,9 @@ jobs: use-pylint: false use-flake8: false use-vulture: true - conda-python-version: "3.8" + python-version: "3.7" + - run: | + python --version # this will output 3.7 now !!! ``` ## License diff --git a/action.yml b/action.yml index 9a5dac3..2790877 100644 --- a/action.yml +++ b/action.yml @@ -80,7 +80,7 @@ inputs: runs: using: "composite" steps: - - name: + - name: Setup python uses: actions/setup-python@v2 with: python-version: ${{ inputs.python-version }} From c0c616e9a0f5e9221214688d930ff212727f4dac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 11:17:53 +0100 Subject: [PATCH 08/27] bugfix --- action.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 2790877..5f5bd03 100644 --- a/action.yml +++ b/action.yml @@ -86,11 +86,17 @@ runs: python-version: ${{ inputs.python-version }} architecture: x64 cache: pip - - run: | - python --version - pip install -r ${{ github.action_path }}/requirements.txt + - run: python --version + - name: Is Windows + if: ${{ runner.os }} == "Windows" + run: pip install -r ${{ github.action_path }}\requirements.txt shell: bash - name: Install lintners + name: Install lintners on Win + - name: Is Posix + if: ${{ runner.os }} != "Windows" + run: pip install -r ${{ github.action_path }}/requirements.txt + shell: bash + name: Install lintners on Posix - run: > ${{ github.action_path }}/entrypoint.sh '${{ inputs.python-root-list }}' From 964451913482c757d606465713fbbcfa41ef96f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 11:21:11 +0100 Subject: [PATCH 09/27] bugfix --- action.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 5f5bd03..4113fce 100644 --- a/action.yml +++ b/action.yml @@ -86,17 +86,19 @@ runs: python-version: ${{ inputs.python-version }} architecture: x64 cache: pip + - run: python --version + - name: Is Windows if: ${{ runner.os }} == "Windows" run: pip install -r ${{ github.action_path }}\requirements.txt shell: bash - name: Install lintners on Win + - name: Is Posix if: ${{ runner.os }} != "Windows" run: pip install -r ${{ github.action_path }}/requirements.txt shell: bash - name: Install lintners on Posix + - run: > ${{ github.action_path }}/entrypoint.sh '${{ inputs.python-root-list }}' From 53864e0c00ef77ff947e4176992101d597e126a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 11:23:40 +0100 Subject: [PATCH 10/27] bugfix --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 4113fce..40c006d 100644 --- a/action.yml +++ b/action.yml @@ -88,6 +88,7 @@ runs: cache: pip - run: python --version + shell: bash - name: Is Windows if: ${{ runner.os }} == "Windows" From 3761b4407a1d28c58677621d56067358aef10533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 11:26:24 +0100 Subject: [PATCH 11/27] bugfix --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 40c006d..01eefc8 100644 --- a/action.yml +++ b/action.yml @@ -91,12 +91,12 @@ runs: shell: bash - name: Is Windows - if: ${{ runner.os }} == "Windows" + if: ${{ runner.os }} == Windows run: pip install -r ${{ github.action_path }}\requirements.txt shell: bash - name: Is Posix - if: ${{ runner.os }} != "Windows" + if: ${{ runner.os }} != Windows run: pip install -r ${{ github.action_path }}/requirements.txt shell: bash From 1a824c8a250081abc86d8ef31915fc11d0925bc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 11:30:52 +0100 Subject: [PATCH 12/27] bugfix --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 01eefc8..b154e7a 100644 --- a/action.yml +++ b/action.yml @@ -91,12 +91,12 @@ runs: shell: bash - name: Is Windows - if: ${{ runner.os }} == Windows + if: ${{ runner.os == 'Windows' }} run: pip install -r ${{ github.action_path }}\requirements.txt shell: bash - name: Is Posix - if: ${{ runner.os }} != Windows + if: ${{ runner.os != 'Windows' }} run: pip install -r ${{ github.action_path }}/requirements.txt shell: bash From 31f289dab360c8f9f6deefd2739a721e99ff9d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 12:10:41 +0100 Subject: [PATCH 13/27] bugfix --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index b154e7a..f712ab4 100644 --- a/action.yml +++ b/action.yml @@ -93,7 +93,7 @@ runs: - name: Is Windows if: ${{ runner.os == 'Windows' }} run: pip install -r ${{ github.action_path }}\requirements.txt - shell: bash + shell: PowerShell - name: Is Posix if: ${{ runner.os != 'Windows' }} From ea84886b89484bcb3a94adb5397ed8b85645fac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 12:27:09 +0100 Subject: [PATCH 14/27] bugfix --- action.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index f712ab4..86f099b 100644 --- a/action.yml +++ b/action.yml @@ -92,8 +92,10 @@ runs: - name: Is Windows if: ${{ runner.os == 'Windows' }} - run: pip install -r ${{ github.action_path }}\requirements.txt - shell: PowerShell + run: | + pip install -r ${{ github.action_path }}\requirements.txt + echo "path_sep=" >> $GITHUB_ENV + shell: pwsh - name: Is Posix if: ${{ runner.os != 'Windows' }} From afe1cb4e79f65c81052b6a7cef164d4ab490e50d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 12:47:55 +0100 Subject: [PATCH 15/27] bugfix --- action.yml | 36 ++++++++++++++++++++++++++++++------ entrypoint.sh | 13 ++++++++++--- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/action.yml b/action.yml index 86f099b..c9823cf 100644 --- a/action.yml +++ b/action.yml @@ -86,23 +86,48 @@ runs: python-version: ${{ inputs.python-version }} architecture: x64 cache: pip - + - run: python --version shell: bash - - name: Is Windows + - name: Windows install dependencies if: ${{ runner.os == 'Windows' }} run: | pip install -r ${{ github.action_path }}\requirements.txt echo "path_sep=" >> $GITHUB_ENV shell: pwsh - - name: Is Posix + - name: Posix install dependencies if: ${{ runner.os != 'Windows' }} run: pip install -r ${{ github.action_path }}/requirements.txt shell: bash - - run: > + - name: Lint on Windows + if: ${{ runner.os == 'Windows' }} + run: > + ${{ github.action_path }}\entrypoint.sh + '${{ inputs.python-root-list }}' + ${{ inputs.use-pylint }} + ${{ inputs.use-pycodestyle }} + ${{ inputs.use-flake8 }} + ${{ inputs.use-black }} + ${{ inputs.use-mypy }} + ${{ inputs.use-isort }} + ${{ inputs.use-vulture }} + ${{ inputs.use-pydocstyle }} + '${{ inputs.extra-pylint-options }}' + '${{ inputs.extra-pycodestyle-options }}' + '${{ inputs.extra-flake8-options }}' + '${{ inputs.extra-black-options }}' + '${{ inputs.extra-mypy-options }}' + '${{ inputs.extra-isort-options }}' + '${{ inputs.extra-vulture-options }}' + '${{ inputs.extra-pydocstyle-options }}' + shell: pwsh + + - name: Lint on Linux + if: ${{ runner.os == 'Linux' }} + run: > ${{ github.action_path }}/entrypoint.sh '${{ inputs.python-root-list }}' ${{ inputs.use-pylint }} @@ -121,5 +146,4 @@ runs: '${{ inputs.extra-isort-options }}' '${{ inputs.extra-vulture-options }}' '${{ inputs.extra-pydocstyle-options }}' - shell: bash - name: Lint + shell: pwsh diff --git a/entrypoint.sh b/entrypoint.sh index 018b8cb..16426b5 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,3 @@ -#!/bin/sh -l - # Parameters # # $1 - python-root-list @@ -39,7 +37,16 @@ echo extra-vulture-options: ${16} echo extra-pydocstyle-options: ${17} # actions path has the copy of this actions repo -for matcher in $GITHUB_ACTION_PATH/matchers/*.json +echo $RUNNER_OS +if [ $RUNNER_OS = 'Windows' ] +then + MATCHERS=$GITHUB_ACTION_PATH\matchers\*.json +else + MATCHERS=$GITHUB_ACTION_PATH/matchers/*.json +fi +echo $MATCHERS + +for matcher in $MATCHERS do echo adding matcher $matcher echo "::add-matcher::${matcher}" From 6b3be0767811ae5bcd094492f93d12218747d4da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 12:54:43 +0100 Subject: [PATCH 16/27] bugfix --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index c9823cf..e05b9c2 100644 --- a/action.yml +++ b/action.yml @@ -146,4 +146,4 @@ runs: '${{ inputs.extra-isort-options }}' '${{ inputs.extra-vulture-options }}' '${{ inputs.extra-pydocstyle-options }}' - shell: pwsh + shell: bash From a2f413d441a78b6b3dbecea1cb439c7722c5a214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 12:58:23 +0100 Subject: [PATCH 17/27] test python 3.6 --- .github/workflows/all-lints.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/all-lints.yml b/.github/workflows/all-lints.yml index 5759280..357a36a 100644 --- a/.github/workflows/all-lints.yml +++ b/.github/workflows/all-lints.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] steps: - uses: actions/checkout@v1 - uses: marian-code/pyaction@master From 5e6579fd24a1a851b2ec5cb5ccb0cf185445f677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 13:06:34 +0100 Subject: [PATCH 18/27] update lintners --- README.md | 14 +++++++------- requirements.txt | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 2152cf3..27d3735 100644 --- a/README.md +++ b/README.md @@ -52,17 +52,17 @@ steps: ## Details Uses `actions/setup-python@v2`. Only python `3.6` - `3.10` version are tested since -they are by far most common now. Other python `3.x` versions should also work. -Any python `2.x` versions are unsupported! +they are by far most common now. Other python `3.x` versions should also work. +Any python `2.x` versions are unsupported! You can lint on Linux, Windows and MacOS. The lintner versions are: ```bash -pycodestyle==2.6.0 -pydocstyle==5.1.1 -pylint==2.6.0 -mypy==0.800 -black==20.8b1 +pycodestyle==2.8.0 # from 3.5 +pydocstyle==6.1.1 +pylint==2.12.1 +mypy==0.910 +black==21.11b1 flake8==3.8.4 vulture==2.3 isort==isort-5.7.0 diff --git a/requirements.txt b/requirements.txt index e5fd10b..e2793cb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ -black==20.8b1 -flake8==3.8.4 -isort==5.7.0 -mypy==0.800 -pycodestyle==2.6.0 -pydocstyle==5.1.1 -pylint==2.6.0 +black==21.11b1 +flake8==4.0.1 +isort==5.10.1 +mypy==0.910 +pycodestyle==2.8.0 +pydocstyle==6.1.1 +pylint==2.12.1 vulture==2.3 \ No newline at end of file From 1e82ddd4c3c6348781247a96e6de91d20d3abeea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 13:09:28 +0100 Subject: [PATCH 19/27] update lintners --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 27d3735..92432b8 100644 --- a/README.md +++ b/README.md @@ -58,14 +58,14 @@ Any python `2.x` versions are unsupported! You can lint on Linux, Windows and Ma The lintner versions are: ```bash -pycodestyle==2.8.0 # from 3.5 +pycodestyle==2.8.0 pydocstyle==6.1.1 pylint==2.12.1 mypy==0.910 black==21.11b1 -flake8==3.8.4 +flake8==4.0.1 vulture==2.3 -isort==isort-5.7.0 +isort==5.10.1 ``` ## IMPORTANT - test environment From e7dbdce1a47b324330abe2b14a962c40280a0316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 13:17:13 +0100 Subject: [PATCH 20/27] small doc update --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 92432b8..94b9389 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Basic: ```yml steps: - uses: actions/checkout@v1 - - uses: marian-code/python-lint-annotate@v2 + - uses: marian-code/python-lint-annotate@v3 ``` Options: @@ -39,7 +39,7 @@ Options: ```yml steps: - uses: actions/checkout@v1 - - uses: marian-code/python-lint-annotate@v2 + - uses: marian-code/python-lint-annotate@v3 with: python-root-list: "src/ tests/*" # accepts wildcards use-pycodestyle: false From 7f19b98ec2d3bc661c4fbfc9ac5120e975adbf36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 13:18:18 +0100 Subject: [PATCH 21/27] bugfix --- .github/workflows/all-lints.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/all-lints.yml b/.github/workflows/all-lints.yml index 357a36a..4b90a36 100644 --- a/.github/workflows/all-lints.yml +++ b/.github/workflows/all-lints.yml @@ -12,7 +12,7 @@ jobs: python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] steps: - uses: actions/checkout@v1 - - uses: marian-code/pyaction@master + - uses: marian-code/python-lint-annotate@master with: python-root-list: "./tests/*.py ./tests/subtest/*.py" use-black: true From 9b1801a87c0736d9d7ab5777a60e1ae1ef3778e7 Mon Sep 17 00:00:00 2001 From: marian-code Date: Mon, 6 Dec 2021 12:27:17 +0100 Subject: [PATCH 22/27] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 94b9389..a40bf74 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ jobs: - run: | python --version # this will output 3.9 now run tests or other things using python ... - - uses: marian-code/pyaction@v2 + - uses: marian-code/python-lint-annotate@v3 with: python-root-list: "./tests/*.py" use-black: true From e0561900a46684b41ef853a43c995a28a0bcb230 Mon Sep 17 00:00:00 2001 From: Nicolas Menard-Guy Date: Tue, 7 Jun 2022 19:31:08 -0400 Subject: [PATCH 23/27] Going back to default value before e3b43b1d9e0375a47832a23ef26db7765def80db --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index e05b9c2..5ec2538 100644 --- a/action.yml +++ b/action.yml @@ -7,7 +7,7 @@ inputs: python-root-list: description: "A list of all paths to test" required: false - default: "'./**/*.py'" + default: "." use-pylint: description: "Use Pylint" required: false From d8109ec07ec3d6ebb6f57ecd030f60c0d63995ec Mon Sep 17 00:00:00 2001 From: Nicolas Menard-Guy Date: Wed, 8 Jun 2022 13:08:43 -0400 Subject: [PATCH 24/27] Added an example actions.yml file --- README.md | 3 +++ examples/actions-only_changed_files.yml | 26 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 examples/actions-only_changed_files.yml diff --git a/README.md b/README.md index a40bf74..f1b3a49 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,9 @@ steps: python-version: "3.7" ``` +### Examples +* [Only lint changed files, and ignore missing docstrings](examples/actions-only_changed_files.yml) + ## Details Uses `actions/setup-python@v2`. Only python `3.6` - `3.10` version are tested since diff --git a/examples/actions-only_changed_files.yml b/examples/actions-only_changed_files.yml new file mode 100644 index 0000000..02209e4 --- /dev/null +++ b/examples/actions-only_changed_files.yml @@ -0,0 +1,26 @@ +name: Lint only files changed in Pull Request, and ignore Missing docstrings +on: + pull_request: + types: [ opened, reopened, synchronize, edited ] +jobs: + lint: + runs-on: ubuntu-latest + name: Lint + steps: + - name: Check out source repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 # This is necessary to get the commits + - name: Set up Python environment + uses: actions/setup-python@v3 + with: + python-version: "3.8" + - name: Get changed python files between base and head + run: > + echo "CHANGED_FILES=$(echo $(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} -- | grep \.py))" >> $GITHUB_ENV + - if: ${{ env.CHANGED_FILES }} + uses: marian-code/python-lint-annotate@v3 + with: + python-root-list: ${{ env.CHANGED_FILES }} + extra-pylint-options: "--disable=C0114,C0116" # Missing doctrings + extra-pydocstyle-options: "--ignore=D1" # Missing doctrings http://www.pydocstyle.org/en/stable/error_codes.html#grouping From cc4c8be195333803fa78f6bdf712fd7aa845ae38 Mon Sep 17 00:00:00 2001 From: Nicolas Menard-Guy Date: Wed, 15 Jun 2022 13:39:53 -0400 Subject: [PATCH 25/27] Updated mypy --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e2793cb..73b61ff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ black==21.11b1 flake8==4.0.1 isort==5.10.1 -mypy==0.910 +mypy~=0.961 pycodestyle==2.8.0 pydocstyle==6.1.1 pylint==2.12.1 From 11921337226ca5658c685dc55eaefc4a4d2e31a0 Mon Sep 17 00:00:00 2001 From: Nicolas Menard-Guy Date: Wed, 15 Jun 2022 14:08:46 -0400 Subject: [PATCH 26/27] Install stubs --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 16426b5..a18ead5 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -116,9 +116,9 @@ fi if [ "$6" = true ] ; then - echo Running: mypy --ignore-missing-imports --follow-imports=silent --show-column-numbers ${14} $1 + echo Running: mypy --install-types --non-interactive --ignore-missing-imports --follow-imports=silent --show-column-numbers ${14} $1 - mypy --ignore-missing-imports --follow-imports=silent --show-column-numbers ${14} $1 + mypy --install-types --non-interactive --ignore-missing-imports --follow-imports=silent --show-column-numbers ${14} $1 exit_code=$? if [ "$exit_code" = "0" ]; then From d6e7ca40ef185a810aef8f656461ea49a7fc5284 Mon Sep 17 00:00:00 2001 From: Nicolas Menard-Guy Date: Wed, 15 Jun 2022 14:26:13 -0400 Subject: [PATCH 27/27] Multiline command for readability --- entrypoint.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index a18ead5..0e84798 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -118,7 +118,11 @@ if [ "$6" = true ] ; then echo Running: mypy --install-types --non-interactive --ignore-missing-imports --follow-imports=silent --show-column-numbers ${14} $1 - mypy --install-types --non-interactive --ignore-missing-imports --follow-imports=silent --show-column-numbers ${14} $1 + mypy \ + --install-types --non-interactive \ + --ignore-missing-imports \ + --follow-imports=silent \ + --show-column-numbers ${14} $1 exit_code=$? if [ "$exit_code" = "0" ]; then