From 8151e7019394d13c2da922939377ea2036e2c28e Mon Sep 17 00:00:00 2001 From: Oliver Sanders Date: Thu, 26 Oct 2023 10:54:01 +0100 Subject: [PATCH] actions: move lint checks into their own job --- .github/workflows/test_fast.yml | 65 +++++++++++++++++++++------------ tests/unit/scripts/test_cylc.py | 6 +-- 2 files changed, 44 insertions(+), 27 deletions(-) diff --git a/.github/workflows/test_fast.yml b/.github/workflows/test_fast.yml index d0bff50326d..f7c8821b79d 100644 --- a/.github/workflows/test_fast.yml +++ b/.github/workflows/test_fast.yml @@ -17,7 +17,7 @@ jobs: runs-on: ${{ matrix.os }} timeout-minutes: 20 strategy: - fail-fast: false # Don't let a failed MacOS run stop the Ubuntu runs + fail-fast: false # don't stop on first failure matrix: os: ['ubuntu-latest'] python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] @@ -39,7 +39,7 @@ jobs: if: startsWith(matrix.os, 'ubuntu') run: | sudo apt-get update - sudo apt-get install -y shellcheck sqlite3 + sudo apt-get install -y sqlite3 - name: Install run: | @@ -48,22 +48,6 @@ jobs: - name: Configure git # Needed by the odd test uses: cylc/release-actions/configure-git@v1 - - name: Check changelog - if: startsWith(matrix.os, 'ubuntu') - run: towncrier build --draft - - - name: Style - if: startsWith(matrix.os, 'ubuntu') - run: | - flake8 - etc/bin/shellchecker - - # note: exclude python 3.10+ from mypy checks as these produce false - # positives in installed libraries for python 3.7 - - name: Typing - if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.python-version, 3.9) - run: mypy - - name: Doctests timeout-minutes: 4 run: | @@ -74,12 +58,6 @@ jobs: run: | pytest tests/unit - - name: Bandit - if: ${{ matrix.python-version == '3.7' }} - # https://github.com/PyCQA/bandit/issues/658 - run: | - bandit -r --ini .bandit cylc/flow - - name: Integration Tests timeout-minutes: 6 run: | @@ -108,6 +86,45 @@ jobs: if: startsWith(matrix.python-version, '3.10') run: pytest -m linkcheck --dist=load tests/unit + lint: + runs-on: 'ubuntu-latest' + timeout-minutes: 10 + steps: + - name: Apt-Get Install + run: | + sudo apt-get update + sudo apt-get install -y shellcheck + + - name: Checkout + uses: actions/checkout@v4 + + # note: exclude python 3.10+ from mypy checks as these produce false + # positives in installed libraries for python 3.7 + - name: Configure Python + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Install + run: | + pip install -e ."[tests]" + + - name: Flake8 + run: flake8 + + - name: Bandit + run: | + bandit -r --ini .bandit cylc/flow + + - name: Shellchecker + run: etc/bin/shellchecker + + - name: MyPy + run: mypy + + - name: Towncrier + run: towncrier build --draft + codecov: needs: test runs-on: ubuntu-latest diff --git a/tests/unit/scripts/test_cylc.py b/tests/unit/scripts/test_cylc.py index 4b844dafdc7..819583a296c 100644 --- a/tests/unit/scripts/test_cylc.py +++ b/tests/unit/scripts/test_cylc.py @@ -45,7 +45,7 @@ def _mocked_entry_points(include_bad: bool = False): # an entry point with all dependencies installed: 'good': SimpleNamespace( name='good', - module_name='os.path', + module='os.path', load=_resolve_ok, extras=[], dist=SimpleNamespace(name='a'), @@ -53,7 +53,7 @@ def _mocked_entry_points(include_bad: bool = False): # an entry point with optional dependencies missing: 'missing': SimpleNamespace( name='missing', - module_name='not.a.python.module', # force an import error + module='not.a.python.module', # force an import error load=_load_fail, extras=[], dist=SimpleNamespace(name='foo'), @@ -64,7 +64,7 @@ def _mocked_entry_points(include_bad: bool = False): # missing: commands['bad'] = SimpleNamespace( name='bad', - module_name='not.a.python.module', + module='not.a.python.module', load=_load_fail, require=_require_ok, extras=[],