-
Notifications
You must be signed in to change notification settings - Fork 489
fix(.github/workflows): reuse cached .git repository for branch HEAD commit #3893
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
fix(.github/workflows): reuse cached .git repository for branch HEAD commit #3893
Conversation
…e soon-to-be merged PR as they ran on it
…flakiness is more probable while testing the PR
… test outcomes in PRs
BenchmarksBenchmark execution time: 2025-08-21 16:15:38 Comparing candidate commit f9763cc in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 24 metrics, 0 unstable metrics. |
4832f3a to
7b06f33
Compare
7b06f33 to
d39ddcb
Compare
| workflow_call: # allows to reuse this workflow | ||
| inputs: | ||
| ref: | ||
| description: 'The branch to run the workflow on' | ||
| required: true | ||
| type: string |
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.
This is no longer needed because this workflow is never used from another one.
| workflow_dispatch: # manually | ||
| inputs: | ||
| go-version: | ||
| description: The Go version to use |
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.
Added descriptions because a linter was complaining about them.
| - name: Checkout | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2.7.0 | ||
| with: | ||
| ref: ${{ inputs.ref || github.ref }} | ||
| ref: ${{ github.sha }} | ||
| clean: false |
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.
If by any chance the previous step doesn't find the cached repo, checkout will just work as usual by downloading the repository. clean: false is only needed because we'll usually restore from the cached .git directory.
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| ref: ${{ inputs.ref || github.ref }} | ||
| fetch-depth: $(( ${{ github.event_name == 'pull_request' && github.event.pull_request.commits || 0 }} + 1 )) |
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.
By default fetch-depth is 1. This expression seems to end with 1 or 2, which I don't think it's required.
d39ddcb to
d742705
Compare
d742705 to
849e00d
Compare
…astane/ktlo/cache-checkouts-on-matrices
71ac868 to
4ba46f6
Compare
…th git commands to materialize from `.git`
7cead25 to
b8ed9e4
Compare
f9763cc to
4f673ed
Compare
8635ff7
into
dario.castane/ktlo/disable-main-branch-ci
What does this PR do?
Introduces repository caching by saving
.gitand materializing the files on checking out when running each job on the matrix.Motivation
Faster CI times even if more tests are planned to run after swapping
pull-request.ymlwithmain-branch-tests.ymlin #3887.Reviewer's Checklist
./scripts/lint.shlocally.Unsure? Have a question? Request a review!