-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Github Actions CI - introduce codecov (#1844)
Co-authored-by: Sviatoslav Sydorenko <[email protected]>
- Loading branch information
1 parent
f72c697
commit 4b146e3
Showing
5 changed files
with
85 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ on: | |
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
|
@@ -19,7 +18,7 @@ jobs: | |
- uses: pre-commit/[email protected] | ||
|
||
test: | ||
name: ${{ matrix.os }} - ${{ matrix.py }} | ||
name: test ${{ matrix.py }} - ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }}-latest | ||
strategy: | ||
fail-fast: false | ||
|
@@ -32,44 +31,84 @@ jobs: | |
- 3.8 | ||
- 3.7 | ||
- 3.6 | ||
- 3.5 | ||
- pypy3 | ||
- 2.7 | ||
- pypy2 | ||
- pypy3 | ||
|
||
include: | ||
- {os: MacOs, py: brew@py3} | ||
- {os: MacOs, py: brew@py2} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: tox-dev/[email protected] | ||
with: | ||
python-version: ${{ matrix.py }} | ||
|
||
- name: install OS dependencies | ||
run: | | ||
${{ runner.os == 'Linux' && 'sudo apt-get update -y && sudo apt-get install fish csh' || true}} | ||
${{ runner.os == 'macOS' && 'brew update -vvv && brew install fish tcsh' || true}} | ||
${{ runner.os == 'Windows' && ( matrix.py == '2.7' || matrix.py == 'pypy2' ) && 'choco install vcpython27 --yes -f' || true }} | ||
shell: bash | ||
- name: setup python for tox | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: install tox | ||
run: python -m pip install tox | ||
- uses: actions/checkout@v2 | ||
- name: use local virtualenv for tox | ||
run: python -m pip install ${{ runner.os == 'Windows' && matrix.py == 'pypy3' && 'virtualenv<20' || '.'}} | ||
- name: setup python for test ${{ matrix.py }} | ||
if: "!startsWith(matrix.py,'brew@py')" | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.py }} | ||
- name: setup test suite for ${{ matrix.os }}-${{ matrix.py }} | ||
run: tox -vve py --notest | ||
- name: run test suite for ${{ matrix.os }}-${{ matrix.py }} | ||
run: tox -e py | ||
- name: load python from ${{ matrix.py }} | ||
if: startsWith(matrix.py,'brew@py') | ||
run: | | ||
import os; import subprocess | ||
version = "${{matrix.py}}"[-1] | ||
subprocess.check_call(["brew", "install", f"python@{version}"]) | ||
print(f'::add-path::/usr/local/opt/python@{version}') | ||
shell: python | ||
- name: pick environment to run | ||
run: | | ||
import subprocess; import json | ||
major, minor, impl = json.loads(subprocess.check_output(["python", "-c", "import json; import sys; import platform; print(json.dumps([sys.version_info[0], sys.version_info[1], platform.python_implementation()]));"], universal_newlines=True)) | ||
print('::set-env name=TOXENV::' + ("py" if impl == "CPython" else "pypy") + ("{}{}".format(major, minor) if impl == "CPython" else ("3" if major == 3 else ""))) | ||
shell: python | ||
- name: setup test suite | ||
run: tox -vv --notest | ||
- name: run test suite | ||
run: tox | ||
env: | ||
PYTEST_ADDOPTS: "-vv --durations=20" | ||
CI_RUN: 'yes' | ||
DIFF_AGAINST: HEAD | ||
- name: rename coverage report file | ||
run: | | ||
import os; os.rename('.tox/coverage.{}.xml'.format(os.environ['TOXENV']), '.tox/coverage.xml') | ||
shell: python | ||
- uses: codecov/codecov-action@v1 | ||
with: | ||
file: ./.tox/coverage.xml | ||
flags: tests | ||
name: ${{ matrix.py }} - ${{ matrix.os }} | ||
|
||
check: | ||
name: check ${{ matrix.tox_env }} | ||
runs-on: Ubuntu-latest | ||
name: check ${{ matrix.tox_env }} - ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }}-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- Ubuntu | ||
- Windows | ||
tox_env: | ||
- dev | ||
- docs | ||
- readme | ||
- upgrade | ||
- dev | ||
- zipapp | ||
- docs | ||
|
||
exclude: | ||
- {os: Windows, tox_env: readme} | ||
- {os: Windows, tox_env: docs} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: setup Python 3.8 | ||
|
@@ -80,3 +119,5 @@ jobs: | |
run: python -m pip install tox | ||
- name: run check for ${{ matrix.tox_env }} | ||
run: python -m tox -e ${{ matrix.tox_env }} | ||
env: | ||
UPGRADE_ADVISORY: 'yes' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
coverage: | ||
range: "80...100" | ||
coverage: | ||
status: | ||
patch: false | ||
changes: false | ||
project: | ||
default: | ||
target: '80' | ||
|
||
comment: | ||
layout: "diff, files" | ||
behavior: default | ||
require_changes: no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters