Skip to content

Conversation

@darccio
Copy link
Member

@darccio darccio commented Aug 19, 2025

What does this PR do?

Introduces repository caching by saving .git and 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.yml with main-branch-tests.yml in #3887.

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • New code is free of linting errors. You can check this by running ./scripts/lint.sh locally.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

@darccio darccio requested a review from a team as a code owner August 19, 2025 16:35
@pr-commenter
Copy link

pr-commenter bot commented Aug 19, 2025

Benchmarks

Benchmark execution time: 2025-08-21 16:15:38

Comparing candidate commit f9763cc in PR branch dario.castane/ktlo/cache-checkouts-on-matrices with baseline commit 283db37 in branch dario.castane/ktlo/disable-main-branch-ci.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 24 metrics, 0 unstable metrics.

@darccio darccio force-pushed the dario.castane/ktlo/cache-checkouts-on-matrices branch from 4832f3a to 7b06f33 Compare August 19, 2025 16:38
@darccio darccio closed this Aug 19, 2025
@darccio darccio force-pushed the dario.castane/ktlo/cache-checkouts-on-matrices branch from 7b06f33 to d39ddcb Compare August 19, 2025 16:42
@darccio darccio reopened this Aug 19, 2025
@datadog-official
Copy link
Contributor

datadog-official bot commented Aug 19, 2025

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 4f673ed | Docs | Was this helpful? Give us feedback!

Comment on lines -4 to -9
workflow_call: # allows to reuse this workflow
inputs:
ref:
description: 'The branch to run the workflow on'
required: true
type: string
Copy link
Member Author

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
Copy link
Member Author

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.

Comment on lines 52 to +56
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2.7.0
with:
ref: ${{ inputs.ref || github.ref }}
ref: ${{ github.sha }}
clean: false
Copy link
Member Author

@darccio darccio Aug 19, 2025

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 ))
Copy link
Member Author

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.

@darccio darccio force-pushed the dario.castane/ktlo/disable-main-branch-ci branch from d39ddcb to d742705 Compare August 21, 2025 10:05
@darccio darccio requested review from a team as code owners August 21, 2025 10:05
@darccio darccio force-pushed the dario.castane/ktlo/disable-main-branch-ci branch from d742705 to 849e00d Compare August 21, 2025 10:07
@darccio darccio force-pushed the dario.castane/ktlo/cache-checkouts-on-matrices branch 5 times, most recently from 71ac868 to 4ba46f6 Compare August 21, 2025 14:56
@darccio darccio force-pushed the dario.castane/ktlo/cache-checkouts-on-matrices branch 2 times, most recently from 7cead25 to b8ed9e4 Compare August 21, 2025 15:36
@darccio darccio force-pushed the dario.castane/ktlo/cache-checkouts-on-matrices branch 2 times, most recently from f9763cc to 4f673ed Compare August 21, 2025 16:16
@darccio darccio merged commit 8635ff7 into dario.castane/ktlo/disable-main-branch-ci Aug 21, 2025
209 of 408 checks passed
@darccio darccio deleted the dario.castane/ktlo/cache-checkouts-on-matrices branch August 21, 2025 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants