diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 9ebc62d5..5be7a45e 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -13,19 +13,19 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: [3.7, 3.8] + python-version: ["3.7", "3.8", "3.9", "3.10"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Cache Python packages - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('setup.py') }} restore-keys: | ${{ runner.os }}-py${{ matrix.python-version }}-pip- - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - name: Install gfortran # required by camb @@ -37,17 +37,24 @@ jobs: python -m pip install --upgrade pip pip install wheel pip install .[full] + - name: Get changed python files + id: changed_python_files + uses: tj-actions/changed-files@v20 + with: + files: "*.py" - name: Lint with flake8 + if: steps.changed_python_files.outputs.any_changed == 'true' run: | pip install flake8 # stop the build if there are Python syntax errors or undefined names - flake8 descqa descqagen descqaweb descqarun tests --count --select=E9,F63,F7,F82 --show-source --statistics + flake8 ${{ steps.changed_python_files.outputs.all_changed_and_modified_files }} --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 descqa descqagen descqaweb descqarun tests --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + flake8 ${{ steps.changed_python_files.outputs.all_changed_and_modified_files }} --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Lint with pylint + if: steps.changed_python_files.outputs.any_changed == 'true' run: | pip install pylint - pylint --disable=all --enable=F,E,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode --extension-pkg-whitelist=numpy descqa descqagen descqaweb descqarun + pylint --disable=all --enable=F,E,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode --extension-pkg-whitelist=numpy ${{ steps.changed_python_files.outputs.all_changed_and_modified_files }} - name: Test with pytest run: | pip install pytest