Skip to content

ci: Mitigate network issues in native Windows job#35024

Open
hebasto wants to merge 2 commits intobitcoin:masterfrom
hebasto:260407-vcpkg-dl-cache
Open

ci: Mitigate network issues in native Windows job#35024
hebasto wants to merge 2 commits intobitcoin:masterfrom
hebasto:260407-vcpkg-dl-cache

Conversation

@hebasto
Copy link
Copy Markdown
Member

@hebasto hebasto commented Apr 7, 2026

This PR mitigates network issues when vcpkg downloads source tarballs by caching the entire vcpkg/downloads directory.

Closes #34996.

Note for Maintainers: To properly populate the new CI cache, all current vcpkg binary caches must be cleared to trigger a rebuild.

@DrahtBot
Copy link
Copy Markdown
Contributor

DrahtBot commented Apr 7, 2026

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.
A summary of reviews will appear here.

@hebasto
Copy link
Copy Markdown
Member Author

hebasto commented Apr 7, 2026

The size of windows-native-dll-vcpkg-downloads is about 1.2 GB, compared to 470 MB for windows-native-dll-vcpkg-tools.

Perhaps we could exclude vcpkg/downloads/tools from the cache.

@hebasto hebasto marked this pull request as draft April 7, 2026 17:03
@hebasto hebasto force-pushed the 260407-vcpkg-dl-cache branch from 22c03c7 to cd8092d Compare April 7, 2026 21:21
@hebasto
Copy link
Copy Markdown
Member Author

hebasto commented Apr 7, 2026

Perhaps we could exclude vcpkg/downloads/tools from the cache.

Done.

The size of windows-native-dll-vcpkg-downloads is about 1.2 GB...

It's 800 MB now.

@maflcko
Copy link
Copy Markdown
Member

maflcko commented Apr 8, 2026

Can you explain why the tools were previously cached, what they are, and why it is fine to no longer cache them?

@hebasto
Copy link
Copy Markdown
Member Author

hebasto commented Apr 8, 2026

Can you explain why the tools were previously cached...

To skip downloading and unpacking them whenever possible.

... what they are...

They are Windows binaries used for building packages for the target triplet. Here are the contents of the vcpkg/downloads/tools directory from the CI:

$ ls -l ~/AppData/Local/vcpkg/downloads/tools
total 164
drwxr-xr-x 1 runneradmin 197121 0 Apr  7 14:37 jom
drwxr-xr-x 1 runneradmin 197121 0 Apr  7 14:46 meson-1.8.2-3d2461
drwxr-xr-x 1 runneradmin 197121 0 Apr  7 14:49 msys2
drwxr-xr-x 1 runneradmin 197121 0 Apr  7 14:37 nasm
drwxr-xr-x 1 runneradmin 197121 0 Apr  7 14:29 ninja
drwxr-xr-x 1 runneradmin 197121 0 Apr  7 14:37 perl
drwxr-xr-x 1 runneradmin 197121 0 Apr  7 14:29 powershell-core-7.5.4-windows
drwxr-xr-x 1 runneradmin 197121 0 Apr  7 14:46 python
drwxr-xr-x 1 runneradmin 197121 0 Apr  7 14:46 win_bison

... and why it is fine to no longer cache them?

It is a tradeoff. The downloaded tool archives are now cached along with the package source tarballs. However, vcpkg has to unpack them on every run.

Comment on lines +260 to +262
path: |
~/AppData/Local/vcpkg/downloads/*
!~/AppData/Local/vcpkg/downloads/tools
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a need to set a path on a download? Wouldn't it be easier to just set the correct path on upload only?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, there is a need. The path input participates in cache entity identification. Therefore, a pair of actions/cache/restore and actions/cache/save must have the exact same path configured, or it will result in a cache miss.

hebasto added 2 commits April 9, 2026 15:27
This avoids code duplication and improves readability.
The new cache is keyed with the hash of 'vcpkg.json', which reduces
cache storage consumption compared to keying by run ID.

The `vcpkg/downloads/tools` subdirectory is excluded to further save
space.
@hebasto hebasto force-pushed the 260407-vcpkg-dl-cache branch from cd8092d to dc93091 Compare April 9, 2026 14:28
@hebasto hebasto marked this pull request as ready for review April 9, 2026 14:28
@hebasto
Copy link
Copy Markdown
Member Author

hebasto commented Apr 9, 2026

The feedback from @maflcko has been addressed.

path: ${{ env.CCACHE_DIR }}
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
key: ${{ github.job }}-${{ matrix.job-type }}-ccache-${{ github.run_id }}
key: ${{ steps.ccache-cache.outputs.cache-primary-key }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you claim this is a refactor, but it would be good to link to the relevant docs, so that reviewers can confirm this.

to me this looks like dropping the run_id, making it impossible to save a new cache?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

you claim this is a refactor, but it would be good to link to the relevant docs, so that reviewers can confirm this.

Sure.

From the docs:

  • cache-primary-key - Cache primary key passed in the input to use in subsequent steps of the workflow.

to me this looks like dropping the run_id, making it impossible to save a new cache?

It now refers to:

key: ${{ github.job }}-${{ matrix.job-type }}-ccache-${{ github.run_id }}


If you think cache-primary-key is confusing, I’m happy to drop that commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: intermittent failure in Windows CI

3 participants