From 03d8c313163a9c89636b04bdf45eeea01edbda01 Mon Sep 17 00:00:00 2001 From: Emily Mabrey Date: Sat, 21 Aug 2021 08:41:58 -0400 Subject: [PATCH 1/2] Enable vcpkg binary cache using Nuget Add Nuget binary caching to vcpkg builds Enable Jfrog Artifactory as Nuget source in CI builds Add manual non-interactive Nuget authentication Prevent CMake from overwriting VCPKG_BINARY_SOURCES Use CI builds to auto generate cache artifacts within Artifactory Enable action trigger kind "workflow_dispatch" within `cmake_build.yml` Signed-off-by: Emily Mabrey --- .github/workflows/cmake_build.yml | 22 +++++++++++++++++++++- CMakeLists.txt | 4 ++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake_build.yml b/.github/workflows/cmake_build.yml index c9f6efeb1..8f0351389 100644 --- a/.github/workflows/cmake_build.yml +++ b/.github/workflows/cmake_build.yml @@ -5,6 +5,7 @@ on: branches: - master pull_request: + workflow_dispatch: defaults: run: @@ -73,6 +74,7 @@ jobs: VCPKG_DISABLE_METRICS: true VCPKG_DEFAULT_TRIPLET: ${{ matrix.config.vcpkg_triplet }} + VCPKG_BINARY_SOURCES: "clear;default,readwrite;nuget,https://tenacityteam.jfrog.io/artifactory/api/nuget/tenacity-nuget,readwrite" # Windows codesigning # This variables will be used by all the steps @@ -88,13 +90,31 @@ jobs: with: submodules: true + + - name: Install Nuget + uses: nuget/setup-nuget@v1 + with: + # Nuget versions needs to be the same version that vcpkg expects + # So update them in parallel + nuget-version: 5.10.0 + + - name: Authenticate CI to Artifactory + if: github.event_name == 'push' && github.repository_owner == 'tenacityteam' + run: | + nuget sources Add -Name Artifactory -Source https://tenacityteam.jfrog.io/artifactory/api/nuget/tenacity-nuget -username ${JFROG_ARTIFACTORY_NUGET_USER} -password ${JFROG_ARTIFACTORY_NUGET_PASS} -ForceEnglishOutput -NonInteractive + nuget setapikey ${JFROG_ARTIFACTORY_NUGET_USER}:${JFROG_ARTIFACTORY_NUGET_TOKEN} -Source Artifactory -ForceEnglishOutput -NonInteractive + env: + JFROG_ARTIFACTORY_NUGET_USER: ${{secrets.JFROG_ARTIFACTORY_NUGET_USER}} + JFROG_ARTIFACTORY_NUGET_PASS: ${{secrets.JFROG_ARTIFACTORY_NUGET_PASS}} + JFROG_ARTIFACTORY_NUGET_TOKEN: ${{secrets.JFROG_ARTIFACTORY_NUGET_TOKEN}} + - name: Install dependencies run: | exec bash "scripts/ci/dependencies.sh" - name: Install Apple codesigning certificates uses: apple-actions/import-codesign-certs@v1 - if: startswith( matrix.config.os, 'macos' ) && github.event_name == 'push' && github.repository_owner == 'audacity' + if: startswith( matrix.config.os, 'macos' ) && github.event_name == 'push' && github.repository_owner == 'tenacityteam' with: p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }} p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c3d7d387..583815afb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,10 @@ endif() if(VCPKG) set(ENV{VCPKG_DISABLE_METRICS} true) + if(NOT DEFINED ENV{VCPKG_BINARY_SOURCES}) + set(ENV{VCPKG_BINARY_SOURCES} "clear;default,readwrite;nuget,https://tenacityteam.jfrog.io/artifactory/api/nuget/tenacity-nuget,read") + endif() + set(ENV{VCPKG_FEATURE_FLAGS} "-compilertracking,manifests,registries,versions") if(VCPKG_ROOT) message(STATUS "Using dependencies from vcpkg repository at ${VCPKG_ROOT}") From e36e9095bdad70d770d4ca34ae29a8868649f92d Mon Sep 17 00:00:00 2001 From: Emily Mabrey Date: Sat, 21 Aug 2021 12:10:18 -0400 Subject: [PATCH 2/2] Make log uploads conditional Since vcpkg no longer always generates buildtree logs ignore them missing Signed-off-by: Emily Mabrey --- .github/workflows/cmake_build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake_build.yml b/.github/workflows/cmake_build.yml index 8f0351389..49fa7f39f 100644 --- a/.github/workflows/cmake_build.yml +++ b/.github/workflows/cmake_build.yml @@ -99,7 +99,7 @@ jobs: nuget-version: 5.10.0 - name: Authenticate CI to Artifactory - if: github.event_name == 'push' && github.repository_owner == 'tenacityteam' + if: github.event_name == 'push' && github.repository_owner == 'tenacityteam' run: | nuget sources Add -Name Artifactory -Source https://tenacityteam.jfrog.io/artifactory/api/nuget/tenacity-nuget -username ${JFROG_ARTIFACTORY_NUGET_USER} -password ${JFROG_ARTIFACTORY_NUGET_PASS} -ForceEnglishOutput -NonInteractive nuget setapikey ${JFROG_ARTIFACTORY_NUGET_USER}:${JFROG_ARTIFACTORY_NUGET_TOKEN} -Source Artifactory -ForceEnglishOutput -NonInteractive @@ -236,8 +236,9 @@ jobs: if-no-files-found: error - name: Upload artifact of vcpkg build logs - if: always() uses: actions/upload-artifact@v2 + if: always() with: name: vcpkg-logs-${{ runner.os }} path: ${{ github.workspace }}/vcpkg/buildtrees/**/*.log + if-no-files-found: ignore