Skip to content

Commit

Permalink
Fix patching the vcpkg triplets to build in Release mode during CI. (#…
Browse files Browse the repository at this point in the history
…4162)

After #4159 Windows CI started building the vcpkg dependencies [in both Debug and Release mode](https://github.com/TileDB-Inc/TileDB/actions/runs/5511502475/jobs/10047140467#step:11:436) (I mistakenly thought that we were not using vcpkg on Windows CI), increasing the install time [from 5.6](https://github.com/TileDB-Inc/TileDB/actions/runs/5511042546/jobs/10046065000#step:11:407) [to 7.7](https://github.com/TileDB-Inc/TileDB/actions/runs/5511502475/jobs/10047140467#step:11:442) minutes.
---
I fixed it on non-Windows as well. Turns out caching is not affected. The way I tested the latter is by merging this commit in the dev branch of my fork, observing that the dependencies (except for OpenSSL) are being built in Release mode only, then opening a PR to my fork's dev branch, and observing that installing the packages is lightning-fast.
---
The reason for this is that the CI script was only patching the official vcpkg triplets to build only in Release, not our custom ones that we were using. This PR fixes it.

---
TYPE: NO_HISTORY
  • Loading branch information
teo-tsirpanis authored Oct 5, 2023
1 parent 8180462 commit f8bc09b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
32 changes: 17 additions & 15 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,23 @@ jobs:
import os
workspace = os.environ["GITHUB_WORKSPACE"]
triplets = os.path.join(workspace, "external", "vcpkg", "triplets")
for path, dnames, fnames in os.walk(triplets):
for fname in fnames:
fname = os.path.join(path, fname)
print(fname)
with open(fname, "rb") as handle:
contents = handle.read()
# If a file is already patched we skip patching it again because
# this affects the hashes calculated by vcpkg for caching
if b"VCPKG_BUILD_TYPE release" in contents:
continue
contents += b"\nset(VCPKG_BUILD_TYPE release)\n"
with open(fname, "wb") as handle:
handle.write(contents)
triplet_paths = [os.path.join(workspace, "external", "vcpkg", "triplets"),
os.path.join(workspace, "ports", "triplets")]
for triplet_path in triplet_paths:
for path, dnames, fnames in os.walk(triplet_path):
for fname in fnames:
fname = os.path.join(path, fname)
print(fname)
with open(fname, "rb") as handle:
contents = handle.read()
# If a file is already patched we skip patching it again because
# this affects the hashes calculated by vcpkg for caching
if b"VCPKG_BUILD_TYPE release" in contents:
continue
contents += b"\nset(VCPKG_BUILD_TYPE release)\n"
with open(fname, "wb") as handle:
handle.write(contents)
- name: core tiledb windows build
run: |
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/posix/patch_vcpkg_triplets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# they're restored by run-vcpkg. While re-patching is harmless, it breaks
# run-vcpkg's caching because it changes the generated package hashes.

TRIPLETS="${GITHUB_WORKSPACE}/external/vcpkg/triplets"
TRIPLETS="${GITHUB_WORKSPACE}/external/vcpkg/triplets ${GITHUB_WORKSPACE}/ports/triplets"

find $TRIPLETS -type f -maxdepth 1 | xargs grep -q "VCPKG_BUILD_TYPE release"
if [ $? -ne 0 ]
Expand Down

0 comments on commit f8bc09b

Please sign in to comment.