Skip to content

Commit

Permalink
actions: move lint checks into their own job
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-sanders committed Oct 31, 2023
1 parent 034157e commit a351f09
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 36 deletions.
77 changes: 44 additions & 33 deletions .github/workflows/test_fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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: |
Expand All @@ -48,37 +48,10 @@ 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: |
pytest cylc/flow
- name: Unit Tests
timeout-minutes: 4
run: |
pytest tests/unit
- name: Bandit
if: ${{ matrix.python-version == '3.7' }}
# https://github.com/PyCQA/bandit/issues/658
timeout-minutes: 5
run: |
bandit -r --ini .bandit cylc/flow
pytest cylc/flow tests/unit
- name: Integration Tests
timeout-minutes: 6
Expand All @@ -104,9 +77,47 @@ jobs:
path: coverage.xml
retention-days: 7

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

- name: Linkcheck
if: startsWith(matrix.python-version, '3.10')
run: pytest -m linkcheck --dist=load tests/unit
run: pytest -m linkcheck --dist=load --color=yes -n 10 tests/unit/test_links.py

codecov:
needs: test
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/scripts/test_cylc.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ 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'),
),
# 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'),
Expand All @@ -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=[],
Expand Down

0 comments on commit a351f09

Please sign in to comment.