Skip to content

Commit

Permalink
Replace .env file with action
Browse files Browse the repository at this point in the history
  • Loading branch information
drew2a committed Jul 19, 2023
1 parent 455ad3a commit 48506e0
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 80 deletions.
35 changes: 35 additions & 0 deletions .github/actions/env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: env
description: Construct env for each operating system
runs:
using: 'composite'
steps:
- shell: bash
run: |
cat >> $GITHUB_ENV << EOF
XDIST_ARGUMENTS=-n auto
PYTEST_ARGUMENTS=--randomly-seed=1 --disable-warnings --reruns 1 --reruns-delay 1 --verbose --durations=3 --showlocals
EOF
- shell: bash
run: |
cat >> $GITHUB_ENV << EOF
PYTEST_CORE_ARGUMENTS=./src/tribler/core ${PYTEST_ARGUMENTS}
PYTEST_TUNNELS_ARGUMENTS=./src/tribler/core/components/tunnel/tests/test_full_session --tunneltests ${PYTEST_ARGUMENTS}
PYTEST_GUI_ARGUMENTS=./src/tribler/gui --guitests ${PYTEST_ARGUMENTS}
EOF
- if: runner.os == 'Linux' || runner.os == 'macOS'
shell: bash
run: |
cat >> $GITHUB_ENV << EOF
PYTEST_CORE_ARGUMENTS=${PYTEST_CORE_ARGUMENTS} --looptime
PYTEST_TUNNELS_ARGUMENTS=${PYTEST_TUNNELS_ARGUMENTS} --looptime
PYTEST_GUI_ARGUMENTS=${PYTEST_GUI_ARGUMENTS} --looptime
EOF
- if: runner.os == 'Linux'
shell: bash
run: |
cat >> $GITHUB_ENV << EOF
XDIST_ARGUMENTS=--tx "2*popen//execmodel=eventlet"
EOF
9 changes: 3 additions & 6 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,13 @@ jobs:
custom_cache_key_element: ${{inputs.ref}}

- name: Export env
uses: cardinalby/export-env-action@v2
with:
envFile: ./.github/workflows/vars/pytest.env
expand: true
uses: ./.github/actions/env

- name: Run Pytest with Coverage
timeout-minutes: 10
run: |
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 run --source=./src/tribler/core -p -m pytest "${PYTEST_CORE_ARGUMENTS} {XDIST_ARGUMENTS}"
coverage run --source=./src/tribler/core -p -m pytest "${PYTEST_TUNNELS_ARGUMENTS} {XDIST_ARGUMENTS}"
coverage combine
coverage xml
Expand Down
20 changes: 3 additions & 17 deletions .github/workflows/guitest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,11 @@ jobs:
uses: pyvista/setup-headless-display-action@v1

- name: Export env
uses: cardinalby/export-env-action@v2
with:
envFile: ./.github/workflows/vars/pytest.env
expand: true

- name: Run GUI tests (Win)
if: runner.os == 'Windows'
run: |
pytest ${PYTEST_GUI_ARGUMENTS_WIN}
- name: Run GUI tests (Linux)
if: runner.os == 'Linux'
run: |
pytest ${PYTEST_GUI_ARGUMENTS_LINUX}
uses: ./.github/actions/env

- name: Run GUI tests (Mac)
if: runner.os == 'macOS'
- name: Run GUI tests
run: |
pytest ${PYTEST_GUI_ARGUMENTS_MAC}
pytest ${PYTEST_GUI_ARGUMENTS}
- uses: actions/upload-artifact@v3
if: always()
Expand Down
26 changes: 5 additions & 21 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
env:
PYTEST_SENTRY_DSN: ${{secrets.PYTEST_SENTRY_DSN}}

timeout-minutes: 10
timeout-minutes: 8

steps:
- uses: actions/checkout@v3
Expand All @@ -58,25 +58,9 @@ jobs:
uses: ./.github/actions/windows_dependencies

- name: Export env
uses: cardinalby/export-env-action@v2
with:
envFile: ./.github/workflows/vars/pytest.env
expand: true

- name: Run Pytest (Win)
if: runner.os == 'Windows'
run: |
pytest ${PYTEST_CORE_ARGUMENTS_WIN}
pytest ${PYTEST_TUNNELS_ARGUMENTS_WIN}
- name: Run Pytest (Linux)
if: runner.os == 'Linux'
run: |
pytest ${PYTEST_CORE_ARGUMENTS_LINUX}
pytest ${PYTEST_TUNNELS_ARGUMENTS_LINUX}
uses: ./.github/actions/env

- name: Run Pytest (Mac)
if: runner.os == 'macOS'
- name: Run Pytest
run: |
pytest ${PYTEST_CORE_ARGUMENTS_MAC}
pytest ${PYTEST_TUNNELS_ARGUMENTS_MAC}
pytest ${PYTEST_CORE_ARGUMENTS} ${XDIST_ARGUMENTS}
pytest ${PYTEST_TUNNELS_ARGUMENTS} ${XDIST_ARGUMENTS}
24 changes: 4 additions & 20 deletions .github/workflows/pytest_custom_ipv8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,9 @@ jobs:
uses: ./.github/actions/windows_dependencies

- name: Export env
uses: cardinalby/export-env-action@v2
with:
envFile: ./.github/workflows/vars/pytest.env
expand: true

- name: Run Pytest (Win)
if: runner.os == 'Windows'
run: |
pytest ${PYTEST_CORE_ARGUMENTS_WIN}
pytest ${PYTEST_TUNNELS_ARGUMENTS_WIN}
- name: Run Pytest (Linux)
if: runner.os == 'Linux'
run: |
pytest ${PYTEST_CORE_ARGUMENTS_LINUX}
pytest ${PYTEST_TUNNELS_ARGUMENTS_LINUX}
uses: ./.github/actions/env

- name: Run Pytest (Mac)
if: runner.os == 'macOS'
- name: Run Pytest
run: |
pytest ${PYTEST_CORE_ARGUMENTS_MAC}
pytest ${PYTEST_TUNNELS_ARGUMENTS_MAC}
pytest ${PYTEST_CORE_ARGUMENTS}
pytest ${PYTEST_TUNNELS_ARGUMENTS}
16 changes: 0 additions & 16 deletions .github/workflows/vars/pytest.env

This file was deleted.

0 comments on commit 48506e0

Please sign in to comment.