Skip to content
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

HMS-3162: tests: add initial testing farm integration #36

Merged
merged 1 commit into from
Dec 7, 2023
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
52 changes: 52 additions & 0 deletions .github/workflows/testingfarm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
name: Testing farm tests

on:
pull_request_target:
ondrejbudai marked this conversation as resolved.
Show resolved Hide resolved
types: [opened, synchronize, reopened]

# To use testing farm we need the TF_API_KEY secret available inside the
# forked repo which requires the pull_request_target trigger. To protect
# the secrets we need to make sure only people with repo write access
# can trigger this workflow. This means that ouside contributors will
# get an initial failure when the workflow is run. But once someone from
# the team re-triggers it it will work.
#
# Note that "pull_requqest_target" events are always triggered even
# when the "Fork pull request workflows from outside collaborators"
# setting is restricted to "Require approval for all outside collaborators"
# (see https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks)
#
# Note also that this precautions might be overkill because a fork
# cannot modify this workflow and all we do is run a branch inside
# testing farm. But a) the scope of workflow may expand over time
# b) it feels safer this way and is not a big burden in practise.
#
# This follows https://michaelheap.com/access-secrets-from-forks/
jobs:
testingfarm:
name: "Run in testing farm"
runs-on: ubuntu-latest
steps:
- name: Get User Permission
id: checkAccess
uses: actions-cool/check-user-permission@v2
with:
require: write
username: ${{ github.triggering_actor }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check User Permission
if: steps.checkAccess.outputs.require-result == 'false'
run: |
echo "${{ github.triggering_actor }} does not have permissions on this repo."
echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}"
echo "Job originally triggered by ${{ github.actor }}"
exit 1
- name: Run the tests
uses: sclorg/testing-farm-as-github-action@v1
with:
api_key: ${{ secrets.TF_API_KEY }}
git_url: ${{ github.event.pull_request.head.repo.clone_url }}
git_ref: ${{ github.event.pull_request.head.ref }}
pull_request_status_name: "Testing farm"
Loading