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

Split out clang-tidy to not run in merge #4428

Merged
merged 17 commits into from
Oct 21, 2024
Merged

Split out clang-tidy to not run in merge #4428

merged 17 commits into from
Oct 21, 2024

Conversation

jonmeow
Copy link
Contributor

@jonmeow jonmeow commented Oct 17, 2024

Because clang-tidy is slow (and I'm not sure we can make it really fast), trying to run it slightly less. Also, I noticed we can shave a few minutes by disabling apt removal without losing too much free space.

Note that since this removes the old clang-tidy, I'll need to change the branch protections before merging.

@jonmeow jonmeow marked this pull request as ready for review October 18, 2024 16:56
Copy link
Contributor

@zygoloid zygoloid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

@@ -18,6 +18,9 @@ runs:
android: true
dotnet: true
haskell: true
# Without this, we save about 22GB in seconds. It adds minutes and only
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this comment confusing; does this setting affect the saving of 22GB? If not, could we instead just mention what this does, eg "Enabling this costs several minutes and only saves about 4GB."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rephrased comments.

echo "//..." >$TARGETS_FILE

# Compute the set of possible rules impacted by this change using
# Bazel-based diffing. This lets PRs and the merge queue have a much more
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "and the merge queue" accurate? I thought the merge queue used the "push" event, so it'll hit the previous case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure merge queue uses merge_group; the list of events is at https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows. At the top of tests.yaml, there's:

on:
  push:
    branches: [trunk, action-test]
  pull_request:
  merge_group:

Since this is github.event_name != 'push', that leaves pull_request and merge_group.

Also note that base_sha is calculated differently based on the source:

          base_sha:
            ${{ github.event_name == 'pull_request' &&
            github.event.pull_request.base.sha ||
            github.event.merge_group.base_sha }}

Note, you can also compare with if: ${{ github.event_name == 'merge_group' }} in https://github.com/orgs/community/discussions/43988#discussioncomment-9667914

build --config=clang-tidy -k \
--target_pattern_file=$TARGETS_FILE

# See "Disk space before build".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# See "Disk space before build".
# See "Disk space before build" in the test setup action.

or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Checkout branch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not need to specify the SHA for a PR? Was that simply redundant?

Copy link
Contributor Author

@jonmeow jonmeow Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The checkout with a sha was just moved to test-setup (i.e., choosing to checkout again in order to reduce duplication). But actually, looking at the history and behavior, I think this is just cargo culting -- it was added by #603, which used pull_request_target, which we don't anymore. Everything seems fine without it, so removing.

For reference (with a small code edit):

Note there, I'm primarily verifying that test execution all looks correct, caching is working, etc.

--attempts=5 \
build --config=clang-tidy -k \
--target_pattern_file=$TARGETS_FILE

# See "Disk space before build".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@jonmeow jonmeow requested a review from zygoloid October 18, 2024 21:01
@jonmeow
Copy link
Contributor Author

jonmeow commented Oct 18, 2024

Since I've made a few edits here, not sure if you want to look again.

@jonmeow jonmeow added this pull request to the merge queue Oct 21, 2024
Merged via the queue into trunk with commit 249709c Oct 21, 2024
17 checks passed
@jonmeow jonmeow deleted the action-test branch October 21, 2024 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants