From b58ee7900886e2a2c50604f1c43b8268abad00a7 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sun, 7 Feb 2021 00:31:07 -0800 Subject: [PATCH] Fix CI workflow for Python linting The workflow was broken by the Python version it was using no longer being available from the actions/setup-python action. Rather than continuing in this fashion, it seems better to use the same setup script as is used by the action and unit tests. This will ensure everything is done under the same environment. --- .github/workflows/lint-python.yml | 18 +++++++++++------- compilesketches/.flake8 | 1 + 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/lint-python.yml b/.github/workflows/lint-python.yml index 17da1fc..1791f5a 100644 --- a/.github/workflows/lint-python.yml +++ b/.github/workflows/lint-python.yml @@ -32,19 +32,23 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: '3.8.6' + - name: Run the set up script + id: setup + run: | + "${{ github.workspace }}/action-setup.sh" - name: Install flake8 run: | - python -m pip install --upgrade pip - pip install --quiet flake8 - pip install --quiet pep8-naming + source "${{ steps.setup.outputs.python-venv-activate-script-path }}" + "${{ steps.setup.outputs.python-command }}" \ + -m \ + pip install \ + flake8 \ + pep8-naming - name: Lint with flake8 env: PYTHON_PROJECT_PATH: ${GITHUB_WORKSPACE}/compilesketches run: | + source "${{ steps.setup.outputs.python-venv-activate-script-path }}" flake8 --config "${{ env.PYTHON_PROJECT_PATH }}/.flake8" --show-source "${{ env.PYTHON_PROJECT_PATH }}" diff --git a/compilesketches/.flake8 b/compilesketches/.flake8 index 8f80241..ca383b0 100644 --- a/compilesketches/.flake8 +++ b/compilesketches/.flake8 @@ -1,5 +1,6 @@ [flake8] doctests = True +extend-exclude = .venv # W503 and W504 are mutually exclusive. PEP 8 recommends line break before. ignore = W503 max-complexity = 10