Skip to content

Commit

Permalink
Add gatekeeper.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
drew2a committed Nov 21, 2022
1 parent 2b79841 commit e42d463
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 116 deletions.
138 changes: 69 additions & 69 deletions .github/workflows/!PR.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: PR

on:
pull_request:
types:
- opened
- synchronize
- ready_for_review
workflow_run:
workflows: [ gatekeeper ]
types: [ completed ]

jobs:
changes: # detect changes
Expand Down Expand Up @@ -52,70 +50,72 @@ jobs:
needs: changes
if: ${{ needs.changes.outputs.src == 'true' }}
uses: ./.github/workflows/pytest.yml
secrets:
PYTEST_SENTRY_DSN: ${{github.event.workflow_run.gatekeeper.outputs.pytest-sentry-dsn}}
with:
python-version: 3.8
matrix: '{"os": ["windows-latest"]}'

guitest:
needs: changes
if: ${{ needs.changes.outputs.src == 'true' }}
uses: ./.github/workflows/guitest.yml
with:
python-version: 3.8
matrix: '{"os": ["windows-latest"]}'

scripttest:
needs: changes
if: ${{ needs.changes.outputs.scripts == 'true' }}
uses: ./.github/workflows/scripttest.yml
with:
python-version: 3.8

coverage:
needs: changes
if: ${{ needs.changes.outputs.src == 'true' }}
uses: ./.github/workflows/coverage.yml
with:
python-version: 3.8

# PR is Ready only
pytest_nix:
needs: changes
if: ${{needs.changes.outputs.src == 'true' && !github.event.pull_request.draft}}
uses: ./.github/workflows/pytest.yml
with:
python-version: 3.8
matrix: '{"os": ["macos-latest", "ubuntu-latest"]}'

guitest_nix:
needs: changes
if: ${{needs.changes.outputs.src == 'true' && !github.event.pull_request.draft}}
uses: ./.github/workflows/guitest.yml
with:
python-version: 3.8
matrix: '{"os": ["macos-latest", "ubuntu-latest"]}'

ubuntu:
needs: changes
if: ${{needs.changes.outputs.build == 'true' && !github.event.pull_request.draft}}
uses: ./.github/workflows/build_ubuntu.yml
with:
upload: false
os: ubuntu-20.04
python-version: 3.8

windows:
needs: changes
if: ${{needs.changes.outputs.build == 'true' && !github.event.pull_request.draft}}
uses: ./.github/workflows/build_windows.yml
with:
upload: false
os: windows-latest
python-version: 3.8

documentation:
needs: changes
if: ${{needs.changes.outputs.doc == 'true' && !github.event.pull_request.draft}}
uses: ./.github/workflows/documentation.yml
with:
python-version: 3.8
#
# guitest:
# needs: changes
# if: ${{ needs.changes.outputs.src == 'true' }}
# uses: ./.github/workflows/guitest.yml
# with:
# python-version: 3.8
# matrix: '{"os": ["windows-latest"]}'
#
# scripttest:
# needs: changes
# if: ${{ needs.changes.outputs.scripts == 'true' }}
# uses: ./.github/workflows/scripttest.yml
# with:
# python-version: 3.8
#
# coverage:
# needs: changes
# if: ${{ needs.changes.outputs.src == 'true' }}
# uses: ./.github/workflows/coverage.yml
# with:
# python-version: 3.8
#
# # PR is Ready only
# pytest_nix:
# needs: changes
# if: ${{needs.changes.outputs.src == 'true' && !github.event.pull_request.draft}}
# uses: ./.github/workflows/pytest.yml
# with:
# python-version: 3.8
# matrix: '{"os": ["macos-latest", "ubuntu-latest"]}'
#
# guitest_nix:
# needs: changes
# if: ${{needs.changes.outputs.src == 'true' && !github.event.pull_request.draft}}
# uses: ./.github/workflows/guitest.yml
# with:
# python-version: 3.8
# matrix: '{"os": ["macos-latest", "ubuntu-latest"]}'
#
# ubuntu:
# needs: changes
# if: ${{needs.changes.outputs.build == 'true' && !github.event.pull_request.draft}}
# uses: ./.github/workflows/build_ubuntu.yml
# with:
# upload: false
# os: ubuntu-20.04
# python-version: 3.8
#
# windows:
# needs: changes
# if: ${{needs.changes.outputs.build == 'true' && !github.event.pull_request.draft}}
# uses: ./.github/workflows/build_windows.yml
# with:
# upload: false
# os: windows-latest
# python-version: 3.8
#
# documentation:
# needs: changes
# if: ${{needs.changes.outputs.doc == 'true' && !github.event.pull_request.draft}}
# uses: ./.github/workflows/documentation.yml
# with:
# python-version: 3.8
2 changes: 1 addition & 1 deletion .github/workflows/gatekeeper.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: gatekeeper
name: gatekeeper
# This workflow shares subset of secrets from the main repo for PRs from fork repos
# if the user has write access to the main repo

Expand Down
94 changes: 49 additions & 45 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,52 +30,56 @@ jobs:
shell: bash

timeout-minutes: 10
env:
PYTEST_SENTRY_DSN: ${{secrets.PYTEST_SENTRY_DSN}}

steps:
- uses: actions/checkout@v3
- run:
echo $PYTEST_SENTRY_DSN

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

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

- name: Export env
uses: cardinalby/export-env-action@v2
with:
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
if: ${{!inputs.enable_profiling}}
run: |
pytest ${PYTEST_CORE_ARGUMENTS}
- 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}}
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}
# - name: Create python environment
# uses: ./.github/actions/pyenv
# with:
# python-version: ${{inputs.python-version}}
# requirements: requirements-test.txt
#
# - name: Install dependencies (Windows)
# if: runner.os == 'Windows'
# uses: ./.github/actions/windows_dependencies
#
# - name: Export env
# uses: cardinalby/export-env-action@v2
# with:
# 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
# if: ${{!inputs.enable_profiling}}
# run: |
# pytest ${PYTEST_CORE_ARGUMENTS}
#
# - 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}}
# 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}
1 change: 0 additions & 1 deletion .github/workflows/vars/pytest.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ PYTEST_COMMON_ARGUMENTS='--randomly-seed=1 --disable-warnings --reruns 1 --reru
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_SENTRY_DSN=https://4c299e96dcae424a8bdd61dee346b749@sentry.tribler.org/8

0 comments on commit e42d463

Please sign in to comment.