Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring GitHub Actions related to pytest #7509

Merged
merged 1 commit into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 0 additions & 58 deletions .github/actions/profile/action.yml

This file was deleted.

10 changes: 2 additions & 8 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,11 @@ jobs:
envFile: ./.github/workflows/vars/pytest.env
expand: true

- name: Add --looptime
if: runner.os != 'Windows'
run: |
echo "PYTEST_CORE_ARGUMENTS=${PYTEST_CORE_ARGUMENTS} --looptime" >> $GITHUB_ENV
echo "PYTEST_TUNNELS_ARGUMENTS=${PYTEST_TUNNELS_ARGUMENTS} --looptime" >> $GITHUB_ENV

- name: Run Pytest with Coverage
timeout-minutes: 10
run: |
coverage run --source=./src/tribler/core -p -m pytest ${PYTEST_CORE_ARGUMENTS}
coverage run --source=./src/tribler/core -p -m pytest ${PYTEST_TUNNELS_ARGUMENTS}
coverage run --source=./src/tribler/core -p -m pytest ${PYTEST_CORE_ARGUMENTS_LINUX}
coverage run --source=./src/tribler/core -p -m pytest ${PYTEST_TUNNELS_ARGUMENTS_LINUX}
coverage combine
coverage xml

Expand Down
27 changes: 10 additions & 17 deletions .github/workflows/guitest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ on:
type: string
required: false

enable-profiling:
default: false
type: boolean
required: false

ref:
default: ${{ github.ref }}
type: string
Expand Down Expand Up @@ -78,22 +73,20 @@ jobs:
envFile: ./.github/workflows/vars/pytest.env
expand: true

- name: Add --looptime
if: runner.os != 'Windows'
- name: Run GUI tests (Win)
if: runner.os == 'Windows'
run: |
echo "PYTEST_GUI_ARGUMENTS=${PYTEST_GUI_ARGUMENTS} --looptime" >> $GITHUB_ENV
pytest ${PYTEST_GUI_ARGUMENTS_WIN}

- name: Run GUI tests
if: ${{!inputs.enable-profiling}}
- name: Run GUI tests (Linux)
if: runner.os == 'Linux'
run: |
pytest ${PYTEST_GUI_ARGUMENTS}
pytest ${PYTEST_GUI_ARGUMENTS_LINUX}

- name: Run GUI tests (Profiler)
if: ${{inputs.enable-profiling}}
uses: ./.github/actions/profile
with:
artifact_name: guitests_prof.svg
arguments: ${PYTEST_GUI_ARGUMENTS}
- name: Run GUI tests (Mac)
if: runner.os == 'macOS'
run: |
pytest ${PYTEST_GUI_ARGUMENTS_MAC}

- uses: actions/upload-artifact@v3
if: always()
Expand Down
41 changes: 12 additions & 29 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ on:
type: string
required: false

enable_profiling:
default: false
type: boolean
required: false

ref:
default: ${{ github.ref }}
type: string
Expand Down Expand Up @@ -68,32 +63,20 @@ jobs:
envFile: ./.github/workflows/vars/pytest.env
expand: true

- name: Add --looptime
if: runner.os != 'Windows'
- name: Run Pytest (Win)
if: runner.os == 'Windows'
run: |
echo "PYTEST_CORE_ARGUMENTS=${PYTEST_CORE_ARGUMENTS} --looptime" >> $GITHUB_ENV
echo "PYTEST_TUNNELS_ARGUMENTS=${PYTEST_TUNNELS_ARGUMENTS} --looptime" >> $GITHUB_ENV
pytest ${PYTEST_CORE_ARGUMENTS_WIN}
pytest ${PYTEST_TUNNELS_ARGUMENTS_WIN}

- name: Run Pytest
if: ${{!inputs.enable_profiling}}
- name: Run Pytest (Linux)
if: runner.os == 'Linux'
run: |
pytest ${PYTEST_CORE_ARGUMENTS}
pytest ${PYTEST_CORE_ARGUMENTS_LINUX}
pytest ${PYTEST_TUNNELS_ARGUMENTS_LINUX}

- name: Run Pytest (Profiler)
if: ${{inputs.enable_profiling}}
uses: ./.github/actions/profile
with:
artifact_name: pytest_prof.svg
arguments: ${PYTEST_CORE_ARGUMENTS}

- name: Run Tunnels Tests
if: ${{!inputs.enable_profiling}}
- name: Run Pytest (Mac)
if: runner.os == 'macOS'
run: |
pytest ${PYTEST_TUNNELS_ARGUMENTS}

