@@ -10,32 +10,60 @@ jobs:
1010 name : Check tests
1111 runs-on : ${{ matrix.os }}
1212 env :
13+ # fix the python version and the operating system for codecoverage commentator
1314 USING_COVERAGE_PY : ' 3.8'
14- USING_COVERAGE_OS : ' macos-latest'
15+ USING_COVERAGE_OS : ' ubuntu-latest'
16+ outputs :
17+ # fix the results of pytest for unix
18+ output1 : ${{ steps.pytest.outputs.exit_code }}
1519
1620 strategy :
1721 matrix :
1822 os : ['ubuntu-latest', 'windows-latest', 'macos-latest']
1923 python-version : ['3.6', '3.7', '3.8', '3.9']
20- platform : ' x64 '
24+ # GitHub does not cancel all in-progress jobs if any matrix job fails
2125 fail-fast : false
2226
2327 steps :
24- - uses : actions/checkout@v2
25- - name : Set up Python ${{ matrix.python-version }}
26- uses : actions/setup-python@v2
27- with :
28- python-version : ${{ matrix.python-version }}
29- - name : Install dependencies and lints
30- run : pip install . -r test_requirements.txt -r requirements.txt
31- - name : Run PyTest
32- run : pytest | tee pytest-coverage.txt
33- - name : Comment coverage
34- if : contains(env.USING_COVERAGE_PY, matrix.python-version) && contains(env.USING_COVERAGE_OS, matrix.os)
35- 36- with :
37- pytest-coverage-path : ./pytest-coverage.txt
38- junitxml-path : ./pytest.xml
28+ - uses : actions/checkout@v2
29+ # Install python
30+ - name : Set up Python ${{ matrix.python-version }}
31+ uses : actions/setup-python@v2
32+ with :
33+ python-version : ${{ matrix.python-version }}
34+ # Update pip and install dependencies
35+ - name : Install dependencies
36+ run : |
37+ python -m pip install --upgrade pip
38+ pip install . -r test_requirements.txt -r requirements.txt
39+ # Pytest in windows
40+ - name : Run PyTest windows
41+ if : ${{ matrix.os == 'windows-latest' }}
42+ run : |
43+ pytest | tee pytest-coverage.txt
44+ # Pytest in unix. Exit code of this run captures the exit status of tee and not of pytest
45+ # So, use $PIPESTATUS that holds the exit status of each command in pipeline
46+ - name : Run PyTest unix
47+ if : ${{ matrix.os != 'windows-latest' }}
48+ id : pytest
49+ run : |
50+ pytest | tee pytest-coverage.txt;
51+ exit_code=${PIPESTATUS[0]};
52+ echo "::set-output name=exit_code::$exit_code"
53+ # Сomment on the results of the test coverage
54+ - name : Comment coverage
55+ if : contains(env.USING_COVERAGE_PY, matrix.python-version) && contains(env.USING_COVERAGE_OS, matrix.os)
56+ 57+ with :
58+ pytest-coverage-path : ./pytest-coverage.txt
59+ junitxml-path : ./pytest.xml
60+ # For unix workflow should have failed if exit code of pytest were 1
61+ - name : Check fail of pytest unix
62+ if : ${{ matrix.os != 'windows-latest' && steps.pytest.outputs.exit_code == 1 }}
63+ uses : actions/github-script@v3
64+ with :
65+ script : |
66+ core.setFailed('Some tests failed!')
3967
4068 check_sphinx_build :
4169 name : Check Sphinx build for docs
@@ -44,15 +72,15 @@ jobs:
4472 matrix :
4573 python-version : [3.8]
4674 steps :
47- - name : Checkout
48- uses : actions/checkout@v2
49- - name : Set up Python
50- uses : actions/setup-python@v2
51- with :
52- python-version : ${{ matrix.python-version }}
53- - name : Update pip
54- run : python -m pip install --upgrade pip
55- - name : Install dependencies
56- run : pip install -r docs/requirements.txt -r requirements.txt
57- - name : Run Sphinx
58- run : sphinx-build -W -b html docs /tmp/_docs_build
75+ - name : Checkout
76+ uses : actions/checkout@v2
77+ - name : Set up Python
78+ uses : actions/setup-python@v2
79+ with :
80+ python-version : ${{ matrix.python-version }}
81+ - name : Update pip and install dependencies
82+ run : |
83+ python -m pip install --upgrade pip
84+ pip install -r docs/requirements.txt -r requirements.txt
85+ - name : Run Sphinx
86+ run : sphinx-build -W -b html docs /tmp/_docs_build
0 commit comments