diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml new file mode 100644 index 000000000..512969b0d --- /dev/null +++ b/.github/workflows/linting.yml @@ -0,0 +1,54 @@ +name: Linting + +on: + push: + pull_request: + schedule: + # Run every Friday at 18:02 UTC + - cron: 2 18 * * 5 + +jobs: + lint: + name: ${{ matrix.os }} + runs-on: ${{ matrix.os }}-latest + env: + TOXENV: lint,docs,vendoring + + strategy: + matrix: + os: + - Ubuntu + - Windows + - MacOS + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + + # Setup Caching + - 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 (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())')" + - 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') }} + + # Get the latest tox + - name: Install tox + run: python -m pip install tox + + # Main check + - run: python -m tox diff --git a/.github/workflows/python-linters.yml b/.github/workflows/python-linters.yml deleted file mode 100644 index d5124e226..000000000 --- a/.github/workflows/python-linters.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: >- - 🤖 - Code quality - -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 }} - 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 - - steps: - - uses: actions/checkout@master - - name: Set up Python ${{ matrix.python-version }} - 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 - 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 -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" - - 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 - - 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 }}