diff --git a/.github/workflows/!PR.yml b/.github/workflows/!PR.yml index e7030e14428..97079de5e01 100644 --- a/.github/workflows/!PR.yml +++ b/.github/workflows/!PR.yml @@ -1,7 +1,7 @@ name: PR on: - pull_request: + pull_request_target: types: - opened - synchronize @@ -45,21 +45,35 @@ jobs: - 'build/**' - 'src/**' - 'requirements*' - - + + gatekeeper: # check user's permissions + runs-on: ubuntu-latest + steps: + - name: Check if user has write access + uses: lannonbr/repo-permission-check-action@2bb8c89ba8bf115c4bfab344d6a6f442b24c9a1f + with: + permission: write + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # ---------------------------------------------------------------------------- # PR is Draft and PR is Ready pytest: - needs: changes + needs: [changes, gatekeeper] if: ${{ needs.changes.outputs.src == 'true' }} uses: ./.github/workflows/pytest.yml + secrets: + PYTEST_SENTRY_DSN: ${{secrets.PYTEST_SENTRY_DSN}} with: python-version: 3.8 matrix: '{"os": ["windows-latest"]}' guitest: - needs: changes + needs: [ changes, gatekeeper ] if: ${{ needs.changes.outputs.src == 'true' }} uses: ./.github/workflows/guitest.yml + secrets: + PYTEST_SENTRY_DSN: ${{secrets.PYTEST_SENTRY_DSN}} with: python-version: 3.8 matrix: '{"os": ["windows-latest"]}' @@ -72,25 +86,33 @@ jobs: python-version: 3.8 coverage: - needs: changes + needs: [ changes, gatekeeper ] if: ${{ needs.changes.outputs.src == 'true' }} uses: ./.github/workflows/coverage.yml + secrets: + PYTEST_SENTRY_DSN: ${{secrets.PYTEST_SENTRY_DSN}} + CODACY_PROJECT_TOKEN: ${{secrets.CODACY_PROJECT_TOKEN}} with: python-version: 3.8 + # ---------------------------------------------------------------------------- # PR is Ready only pytest_nix: - needs: changes + needs: [changes, gatekeeper] if: ${{needs.changes.outputs.src == 'true' && !github.event.pull_request.draft}} uses: ./.github/workflows/pytest.yml + secrets: + PYTEST_SENTRY_DSN: ${{secrets.PYTEST_SENTRY_DSN}} with: python-version: 3.8 matrix: '{"os": ["macos-latest", "ubuntu-latest"]}' guitest_nix: - needs: changes + needs: [changes, gatekeeper] if: ${{needs.changes.outputs.src == 'true' && !github.event.pull_request.draft}} uses: ./.github/workflows/guitest.yml + secrets: + PYTEST_SENTRY_DSN: ${{secrets.PYTEST_SENTRY_DSN}} with: python-version: 3.8 matrix: '{"os": ["macos-latest", "ubuntu-latest"]}' diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 9652598ff09..4c4d7e10f98 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -10,12 +10,17 @@ on: secrets: CODACY_PROJECT_TOKEN: required: false + PYTEST_SENTRY_DSN: + required: false jobs: generate_and_upload: name: generate and upload runs-on: ubuntu-latest + env: + PYTEST_SENTRY_DSN: ${{secrets.PYTEST_SENTRY_DSN}} + steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/guitest.yml b/.github/workflows/guitest.yml index 4cc7310f2a1..bcdfc69f514 100644 --- a/.github/workflows/guitest.yml +++ b/.github/workflows/guitest.yml @@ -18,6 +18,10 @@ on: type: boolean required: false + secrets: + PYTEST_SENTRY_DSN: + required: false + jobs: run: runs-on: ${{ matrix.os }} @@ -29,6 +33,9 @@ jobs: run: shell: bash + env: + PYTEST_SENTRY_DSN: ${{secrets.PYTEST_SENTRY_DSN}} + timeout-minutes: 10 steps: diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 06844a9bfb2..be450d05930 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -18,6 +18,10 @@ on: type: boolean required: false + secrets: + PYTEST_SENTRY_DSN: + required: false + jobs: run: runs-on: ${{ matrix.os }} @@ -29,6 +33,9 @@ jobs: run: shell: bash + env: + PYTEST_SENTRY_DSN: ${{secrets.PYTEST_SENTRY_DSN}} + timeout-minutes: 10 steps: diff --git a/requirements-test.txt b/requirements-test.txt index bb9c775f9f8..f520142336b 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -8,6 +8,9 @@ pytest-randomly==3.12.0 pytest-timeout==2.1.0 pytest-freezegun==0.4.2 pytest-rerunfailures==10.2 +pytest-sentry==0.1.10 +pytest-profiling==1.7.0 # for pytest profiling + freezegun==1.2.1 coverage==6.3.2 looptime==0.2 @@ -15,5 +18,3 @@ looptime==0.2 asynctest==0.13.0 # this library has to be installed to properly work with ipv8 TestBase. scipy==1.8.0 - -pytest-profiling==1.7.0 # for pytest profiling \ No newline at end of file