Simplify vcpkg caching and use system vcpkg (#7473)

* Fixed OpenSSL exe dir to use tools dir

* Simplify vcpkg caching and use system vcpkg

* Only use ref for version when ref is a tag

* Add condition for event input

* Add restore keys for vcpkg cache

* Improve step name for vcpkg_installed

* Use `windows-2022` runner

* Update ChangeLog

* Revert "Use `windows-2022` runner"

This reverts commit f9e00cbcb3588e58914d2b9e73b3c5734a12d329.
This commit is contained in:
Nick Bolton
2024-09-04 20:26:47 +01:00
committed by GitHub
parent d9c5902442
commit d277c80fd0
6 changed files with 14 additions and 19 deletions

View File

@ -6,7 +6,10 @@ runs:
steps:
- run: |
if [[ "${{ github.ref_name }}" != "master" ]]; then
echo "SYNERGY_VERSION=${{ github.event.inputs.version || github.ref_name }}" >> $GITHUB_ENV
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
echo "SYNERGY_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
fi
if [[ "${{ github.event.inputs.version }}" != "" ]]; then
echo "SYNERGY_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
fi
shell: bash

View File

@ -65,13 +65,12 @@ jobs:
- name: Get version
uses: ./.github/actions/get-version
- name: Cache vcpkg dirs
- name: Cache vcpkg dir
uses: actions/cache@v4
with:
path: |
vcpkg
vcpkg_installed
path: vcpkg_installed
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }}
restore-keys: vcpkg-${{ runner.os }}
- name: Cache Python env
uses: actions/cache@v4
@ -99,11 +98,6 @@ jobs:
- name: Install dependencies
run: python ./scripts/install_deps.py
# The vcpkg downloads dir can be quite large (over 2GB) which bloats the cache.
# For the most part, we don't need it so it probably safe to discard it.
- name: Cleanup vcpkg downloads
run: Remove-Item -Path vcpkg/downloads -Recurse -Force
- name: Configure
run: cmake -B build --preset=windows-release

View File

@ -13,6 +13,7 @@ Enhancements:
- #7467 Load server or client args from `synergy-config.toml`
- #7469 Option to link against local `libportal` and other subprojects
- #7471 Use `vcpkg` to manage `openssl` dep instead of `choco`
- #7473 Simplify `vcpkg` caching and use system `vcpkg`
# 1.15.1

View File

@ -438,11 +438,8 @@ macro(configure_windows_libs)
endmacro()
macro(configure_windows_openssl)
# Strangely, vcpkg doesn't seem to put openssl.exe in the `vcpkg_installed` dir,
# so we have to fish it out of the `vcpkg/buildtrees` dir.
set(OPENSSL_EXE_DIR
${CMAKE_SOURCE_DIR}/vcpkg/buildtrees/openssl/x64-windows-rel/apps)
set(OPENSSL_ROOT_DIR ${CMAKE_SOURCE_DIR}/vcpkg_installed/x64-windows)
set(OPENSSL_EXE_DIR ${OPENSSL_ROOT_DIR}/tools/openssl)
if(EXISTS ${OPENSSL_EXE_DIR})
message(STATUS "OpenSSL exe dir: ${OPENSSL_EXE_DIR}")

View File

@ -27,10 +27,11 @@ def install():
cmd_utils.run([vcpkg_bin, "install"], print_cmd=True)
# Install a local vcpkg even if it's already installed system-wide, so that we can cache the
# vcpkg dirs in the CI env. We also depend on the local `vcpkg/buildtrees` dir when bundling
# the `openssl.exe` binary on Windows (that said, we could also use cmake to search for it).
def ensure_vcpkg():
if cmd_utils.has_command("vcpkg"):
print("Using system vcpkg")
return "vcpkg"
if not os.path.exists("vcpkg"):
get_vcpkg()
else:

1
test
View File

@ -1 +0,0 @@
test