@@ -20,15 +20,33 @@ jobs:
20
20
fail-fast : false
21
21
22
22
steps :
23
+ - name : Checkout repo
24
+ uses : actions/checkout@v4
25
+
23
26
# install dependencies for all linters, then run the linter, so we don't get import failures when the linters scan the code
24
- # upgrade pip, so that we can install flake8_sarif_formatter properly from the git repo
25
- - uses : actions/checkout@v4
27
+ # not required, just makes the test cases a bit cleaner
26
28
- name : Install pip dependencies
29
+ if : ${{ ! ( runner.os == 'macOS' && matrix.python-version == '3.7' ) }}
27
30
run : |
28
- python3 -mpip install -q --upgrade pip
29
- python3 -mpip install -q flake8 pylint ruff mypy pytype pyright fixit pyre-check
30
- python3 -mpip install -q flake8-sarif-formatter
31
+ # deal with HomeBrew managed Python on GitHub Hosted MacOS runners
32
+ if [[ "${RUNNER_OS}" == "macOS" ]]; then
33
+ PIP_ARGS="--break-system-packages"
34
+ else
35
+ PIP_ARGS=""
36
+ fi
37
+ # upgrade pip, so that we can install flake8_sarif_formatter properly from the git repo
38
+ python3 -mpip install ${PIP_ARGS} -q --upgrade pip
39
+ # install packages one-by-one so it is clearer which fails, if it does
40
+ python_packages=('flake8' 'pylint' 'ruff' 'mypy' 'pytype' 'pyright' 'fixit' 'pyre-check' 'flake8-sarif-formatter')
41
+ for package in "${python_packages[@]}"; do
42
+ echo "Installing Python package ${package}"
43
+ if ! python3 -mpip install ${PIP_ARGS} -q "${package}"; then
44
+ echo "::warning::Failed to installed Python dependency ${package}, continuing"
45
+ fi
46
+ done
47
+
31
48
- name : Run Python Lint
49
+ if : ${{ ! ( runner.os == 'macOS' && matrix.python-version == '3.7' ) }}
32
50
uses : advanced-security/python-lint-code-scanning-action@main
33
51
with :
34
52
linter : ${{ matrix.linter }}
0 commit comments