Skip to content

Commit

Permalink
Merge pull request #7748 from Tribler/feature/AT_to_PR
Browse files Browse the repository at this point in the history
Add the Application Tester to the PR checks
  • Loading branch information
drew2a committed Dec 6, 2023
2 parents b15b079 + 83a44a1 commit 9f57321
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 29 deletions.
19 changes: 19 additions & 0 deletions .github/actions/add-pythonpath/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Add to PYTHONPATH'
description: 'Add specified paths to PYTHONPATH for all supported OS'
inputs:
path:
description: 'Path to be added to PYTHONPATH'
required: true

runs:
using: "composite"
steps:
- name: Add to PYTHONPATH on Linux or macOS
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
shell: bash
run: echo "PYTHONPATH=${{ inputs.path }}:$PYTHONPATH" >> $GITHUB_ENV

- name: Add to PYTHONPATH on Windows
if: ${{ runner.os == 'Windows' }}
shell: pwsh
run: echo "PYTHONPATH=${{ inputs.path }};$env:PYTHONPATH" | Out-String | Add-Content -Path $env:GITHUB_ENV
26 changes: 22 additions & 4 deletions .github/workflows/!PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:

# ----------------------------------------------------------------------------
# PR stage: Draft
coverage:
coverage_draft:
needs: [ changes, gatekeeper, env ]
if: ${{ needs.changes.outputs.src == 'true' }}
uses: ./.github/workflows/coverage.yml
Expand All @@ -93,7 +93,7 @@ jobs:
python-version: ${{needs.env.outputs.python-version}}
ref: ${{needs.env.outputs.source-ref}}

guitest:
guitest_draft:
needs: [ changes, gatekeeper, env ]
if: ${{ needs.changes.outputs.src == 'true' }}
uses: ./.github/workflows/guitest.yml
Expand All @@ -102,7 +102,16 @@ jobs:
matrix: '{"os": ["windows-latest"]}'
ref: ${{needs.env.outputs.source-ref}}

scripttest:
application_tester_draft:
needs: [ changes, gatekeeper, env ]
if: ${{ needs.changes.outputs.src == 'true' || needs.changes.outputs.scripts == 'true'}}
uses: ./.github/workflows/application_tester.yml
with:
python-version: ${{needs.env.outputs.python-version}}
matrix: '{"os": ["ubuntu-latest"]}'
ref: ${{needs.env.outputs.source-ref}}

scripttest_draft:
needs: [ changes, gatekeeper, env ]
if: ${{ needs.changes.outputs.scripts == 'true' }}
uses: ./.github/workflows/scripttest.yml
Expand All @@ -122,7 +131,7 @@ jobs:
matrix: '{"os": ["windows-latest", "macos-latest"]}'
ref: ${{needs.env.outputs.source-ref}}

guitest_nix:
guitest:
needs: [ changes, gatekeeper, env ]
if: ${{needs.changes.outputs.src == 'true' && !github.event.pull_request.draft}}
uses: ./.github/workflows/guitest.yml
Expand All @@ -131,6 +140,15 @@ jobs:
matrix: '{"os": ["ubuntu-latest", "macos-latest"]}'
ref: ${{needs.env.outputs.source-ref}}

application_tester:
needs: [ changes, gatekeeper, env ]
if: ${{ (needs.changes.outputs.src == 'true' || needs.changes.outputs.scripts == 'true') && !github.event.pull_request.draft}}
uses: ./.github/workflows/application_tester.yml
with:
python-version: ${{needs.env.outputs.python-version}}
matrix: '{"os": ["windows-latest", "macos-latest"]}'
ref: ${{needs.env.outputs.source-ref}}

# build binaries
ubuntu:
needs: [ changes, env ]
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/application_tester.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: GUI test

on:
workflow_call:
inputs:
python-version:
default: 3.8
type: string
required: false

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

ref:
default: ${{ github.ref }}
type: string
required: false

permissions:
contents: read

jobs:
run:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{fromJson(inputs.matrix)}}

defaults:
run:
shell: bash

timeout-minutes: 10

steps:
- uses: actions/checkout@v3
with:
ref: ${{inputs.ref}}

- name: Create python environment
uses: ./.github/actions/pyenv
with:
python-version: ${{inputs.python-version}}
requirements: requirements.txt
custom_cache_key_element: ${{inputs.ref}}

- name: Add Tribler to PYTHONPATH
uses: ./.github/actions/add-pythonpath
with:
path: ./src

- name: Add Application Tester to PYTHONPATH
uses: ./.github/actions/add-pythonpath
with:
path: ./scripts/application_tester

- name: Install dependencies (Win)
if: runner.os == 'Windows'
uses: ./.github/actions/windows_dependencies

- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt install pyqt5-dev-tools
- name: Setup headless display (Linux)
if: runner.os == 'Linux'
uses: pyvista/setup-headless-display-action@v1

- name: Application Tester
timeout-minutes: 5
env:
CORE_API_PORT: 20100
run: |
python ./scripts/application_tester/main.py -p "python src/run_tribler.py" --fragile -d 120
27 changes: 3 additions & 24 deletions .github/workflows/scripttest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,9 @@ jobs:
custom_cache_key_element: ${{inputs.ref}}

- name: Add Tribler to PYTHONPATH
run: |
echo "PYTHONPATH=${PYTHONPATH}:./src" >> $GITHUB_ENV
- name: Add Application Tester to PYTHONPATH
run: |
echo "PYTHONPATH=${PYTHONPATH}:./scripts/application_tester" >> $GITHUB_ENV
uses: ./.github/actions/add-pythonpath
with:
path: ./src

- name: run_bandwidth_crawler.py
uses: ./.github/actions/timeout
Expand All @@ -60,24 +57,6 @@ jobs:
command: python ./scripts/exit_node/run_exit_node.py --testnet --fragile
duration: ${{inputs.duration}}

# install QT Linux dependencies and Headless Display for the correct work of the Application Tester
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt install pyqt5-dev-tools
- name: Setup headless display (Linux)
if: runner.os == 'Linux'
uses: pyvista/setup-headless-display-action@v1

- name: Application Tester
timeout-minutes: 1
env:
CORE_API_PORT: 20100
run: |
python ./scripts/application_tester/main.py -p "python src/run_tribler.py" --fragile -d 20
#experiments

- name: hidden_peer_discovery.py
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def __init__(self):
'screenshot': (lambda: ScreenshotAction(), 5),
'start_vod': (lambda: StartVODAction(), 5),
'change_anonymity': (lambda: ChangeAnonymityAction(allow_plain=True), 5),
'change_download_files': (lambda: ChangeDownloadFilesAction(), 10)
# See: https://github.com/Tribler/tribler/issues/7750
# 'change_download_files': (lambda: ChangeDownloadFilesAction(), 10)
}

def get_random_action_with_probability(self) -> Optional[Action]:
Expand Down

0 comments on commit 9f57321

Please sign in to comment.