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

Add a script to compile all commits on the current branch #2642

Merged
merged 2 commits into from Jun 26, 2023

Conversation

kcgen
Copy link
Member

@kcgen kcgen commented Jun 24, 2023

A simple script to compile all the commits on a given branch.

Ensuring that each commit compiles is important for future bisect-ability because if a commit doesn't compile, then regressions within it can't be isolated (and the person bisecting needs to skip it, in which case the changes get lumped into downstream commits until it eventually builds .. making the bug-isolation task harder).

For PR reviewers that can trying it before merging:

  1. Copy the script somewhere outside the repo.
  2. Checkout a different branch that has a bunch of commits.
  3. Launch the script.

Sample output:

Realtime log: /dev/shm/tmp.v8bJ3c5k6n
Using gcc native file: .github/meson/native-gcc-13.ini
Using clang native file: .github/meson/native-clang-17.ini
Compiling c07c848b1 Lower allowed PVS Studio and MSVC warnin.. gcc clang
Compiling 26db0bccf Fix a loss-of-precision warning converti.. gcc clang
Compiling 6a0cf76c6 Fix implified float to double conversion.. gcc clang
Compiling 4c68831f5 Zero-out delete[]'d members before destr.. gcc clang
Compiling a10d46732 Fix an implicit sign conversion in rende.. gcc clang
Compiling 336df9c9f Fix an implicit loss-of-precision warnin.. gcc clang
Compiling e2b58beee Fix a use-after-move in the string_forma..

In this case, my Linux system has both compilers, so it uses both.

Once ccache is primed, builds can go quite quickly in succession.

The long term plan is to include this in CI so we have this check taken care of for all future PRs.

@kcgen kcgen added the build system Build system related issues label Jun 24, 2023
@kcgen kcgen self-assigned this Jun 24, 2023
@kcgen
Copy link
Member Author

kcgen commented Jun 24, 2023

(including all recent contributors just so you're aware of this script and can start putting it to use)

@kcgen kcgen force-pushed the kc/compile-commits-1 branch 2 times, most recently from ba5fd48 to e2322f3 Compare June 24, 2023 18:48
@kcgen
Copy link
Member Author

kcgen commented Jun 24, 2023

When ccache get hots, the builds can really cruise..

time ~/compile_commits.sh

Realtime log: /var/folders/g7/3ntympz90_z9gr61_578k7wc0000gp/T/tmp.b5vvhME2
No supported gcc versions found, skipping
Using clang native file: .github/meson/native-clang.ini
Compiling c07c848b1 Lower allowed PVS Studio and MSVC warnin.. clang
Compiling 26db0bccf Fix a loss-of-precision warning converti.. clang
Compiling 6a0cf76c6 Fix implified float to double conversion.. clang
Compiling 4c68831f5 Zero-out delete[]'d members before destr.. clang
Compiling a10d46732 Fix an implicit sign conversion in rende.. clang
Compiling 336df9c9f Fix an implicit loss-of-precision warnin.. clang
Compiling e2b58beee Fix a use-after-move in the string_forma.. clang
Compiling 33194913a Fix an uninitialized scalar variable war.. clang
Compiling a7982bab2 Avoid a sign extension when computing th.. clang

real 0m13.161s
user 0m25.490s
sys 0m10.097s

@johnnovak
Copy link
Member

Very nice & welcome addition @kcgen . I'll test it on macOS later.

@kcgen kcgen merged commit d664cd9 into main Jun 26, 2023
52 checks passed
@johnnovak johnnovak deleted the kc/compile-commits-1 branch July 8, 2023 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build system Build system related issues
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants