Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust GitHub Actions CI/CD linters #7611

Merged
merged 4 commits into from
Feb 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 53 additions & 9 deletions .github/workflows/python-linters.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: Code quality
name: >-
🤖
Code quality
pradyunsg marked this conversation as resolved.
Show resolved Hide resolved

on:
push:
Expand All @@ -10,24 +12,49 @@ on:

jobs:
linters:
name: 🤖
name: >-
${{ matrix.env.TOXENV }}/${{ matrix.python-version }}@${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
# max-parallel: 5
matrix:
python-version:
- 3.8
os:
- ubuntu-18.04
- ubuntu-latest
- windows-latest
- macos-latest
env:
- TOXENV: docs
- TOXENV: lint
- TOXENV: vendoring

env:
TOX_PARALLEL_NO_SPINNER: 1

steps:
- uses: actions/checkout@master
- name: Set up Python ${{ matrix.env.PYTHON_VERSION || 3.8 }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.env.PYTHON_VERSION || 3.8 }}
python-version: ${{ matrix.python-version }}
- name: Log Python version
run: >-
python --version
- name: Log Python location
run: >-
which python
- name: Log Python env
run: >-
python -m sysconfig
Comment on lines +41 to +49
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'd prefer to merge these into one. Reasons detailed in a later comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(explained @ https://github.com/pypa/pip/pull/7611/files#r368251546) It's easier to inspect/separate outputs of different commands if each has a separate label. I think that for me it's coming from Ansible's best practices of always naming steps...

- name: Pip cache
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('tools/requirements/tests.txt') }}-${{ hashFiles('tools/requirements/docs.txt') }}-${{ hashFiles('tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: set PY
run: echo "::set-env name=PY::$(python -VV | sha256sum | cut -d' ' -f1)"
- uses: actions/cache@v1
Expand All @@ -38,16 +65,33 @@ jobs:
run: |
git config --global user.email "[email protected]"
git config --global user.name "pip"
- name: Update setuptools and tox dependencies
run: |
- name: Update setuptools
run: >-
python -m pip install --upgrade setuptools
- name: Install tox
run: >-
python -m pip install --upgrade tox tox-venv
- name: Log the list of packages
run: >-
python -m pip freeze --all
Comment on lines -41 to 76
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: These as a single bundle was probably nicer -- it's not really a cause for concern, but I don't think this information has ever been useful for most tasks and even when it is, the existing single bundle is named well enough to know where to look.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's mostly personal preference. But I've found out if there's separate distinct steps, it's easier to inspect logs.

- name: 'Initialize tox envs: ${{ matrix.env.TOXENV }}'
run: >-
python -m tox --notest --skip-missing-interpreters false
python -m
tox
--parallel auto
--notest
--skip-missing-interpreters false
env: ${{ matrix.env }}
- name: Pre-fetch pre-commit hooks
# This is to separate test step from deps install
if: matrix.env.TOXENV == 'lint'
run: >-
.tox/lint/${{ runner.os == 'Windows' && 'Scripts' || 'bin' }}/python -m
pre_commit
install-hooks
Comment on lines +85 to +91
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? pre-commit would do this on it's own on first run.

If it's not necessary, I'd rather that we drop it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good to separate install/init step from the actual test run because then it's clear what fails. It's the same as tox --notest + tox in a separate step.

- name: Test with tox
run: >-
python -m tox
python -m
tox
--parallel auto
env: ${{ matrix.env }}
14 changes: 7 additions & 7 deletions docs/html/development/ci.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ Current run tests
Developer tasks
---------------

======== =============== ================ =========== ============
OS docs lint vendoring packages
======== =============== ================ =========== ============
Linux Travis, Github Travis, Github Travis Azure
Windows Azure
MacOS Azure
======== =============== ================ =========== ============
======== =============== ================ ================== ============
OS docs lint vendoring packages
======== =============== ================ ================== ============
Linux Travis, Github Travis, Github Travis, Github Azure
Windows Azure
MacOS Azure
======== =============== ================ ================== ============

Actual testing
--------------
Expand Down
1 change: 1 addition & 0 deletions news/7611-gh-actions--linters-adjustment.trivial
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test vendoring lint target under GitHub Actions CI/CD.