未验证 提交 f6457b7b 编写于 作者: P Pradyun Gedam 提交者: GitHub

Merge pull request #7954 from pradyunsg/simplify-linting-github-action

Simplify our Linting GitHub Action
name: >-
🤖
Code quality
name: Linting
on:
push:
pull_request:
schedule:
# Run every Friday at 18:02 UTC
# https://crontab.guru/#2_18_*_*_5
- cron: 2 18 * * 5
jobs:
linters:
name: >-
${{ matrix.env.TOXENV }}/${{ matrix.python-version }}@${{ matrix.os }}
runs-on: ${{ matrix.os }}
lint:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
env:
TOXENV: lint,docs,vendoring
strategy:
# max-parallel: 5
matrix:
python-version:
- 3.8
os:
- ubuntu-latest
- windows-latest
- macos-latest
env:
- TOXENV: docs
- TOXENV: lint
- TOXENV: vendoring
env:
TOX_PARALLEL_NO_SPINNER: 1
- Ubuntu
- Windows
- MacOS
steps:
- uses: actions/checkout@master
- name: Set up Python ${{ matrix.python-version }}
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
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
- name: Pip cache
python-version: 3.8
# Setup Caching
- name: pip cache
uses: actions/cache@v1
with:
path: ~/.cache/pip
......@@ -55,43 +37,18 @@ jobs:
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: set PY
- name: Set PY (for pre-commit cache)
run: echo "::set-env name=PY::$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')"
- uses: actions/cache@v1
- name: pre-commit cache
uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
key: pre-commit|2020-02-14|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Pre-configure global Git settings
run: |
git config --global user.email "pypa-dev@googlegroups.com"
git config --global user.name "pip"
- name: Update setuptools
run: >-
python -m pip install --upgrade setuptools
# Get the latest tox
- name: Install tox
run: >-
python -m pip install --upgrade tox tox-venv
- name: Log the list of packages
run: >-
python -m pip freeze --all
- name: 'Initialize tox envs: ${{ matrix.env.TOXENV }}'
run: >-
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
- name: Test with tox
run: >-
python -m
tox
--parallel auto
env: ${{ matrix.env }}
run: python -m pip install tox
# Main check
- run: python -m tox
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册