-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): setup centralized workflow launcher
To ease external contributions, this implements a workflow responsible for triggering workflows that are currently related to pull_request event. To ensure security, changes on some files are allowed only to Zama members. Since workflows are included in this file, this protects against secret leaks. For now only AWS fast CPU tests is targeted as a proof of concept.
- Loading branch information
Showing
3 changed files
with
109 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Centralized launcher for pull-request related workflows | ||
name: Launch PR Workflows | ||
|
||
on: | ||
pull_request_target: | ||
|
||
jobs: | ||
file-changes-check: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
outputs: | ||
forbidden-files: ${{ steps.changed-files.outputs.ci_any_changed }} | ||
steps: | ||
- name: Checkout tfhe-rs | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | ||
with: | ||
fetch-depth: 0 | ||
persist-credentials: 'false' | ||
token: ${{ secrets.REPO_CHECKOUT_TOKEN }} | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Check for file changes | ||
id: changed-files | ||
uses: tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f | ||
with: | ||
since_last_remote_commit: true | ||
files_yaml: | | ||
ci: | ||
- .github/** | ||
- ci/** | ||
- scripts/** | ||
- Makefile | ||
check-pr-author-permission: | ||
uses: ./.github/workflows/check_actor_permissions.yml | ||
with: | ||
actor: ${{ github.event.pull_request.user.login }} | ||
secrets: | ||
TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
can-launch-workflows: | ||
runs-on: ubuntu-latest | ||
needs: [file-changes-check, check-pr-author-permission] | ||
if: ${{ always() }} | ||
steps: | ||
- name: Forbidden files are unchanged | ||
if: needs.file-changes-check.outputs.forbidden-files == 'false' | ||
run: | | ||
echo "Workflows can be launched forbidden files are unchanged" | ||
# Only Zama organization members are allowed to make changes on forbidden files. | ||
- name: Forbidden files have changed | ||
if: needs.file-changes-check.outputs.forbidden-files == 'true' | ||
run: | | ||
if [ "${{ needs.check-pr-author-permission.result }}" == "failure" ]; then | ||
echo "Actor '${{ github.event.pull_request.user.login }}' is not authorized to perform changes on forbidden files" | ||
exit 1 | ||
fi | ||
# | ||
# CPU tests | ||
# | ||
|
||
aws-fast-tests: | ||
needs: can-launch-workflows | ||
uses: ./.github/workflows/aws_tfhe_fast_tests.yml | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
secrets: inherit | ||
|
||
# | ||
# GPU tests | ||
# |