-
Notifications
You must be signed in to change notification settings - Fork 598
fix(ci): don't have checks go green immediately #12168
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
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
8dd98e7
remove one-time-use labels
ludamad 75c8e33
cleanup
ludamad 75f5071
clearer syntax
ludamad 2efb73e
Update ci3.yml
ludamad 78792a5
Update ci3.yml
ludamad 2d457fb
fix scope
ludamad 5ca42e4
Merge remote-tracking branch 'origin/ad/fix/ci3-workflow' into ad/fix…
ludamad 85a7e13
Update ci3.yml
ludamad cdaf367
Update ci3.yml
ludamad a2ece07
redo
ludamad da2435e
Merge remote-tracking branch 'origin/ad/fix/ci3-workflow' into ad/fix…
ludamad 61f8235
simplify branch check
ludamad f8d5647
simplify branch check
ludamad 79a8288
fix
ludamad b7892f1
ok we do need it to run
ludamad 980dbc8
go go logs
ludamad 64ac5b0
Use doctored ref name for external PRs
ludamad 48b7b0b
fix
ludamad 2f82e99
Update ci3-external.yml
ludamad 946098c
Update ci3.yml
ludamad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,89 @@ | ||
| # CI for external Aztec contributors. Like ci3.yml, but more locked down. | ||
| name: CI3 (External) | ||
|
|
||
| on: | ||
| # For external devs. Workflow file edits won't take effect in the PR. | ||
| pull_request_target: | ||
| types: [opened, synchronize, reopened, ready_for_review, labeled] | ||
|
|
||
| concurrency: | ||
| # Only allow one run per <forked-repo>/<branch>. | ||
| group: | | ||
| ci3-external-${{format('{0}/{1}', github.event.pull_request.head.repo.full_name, github.head_ref)}} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| ci-external: | ||
| runs-on: ubuntu-latest | ||
| # exclusive with ci3.yml, only run on forks. | ||
| if: github.event.pull_request.head.repo.full_name != github.repository | ||
| steps: | ||
| ############# | ||
| # Prepare Env | ||
| ############# | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| # The commit to checkout. We want our actual commit, and not the result of merging the PR to the target. | ||
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | ||
|
|
||
| - name: Fail If Draft | ||
| if: github.event.pull_request.draft && (github.event.action != 'labeled' || github.event.label.name != 'trigger-workflow') | ||
| run: echo "CI is not run on drafts." && exit 1 | ||
|
|
||
| - name: External Contributor Checks | ||
| # Run only if a pull request event type and we have a forked repository origin. | ||
| if: | | ||
| (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && | ||
| github.event.pull_request.head.repo.full_name != github.repository | ||
| run: | | ||
| set -o pipefail | ||
| git fetch origin ${{ github.event.pull_request.base.ref }} --depth=1 &>/dev/null | ||
| forbidden_changes=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }} HEAD -- ci3 .github ci.sh) | ||
| if echo "$forbidden_changes" | grep -q .; then | ||
| echo "Error: External PRs can't contain CI changes (forbidden files: $forbidden_changes)." | ||
| exit 1 | ||
| fi | ||
| if [ ${{ github.event.pull_request.base.ref }} != "master" ]; then | ||
| echo "Error: External PRs can only target master, targeted: ${{ github.event.pull_request.base.ref }}." | ||
| exit 1 | ||
| fi | ||
| labeled="${{contains(github.event.pull_request.labels.*.name, 'ci-external') || contains(github.event.pull_request.labels.*.name, 'ci-external-once')}}" | ||
| if [ "$labeled" = false ]; then | ||
| echo "External PRs need the 'ci-external' or 'ci-external-once' labels to run." | ||
| exit 1 | ||
| fi | ||
| # Remove any ci-external-once labels. | ||
| GITHUB_TOKEN=${{ secrets.AZTEC_BOT_GITHUB_TOKEN }} gh pr edit ${{ github.event.pull_request.number }} --remove-label "ci-external-once" | ||
|
|
||
| - name: CI Full Override | ||
| # TODO consolidate legacy labels to just ci-full. | ||
| if: | | ||
| contains(github.event.pull_request.labels.*.name, 'e2e-all') || | ||
| contains(github.event.pull_request.labels.*.name, 'network-all') || | ||
| contains(github.event.pull_request.labels.*.name, 'ci-full') | ||
| run: echo "CI_FULL=1" >> $GITHUB_ENV | ||
|
|
||
| - name: Setup | ||
| run: | | ||
| # Ensure we can SSH into the spot instances we request. | ||
| mkdir -p ~/.ssh | ||
| echo ${{ secrets.BUILD_INSTANCE_SSH_KEY }} | base64 --decode > ~/.ssh/build_instance_key | ||
| chmod 600 ~/.ssh/build_instance_key | ||
|
|
||
| ############# | ||
| # Run | ||
| ############# | ||
| - name: Run | ||
| env: | ||
| # We need to pass these creds to start the AWS ec2 instance. | ||
| # They are not injected into that instance. Instead, it has minimal | ||
| # creds for being able to upload to cache. | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| REF_NAME: repo-fork/${{ github.repository }}/${{ github.head_ref }} | ||
| # We only test on amd64. | ||
| ARCH: amd64 | ||
| LOG_ID: ${{ github.run_id }} | ||
| run: | | ||
| ./ci.sh ec2 |
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can just always log-in if not external