From 7fc047392c6440c1ed4960c65f85663c1f3a18fc Mon Sep 17 00:00:00 2001 From: glx22 Date: Wed, 9 Jul 2025 17:21:16 +0200 Subject: [PATCH 1/3] Codechange: [Actions] Setup vcpkg via a composite action --- .github/actions/setup-vcpkg/action.yaml | 25 +++++++++++++++++++++++++ .github/workflows/ci-linux.yml | 14 +++----------- .github/workflows/ci-macos.yml | 14 +++----------- .github/workflows/ci-windows.yml | 14 +++----------- .github/workflows/codeql.yml | 14 +++----------- .github/workflows/release-linux.yml | 23 +++++------------------ .github/workflows/release-macos.yml | 14 +++----------- .github/workflows/release-windows.yml | 14 +++----------- 8 files changed, 48 insertions(+), 84 deletions(-) create mode 100644 .github/actions/setup-vcpkg/action.yaml diff --git a/.github/actions/setup-vcpkg/action.yaml b/.github/actions/setup-vcpkg/action.yaml new file mode 100644 index 0000000000..47dd267d0d --- /dev/null +++ b/.github/actions/setup-vcpkg/action.yaml @@ -0,0 +1,25 @@ +name: 'Setup vcpkg' +description: 'Installs vcpkg and initialises binary caching via NuGet' +inputs: + vcpkg-location: + description: 'Where to install vcpkg' + required: true + +runs: + using: "composite" + steps: + - name: Install vcpkg + shell: bash + run: | + git clone https://github.com/microsoft/vcpkg "${{ inputs.vcpkg-location }}" + cd "${{ inputs.vcpkg-location }}" + ./bootstrap-vcpkg.$(if [ "${{ runner.os }}" = "Windows" ]; then echo "bat"; else echo "sh"; fi) -disableMetrics + + - name: Setup vcpkg caching + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite') + diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 1abd005d06..ef71377e23 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -32,18 +32,10 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Setup vcpkg caching - uses: actions/github-script@v7 + - name: Setup vcpkg + uses: ./.github/actions/setup-vcpkg with: - script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite') - - - name: Install vcpkg - run: | - git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}/vcpkg - ${{ runner.temp }}/vcpkg/bootstrap-vcpkg.sh -disableMetrics + vcpkg-location: ${{ runner.temp }}/vcpkg - name: Install dependencies run: | diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index 2a0cd00428..30d6c01886 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -34,18 +34,10 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Setup vcpkg caching - uses: actions/github-script@v7 + - name: Setup vcpkg + uses: ./.github/actions/setup-vcpkg with: - script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite') - - - name: Install vcpkg - run: | - git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}/vcpkg - ${{ runner.temp }}/vcpkg/bootstrap-vcpkg.sh -disableMetrics + vcpkg-location: ${{ runner.temp }}/vcpkg - name: Install OpenGFX run: | diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index 789017bdb9..7830c64d64 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -20,18 +20,10 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Setup vcpkg caching - uses: actions/github-script@v7 + - name: Setup vcpkg + uses: ./.github/actions/setup-vcpkg with: - script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite') - - - name: Install vcpkg - run: | - git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}\vcpkg - ${{ runner.temp }}\vcpkg\bootstrap-vcpkg.bat -disableMetrics + vcpkg-location: ${{ runner.temp }}/vcpkg - name: Install OpenGFX shell: bash diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 1922f63b5f..031142c3f0 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -26,18 +26,10 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Setup vcpkg caching - uses: actions/github-script@v7 + - name: Setup vcpkg + uses: ./.github/actions/setup-vcpkg with: - script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite') - - - name: Install vcpkg - run: | - git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}/vcpkg - ${{ runner.temp }}/vcpkg/bootstrap-vcpkg.sh -disableMetrics + vcpkg-location: ${{ runner.temp }}/vcpkg - name: Install dependencies run: | diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index d6f79057d2..914b5b472b 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -35,14 +35,6 @@ jobs: - name: Enable Rust cache uses: Swatinem/rust-cache@v2 - - name: Setup vcpkg caching - uses: actions/github-script@v7 - with: - script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite') - - name: Install dependencies run: | echo "::group::Install system dependencies" @@ -113,20 +105,15 @@ jobs: # EOF echo "::endgroup::" - # We use vcpkg for our dependencies, to get more up-to-date version. - echo "::group::Install vcpkg and dependencies" - - git clone https://github.com/microsoft/vcpkg /vcpkg - - ( - cd /vcpkg - ./bootstrap-vcpkg.sh -disableMetrics - ) - echo "::group::Install breakpad dependencies" cargo install --locked dump_syms echo "::endgroup::" + - name: Setup vcpkg + uses: ./.github/actions/setup-vcpkg + with: + vcpkg-location: /vcpkg + - name: Install GCC problem matcher uses: ammaraskar/gcc-problem-matcher@master diff --git a/.github/workflows/release-macos.yml b/.github/workflows/release-macos.yml index a5219a0b69..ce0b7adb40 100644 --- a/.github/workflows/release-macos.yml +++ b/.github/workflows/release-macos.yml @@ -37,18 +37,10 @@ jobs: - name: Enable Rust cache uses: Swatinem/rust-cache@v2 - - name: Setup vcpkg caching - uses: actions/github-script@v7 + - name: Setup vcpkg + uses: ./.github/actions/setup-vcpkg with: - script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite') - - - name: Install vcpkg - run: | - git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}/vcpkg - ${{ runner.temp }}/vcpkg/bootstrap-vcpkg.sh -disableMetrics + vcpkg-location: ${{ runner.temp }}/vcpkg - name: Install dependencies env: diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml index d47b3645e5..7e818bfd50 100644 --- a/.github/workflows/release-windows.yml +++ b/.github/workflows/release-windows.yml @@ -45,18 +45,10 @@ jobs: - name: Enable Rust cache uses: Swatinem/rust-cache@v2 - - name: Setup vcpkg caching - uses: actions/github-script@v7 + - name: Setup vcpkg + uses: ./.github/actions/setup-vcpkg with: - script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite') - - - name: Install vcpkg - run: | - git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}\vcpkg - ${{ runner.temp }}\vcpkg\bootstrap-vcpkg.bat -disableMetrics + vcpkg-location: ${{ runner.temp }}/vcpkg - name: Install dependencies shell: bash From 5df8accbbdb186b5f4bc47a19e0c122d5f37c1c3 Mon Sep 17 00:00:00 2001 From: glx22 Date: Wed, 9 Jul 2025 21:49:30 +0200 Subject: [PATCH 2/3] Codechange: [Actions] Use NuGet for vcpkg binary caching --- .github/actions/setup-vcpkg/action.yaml | 31 ++++++++++++++++++++++--- .github/workflows/ci-linux.yml | 1 + .github/workflows/ci-macos.yml | 1 + .github/workflows/codeql.yml | 1 + .github/workflows/release-linux.yml | 1 + .github/workflows/release-macos.yml | 1 + 6 files changed, 33 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-vcpkg/action.yaml b/.github/actions/setup-vcpkg/action.yaml index 47dd267d0d..ebd37190a8 100644 --- a/.github/actions/setup-vcpkg/action.yaml +++ b/.github/actions/setup-vcpkg/action.yaml @@ -4,6 +4,9 @@ inputs: vcpkg-location: description: 'Where to install vcpkg' required: true + mono-install-command: + description: 'Command to run to install mono' + required: false runs: using: "composite" @@ -15,11 +18,33 @@ runs: cd "${{ inputs.vcpkg-location }}" ./bootstrap-vcpkg.$(if [ "${{ runner.os }}" = "Windows" ]; then echo "bat"; else echo "sh"; fi) -disableMetrics + - name: Install mono + if: inputs.mono-install-command + shell: bash + run: | + ${{ inputs.mono-install-command }} + echo "MONO=mono" >> "$GITHUB_ENV" + + - name: Setup NuGet Credentials + shell: bash + env: + FEED_URL: 'https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json' + run: | + cd "${{ inputs.vcpkg-location }}" + ${{ env.MONO }} $(./vcpkg fetch nuget | tail -n 1) \ + sources add \ + -source "${{ env.FEED_URL }}" \ + -storepasswordincleartext \ + -name "GitHub" \ + -username "${{ github.repository_owner }}" \ + -password "${{ github.token }}" + ${{ env.MONO }} $(./vcpkg fetch nuget | tail -n 1) \ + setapikey "${{ github.token }}" \ + -source "${{ env.FEED_URL }}" + - name: Setup vcpkg caching uses: actions/github-script@v7 with: script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite') + core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;nuget,GitHub,readwrite') diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index ef71377e23..2883cb55d7 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -36,6 +36,7 @@ jobs: uses: ./.github/actions/setup-vcpkg with: vcpkg-location: ${{ runner.temp }}/vcpkg + mono-install-command: 'sudo apt-get install -y --no-install-recommends mono-complete' - name: Install dependencies run: | diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index 30d6c01886..972615f865 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -38,6 +38,7 @@ jobs: uses: ./.github/actions/setup-vcpkg with: vcpkg-location: ${{ runner.temp }}/vcpkg + mono-install-command: 'brew install mono' - name: Install OpenGFX run: | diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 031142c3f0..0aaaea5e00 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -30,6 +30,7 @@ jobs: uses: ./.github/actions/setup-vcpkg with: vcpkg-location: ${{ runner.temp }}/vcpkg + mono-install-command: 'sudo apt-get install -y --no-install-recommends mono-complete' - name: Install dependencies run: | diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 914b5b472b..c7f1956a6e 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -113,6 +113,7 @@ jobs: uses: ./.github/actions/setup-vcpkg with: vcpkg-location: /vcpkg + mono-install-command: 'yum install -y mono-complete' - name: Install GCC problem matcher uses: ammaraskar/gcc-problem-matcher@master diff --git a/.github/workflows/release-macos.yml b/.github/workflows/release-macos.yml index ce0b7adb40..9d7f09813a 100644 --- a/.github/workflows/release-macos.yml +++ b/.github/workflows/release-macos.yml @@ -41,6 +41,7 @@ jobs: uses: ./.github/actions/setup-vcpkg with: vcpkg-location: ${{ runner.temp }}/vcpkg + mono-install-command: 'brew install mono' - name: Install dependencies env: From c1a0662c1becc5f9333442e6075a793a2d20d415 Mon Sep 17 00:00:00 2001 From: glx22 Date: Wed, 9 Jul 2025 23:38:26 +0200 Subject: [PATCH 3/3] Temp: enable debug --- .github/workflows/ci-windows.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index 7830c64d64..b9df7fb4eb 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -62,6 +62,7 @@ jobs: -GNinja \ -DVCPKG_TARGET_TRIPLET=${{ inputs.arch }}-windows-static \ -DCMAKE_TOOLCHAIN_FILE="${{ runner.temp }}\vcpkg\scripts\buildsystems\vcpkg.cmake" \ + -DVCPKG_INSTALL_OPTIONS="--debug" \ # EOF echo "::endgroup::"