- name: Run Tunnel Tests (Profiler)
if: ${{inputs.enable_profiling}}
uses: ./.github/actions/profile
with:
artifact_name: tunneltest_prof.svg
arguments: ${PYTEST_TUNNELS_ARGUMENTS}
pytest ${PYTEST_CORE_ARGUMENTS_MAC}
pytest ${PYTEST_TUNNELS_ARGUMENTS_MAC}
22 changes: 12 additions & 10 deletions .github/workflows/pytest_custom_ipv8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,20 @@ jobs:
envFile: ./.github/workflows/vars/pytest.env
expand: true

- name: Add --looptime
if: runner.os != 'Windows'
- name: Run Pytest (Win)
if: runner.os == 'Windows'
run: |
echo "PYTEST_CORE_ARGUMENTS=${PYTEST_CORE_ARGUMENTS} --looptime" >> $GITHUB_ENV
echo "PYTEST_TUNNELS_ARGUMENTS=${PYTEST_TUNNELS_ARGUMENTS} --looptime" >> $GITHUB_ENV
pytest ${PYTEST_CORE_ARGUMENTS_WIN}
pytest ${PYTEST_TUNNELS_ARGUMENTS_WIN}

- name: Run Pytest
if: ${{!inputs.enable_profiling}}
- name: Run Pytest (Linux)
if: runner.os == 'Linux'
run: |
pytest ${PYTEST_CORE_ARGUMENTS}
pytest ${PYTEST_CORE_ARGUMENTS_LINUX}
pytest ${PYTEST_TUNNELS_ARGUMENTS_LINUX}

- name: Run Tunnels Tests
if: ${{!inputs.enable_profiling}}
- name: Run Pytest (Mac)
if: runner.os == 'macOS'
run: |
pytest ${PYTEST_TUNNELS_ARGUMENTS}
pytest ${PYTEST_CORE_ARGUMENTS_MAC}
pytest ${PYTEST_TUNNELS_ARGUMENTS_MAC}
19 changes: 15 additions & 4 deletions .github/workflows/vars/pytest.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
PYTEST_COMMON_ARGUMENTS='--randomly-seed=1 --disable-warnings --reruns 1 --reruns-delay 1 --verbose --durations=3'
PYTEST_ARGUMENTS='--randomly-seed=1 --disable-warnings --reruns 1 --reruns-delay 1 --verbose --durations=3'

PYTEST_CORE_ARGUMENTS='./src/tribler/core ${PYTEST_COMMON_ARGUMENTS}'
PYTEST_TUNNELS_ARGUMENTS='./src/tribler/core/components/tunnel/tests/test_full_session --tunneltests ${PYTEST_COMMON_ARGUMENTS}'
PYTEST_GUI_ARGUMENTS='./src/tribler/gui --guitests ${PYTEST_COMMON_ARGUMENTS}'
PYTEST_CORE_ARGUMENTS='./src/tribler/core ${PYTEST_ARGUMENTS}'
PYTEST_CORE_ARGUMENTS_WIN='${PYTEST_CORE_ARGUMENTS}'
PYTEST_CORE_ARGUMENTS_LINUX='${PYTEST_CORE_ARGUMENTS} --looptime'
PYTEST_CORE_ARGUMENTS_MAC='${PYTEST_CORE_ARGUMENTS} --looptime'

PYTEST_TUNNELS_ARGUMENTS='./src/tribler/core/components/tunnel/tests/test_full_session --tunneltests ${PYTEST_ARGUMENTS}'
PYTEST_TUNNELS_ARGUMENTS_WIN='${PYTEST_TUNNELS_ARGUMENTS}'
PYTEST_TUNNELS_ARGUMENTS_LINUX='${PYTEST_TUNNELS_ARGUMENTS} --looptime'
PYTEST_TUNNELS_ARGUMENTS_MAC='${PYTEST_TUNNELS_ARGUMENTS} --looptime'

PYTEST_GUI_ARGUMENTS='./src/tribler/gui --guitests ${PYTEST_ARGUMENTS}'
PYTEST_GUI_ARGUMENTS_WIN='${PYTEST_GUI_ARGUMENTS}'
PYTEST_GUI_ARGUMENTS_LINUX='${PYTEST_GUI_ARGUMENTS} --looptime'
PYTEST_GUI_ARGUMENTS_MAC='${PYTEST_GUI_ARGUMENTS} --looptime'