Skip to content

Run push.yml periodically with clean cache#2092

Merged
denik merged 9 commits into
mainfrom
denik/rebuild-periodically
Jan 7, 2025
Merged

Run push.yml periodically with clean cache#2092
denik merged 9 commits into
mainfrom
denik/rebuild-periodically

Conversation

@denik
Copy link
Copy Markdown
Contributor

@denik denik commented Jan 7, 2025

This ensures that our build still works with clean cache and also populates build/test cache, speeding up test runs.

This ensures that our build still works with clean cache
and also populates build/test cache, speeding up test runs.
runs-on: ubuntu-latest
steps:
- name: Clean up cache if running on schedule
if: ${{ github.event_name == 'schedule' }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can move this to the job level.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was not sure if that's going to work given the dependency on it. But if you say yes - let's move it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

IT does not work, it skipped all the dependent jobs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ack, thanks for checking.

Comment thread .github/workflows/push.yml Outdated
@denik denik temporarily deployed to test-trigger-is January 7, 2025 16:53 — with GitHub Actions Inactive
@denik denik requested a review from pietern January 7, 2025 16:54
@denik denik temporarily deployed to test-trigger-is January 7, 2025 16:57 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is January 7, 2025 16:59 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is January 7, 2025 17:00 — with GitHub Actions Inactive
This reverts commit dc1f1c1.
@denik denik temporarily deployed to test-trigger-is January 7, 2025 17:01 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is January 7, 2025 17:03 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is January 7, 2025 17:04 — with GitHub Actions Inactive
@denik
Copy link
Copy Markdown
Contributor Author

denik commented Jan 7, 2025

Here's a build with fresh cache: https://github.com/databricks/cli/actions/runs/12655847882/job/35267108740

tests on ubuntu took 20s and on mac 30s.

@denik denik merged commit 43420d0 into main Jan 7, 2025
@denik denik deleted the denik/rebuild-periodically branch January 7, 2025 17:10
denik added a commit that referenced this pull request May 20, 2026
This ensures that our build still works with clean cache and also
populates build/test cache, speeding up test runs.
pietern added a commit that referenced this pull request May 27, 2026
## Why

`push.yml` saves many setup-go caches per run, but PR / merge_group /
schedule saves are scoped to refs no other run can read. They still
count against the 10 GB per-repo quota and evict main's caches via LRU,
so most PRs miss the cache entirely.

See the [GitHub Actions dependency-caching
docs](https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching)
for the scope and eviction rules.

## What

### `setup-build-environment` composite

The composite now manages the Go cache explicitly instead of relying on
`setup-go`'s built-in caching. `setup-go` runs with `cache: false`. On
`refs/heads/main` (push + the scheduled wipe-and-repopulate cron from
#2092) the unified `actions/cache@v5.0.5` restores immediately and its
post-step saves at the calling job's end — composite-action post-steps
fire at the job's end, not the composite's, so this works inside the
composite. On every other ref, `actions/cache/restore@v5.0.5` restores
only. `restore-keys` provides prefix fallback so PR runs with a changed
`go.sum` still restore main's most recent cache and rebuild only the
delta. The `cache.txt` workaround is gone — `inputs.cache-key` goes
directly into the cache key string.

### Drop `task cover` from CI

`task cover` was a smoke check on main pushes. Cover-instrumented test
binaries land in a different `GOCACHE` slot than the non-cover binaries
PRs need, so a `go.sum` bump landing on a main push would leave the
cache holding cover artifacts until the next 00:00 UTC
wipe-and-repopulate fixed it (up to 24h of PRs missing the test-binary
slot). Running `task test` on every event eliminates that hole; coverage
stays in `Taskfile.yml` for local use and can come back to CI when
there's a real consumer.

### Scheduled cache wipe: twice daily → once daily

The cron from #2092 wiped the cache at 00:00 and 12:00 UTC. The noon
wipe was harmless when every PR repopulated; now that only main runs
repopulate, it creates an unnecessary cold-cache window during the
workday. Trimmed to 00:00 UTC.

## Potential follow-ups

- `check.yml` lint cache
- Three standalone `setup-go` invocations in `push.yml` (`testmask`,
`validate-generated-is-up-to-date`, `validate-python-codegen`)
- `~/.cache/golangci-lint` analyzer cache

This pull request and its description were written by Isaac.
denik pushed a commit that referenced this pull request May 28, 2026
## Why

`push.yml` saves many setup-go caches per run, but PR / merge_group /
schedule saves are scoped to refs no other run can read. They still
count against the 10 GB per-repo quota and evict main's caches via LRU,
so most PRs miss the cache entirely.

See the [GitHub Actions dependency-caching
docs](https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching)
for the scope and eviction rules.

## What

### `setup-build-environment` composite

The composite now manages the Go cache explicitly instead of relying on
`setup-go`'s built-in caching. `setup-go` runs with `cache: false`. On
`refs/heads/main` (push + the scheduled wipe-and-repopulate cron from
#2092) the unified `actions/cache@v5.0.5` restores immediately and its
post-step saves at the calling job's end — composite-action post-steps
fire at the job's end, not the composite's, so this works inside the
composite. On every other ref, `actions/cache/restore@v5.0.5` restores
only. `restore-keys` provides prefix fallback so PR runs with a changed
`go.sum` still restore main's most recent cache and rebuild only the
delta. The `cache.txt` workaround is gone — `inputs.cache-key` goes
directly into the cache key string.

### Drop `task cover` from CI

`task cover` was a smoke check on main pushes. Cover-instrumented test
binaries land in a different `GOCACHE` slot than the non-cover binaries
PRs need, so a `go.sum` bump landing on a main push would leave the
cache holding cover artifacts until the next 00:00 UTC
wipe-and-repopulate fixed it (up to 24h of PRs missing the test-binary
slot). Running `task test` on every event eliminates that hole; coverage
stays in `Taskfile.yml` for local use and can come back to CI when
there's a real consumer.

### Scheduled cache wipe: twice daily → once daily

The cron from #2092 wiped the cache at 00:00 and 12:00 UTC. The noon
wipe was harmless when every PR repopulated; now that only main runs
repopulate, it creates an unnecessary cold-cache window during the
workday. Trimmed to 00:00 UTC.

## Potential follow-ups

- `check.yml` lint cache
- Three standalone `setup-go` invocations in `push.yml` (`testmask`,
`validate-generated-is-up-to-date`, `validate-python-codegen`)
- `~/.cache/golangci-lint` analyzer cache

This pull request and its description were written by Isaac.
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