- Notifications
You must be signed in to change notification settings - Fork921
ci: cache embedded postgres downloaded binaries#18477
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR adds support for caching downloaded Embedded Postgres binaries by introducing a--cache
flag in the helper script, updating CI workflows to populate and persist that cache across runs, and providing a composite action to upload the cache onmain
.
- Introduce
cachePath
flag and default directory logic inmain.go
- Update CI steps to create cache directories and pass
-cache
to the script - Add
embedded-pg-cache
composite action for persisting the cache
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
scripts/embedded-pg/main.go | Added--cache flag, default cache directory, andMkdirAll |
.github/workflows/ci.yaml | Created cache dirs, passed-cache flag, and invoked upload |
.github/actions/embedded-pg-cache/action.yml | New composite action to save the cache viaactions/cache |
Comments suppressed due to low confidence (5)
scripts/embedded-pg/main.go:17
- The new
--cache
flag should be documented in the project README or script usage section to ensure users know how to leverage caching.
flag.StringVar(&cachePath, "cache", "", "Optional custom path for embedded postgres binaries")
.github/workflows/ci.yaml:500
- [nitpick] This Windows-specific path is duplicated later; consider defining a variable for the cache path to reduce duplication and ease future updates.
mkdir -p "C:/temp/embedded-pg-cache"
.github/workflows/ci.yaml:500
mkdir -p
may not be available on Windows runners by default; ensure the shell supports this or use a PowerShell-native command likeNew-Item -ItemType Directory -Force
.
mkdir -p "C:/temp/embedded-pg-cache"
scripts/embedded-pg/main.go:27
- New fallback logic for
cachePath
isn't covered by existing tests; consider adding an integration test to verify caching behavior is applied correctly.
if cachePath == "" {
.github/actions/embedded-pg-cache/action.yml:15
- [nitpick] Pinning to a specific commit SHA can make upgrades harder; consider using the official version tag (
actions/cache@v4
) instead of a commit hash.
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Fixescoder/internal#567
Embedded Postgres downloads binaries from
${REPO}/io/zonky/test/postgres/embedded-postgres-binaries-$OS-$ARCH/$VERSION/embedded-postgres-binaries-$OS-$ARCH-$VERSION.jar
toCachePath
:Example link for Darwin arm64:https://repo.maven.apache.org/maven2/io/zonky/test/postgres/embedded-postgres-binaries-darwin-arm64v8/16.4.0/
Making this a variable and adding it to be cached on merge to main.