Skip to content

Commit

Permalink
Merge pull request #7123 from drew2a/feature/divide_unittests
Browse files Browse the repository at this point in the history
Divide `pytest` into two categories: for a draft PR and for a ready PR
  • Loading branch information
drew2a authored Oct 31, 2022
2 parents 7b62733 + c1a1ba3 commit 0bb1eaf
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 25 deletions.
36 changes: 24 additions & 12 deletions .github/workflows/!PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,55 @@ on:
- ready_for_review

jobs:
coverage:
uses: ./.github/workflows/coverage.yml
with:
python-version: 3.8

# PR is Draft and PR is Ready
pytest:
uses: ./.github/workflows/pytest.yml
with:
python-version: 3.8
matrix: '{"os": ["ubuntu-latest"]}'

guitest:
uses: ./.github/workflows/guitest.yml
with:
python-version: 3.8
matrix: '{"os": ["windows-latest"]}'

scripttest:
uses: ./.github/workflows/scripttest.yml
with:
python-version: 3.8

guitest:
uses: ./.github/workflows/guitest.yml
coverage:
uses: ./.github/workflows/coverage.yml
with:
python-version: 3.8

documentation:
# PR is Ready only
pytest_ready:
if: github.event.pull_request.draft == false
uses: ./.github/workflows/documentation.yml
uses: ./.github/workflows/pytest.yml
with:
python-version: 3.8
matrix: '{"os": ["windows-latest", "macos-latest"]}'

ubuntu:
guitest_ready:
if: github.event.pull_request.draft == false
uses: ./.github/workflows/guitest.yml
with:
python-version: 3.8
matrix: '{"os": ["macos-latest", "ubuntu-latest"]}'

ubuntu_ready:
if: github.event.pull_request.draft == false
uses: ./.github/workflows/build_ubuntu.yml
with:
upload: false
os: ubuntu-20.04
python-version: 3.8

guitest_nix:
documentation_ready:
if: github.event.pull_request.draft == false
uses: ./.github/workflows/guitest.yml
uses: ./.github/workflows/documentation.yml
with:
python-version: 3.8
matrix: '{"os":["macos-latest","ubuntu-latest"]}'
1 change: 1 addition & 0 deletions .github/workflows/guitest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
run:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{fromJson(inputs.matrix)}}

steps:
Expand Down
29 changes: 17 additions & 12 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,17 @@ on:
type: string
required: false

matrix:
default: '{"os":["ubuntu-latest"]}'
type: string
required: false

jobs:
run:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
include:
- os: macos-latest
pytest-arguments: --timeout=300 --looptime
- os: windows-latest
pytest-arguments: --timeout=300
- os: ubuntu-latest
pytest-arguments: --timeout=60 --looptime
fail-fast: false
matrix: ${{fromJson(inputs.matrix)}}

steps:
- uses: actions/checkout@v3
Expand All @@ -35,11 +33,18 @@ jobs:
if: runner.os == 'Windows'
uses: ./.github/actions/windows_dependencies

- name: Run Pytest
- name: Run Pytest (nix)
if: runner.os != 'Windows'
timeout-minutes: 5
run: |
pytest ./src/tribler/core --exitfirst --disable-warnings ${{matrix.pytest-arguments}}
pytest ./src/tribler/core --exitfirst --disable-warnings --looptime
- name: Run Pytest (win)
if: runner.os == 'Windows'
timeout-minutes: 5
run: |
pytest ./src/tribler/core --exitfirst --disable-warnings
- name: Run Tunnels Tests
run: |
pytest ./src/tribler/core/components/tunnel/tests/test_full_session --tunneltests --exitfirst --disable-warnings ${{matrix.pytest-arguments}}
pytest ./src/tribler/core/components/tunnel/tests/test_full_session --tunneltests --exitfirst --disable-warnings
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[pytest]
timeout = 60
timeout = 300
;https://pypi.org/project/pytest-asyncio/
asyncio_mode = auto
log_level = INFO
Expand Down

0 comments on commit 0bb1eaf

Please sign in to comment.