Skip to content

github-ci: don't run ee tests for outside pull requests by default #183

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

Merged
merged 1 commit into from
Jun 8, 2022
Merged
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
31 changes: 27 additions & 4 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: testing
on:
push:
pull_request:
pull_request_target:
types: [labeled]
workflow_dispatch:

jobs:
Expand All @@ -12,8 +14,12 @@ jobs:
#
# The main trick is described here:
# https://github.com/Dart-Code/Dart-Code/pull/2375
if: github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository
#
# Also we want to run it always for manually triggered workflows.
if: (github.event_name == 'push') ||
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.repository) ||
(github.event_name == 'workflow_dispatch')

runs-on: ubuntu-latest

Expand Down Expand Up @@ -65,8 +71,18 @@ jobs:
run: make bench-deps bench DURATION=1x COUNT=1

run-tests-ee:
if: github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository
# The same as for run-tests-ce, but it does not run on pull requests from
# forks by default. Tests will run only when the pull request is labeled
# with `full-ci`. To avoid security problems, the label must be reset
# manually for every run.
#
# We need to use `pull_request_target` because it has access to base
# repository secrets unlike `pull_request`.
if: (github.event_name == 'push') ||
(github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository &&
github.event.label.name == 'full-ci') ||
(github.event_name == 'workflow_dispatch')

runs-on: ubuntu-latest

Expand All @@ -86,6 +102,13 @@ jobs:
steps:
- name: Clone the connector
uses: actions/checkout@v2
# This is needed for pull_request_target because this event runs in the
# context of the base commit of the pull request. It works fine for
# `push` and `workflow_dispatch` because the default behavior is used
# if `ref` and `repository` are empty.
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}

- name: Setup Tarantool ${{ matrix.sdk-version }}
run: |
Expand Down