Codechange: [CI] setup-vcpkg action is now in OpenTTD/actions (#14897)

This commit is contained in:
Loïc Guilloux
2025-12-10 21:13:44 +01:00
committed by dP
parent c8a4815f9c
commit b0d5b59c16
12 changed files with 28 additions and 87 deletions

View File

@@ -1,50 +0,0 @@
name: 'Setup vcpkg'
description: 'Installs vcpkg and initialises binary caching via NuGet'
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"
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: 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('VCPKG_BINARY_SOURCES', 'clear;nuget,GitHub,readwrite')

View File

@@ -106,4 +106,4 @@ jobs:
steps: steps:
- name: Check annotations - name: Check annotations
uses: OpenTTD/actions/annotation-check@v5 uses: OpenTTD/actions/annotation-check@v6

View File

@@ -33,10 +33,8 @@ jobs:
uses: actions/checkout@v6 uses: actions/checkout@v6
- name: Setup vcpkg - name: Setup vcpkg
uses: ./.github/actions/setup-vcpkg id: vcpkg
with: uses: OpenTTD/actions/setup-vcpkg@v6
vcpkg-location: ${{ runner.temp }}/vcpkg
mono-install-command: 'sudo apt-get install -y --no-install-recommends mono-complete'
- name: Install dependencies - name: Install dependencies
run: | run: |
@@ -67,7 +65,7 @@ jobs:
# We only use breakpad from vcpkg, as its CMake files # We only use breakpad from vcpkg, as its CMake files
# are a bit special. So the Ubuntu's variant doesn't work. # are a bit special. So the Ubuntu's variant doesn't work.
${{ runner.temp }}/vcpkg/vcpkg install breakpad ${{ steps.vcpkg.outputs.vcpkg }} install breakpad
echo "::endgroup::" echo "::endgroup::"
env: env:

View File

@@ -35,10 +35,8 @@ jobs:
uses: actions/checkout@v6 uses: actions/checkout@v6
- name: Setup vcpkg - name: Setup vcpkg
uses: ./.github/actions/setup-vcpkg id: vcpkg
with: uses: OpenTTD/actions/setup-vcpkg@v6
vcpkg-location: ${{ runner.temp }}/vcpkg
mono-install-command: 'brew install mono'
- name: Install OpenGFX - name: Install OpenGFX
run: | run: |
@@ -67,7 +65,7 @@ jobs:
cmake .. \ cmake .. \
-DCMAKE_OSX_ARCHITECTURES=${{ inputs.full_arch }} \ -DCMAKE_OSX_ARCHITECTURES=${{ inputs.full_arch }} \
-DVCPKG_TARGET_TRIPLET=${{ inputs.arch }}-osx \ -DVCPKG_TARGET_TRIPLET=${{ inputs.arch }}-osx \
-DCMAKE_TOOLCHAIN_FILE=${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake \ -DCMAKE_TOOLCHAIN_FILE=${{ steps.vcpkg.outputs.vcpkg-cmake }} \
${{ inputs.extra-cmake-parameters }} \ ${{ inputs.extra-cmake-parameters }} \
# EOF # EOF
echo "::endgroup::" echo "::endgroup::"

View File

@@ -57,4 +57,4 @@ jobs:
steps: steps:
- name: Check annotations - name: Check annotations
uses: OpenTTD/actions/annotation-check@v5 uses: OpenTTD/actions/annotation-check@v6

View File

@@ -21,9 +21,8 @@ jobs:
uses: actions/checkout@v6 uses: actions/checkout@v6
- name: Setup vcpkg - name: Setup vcpkg
uses: ./.github/actions/setup-vcpkg id: vcpkg
with: uses: OpenTTD/actions/setup-vcpkg@v6
vcpkg-location: ${{ runner.temp }}/vcpkg
- name: Install OpenGFX - name: Install OpenGFX
shell: bash shell: bash
@@ -61,7 +60,7 @@ jobs:
cmake .. \ cmake .. \
-GNinja \ -GNinja \
-DVCPKG_TARGET_TRIPLET=${{ inputs.arch }}-windows-static \ -DVCPKG_TARGET_TRIPLET=${{ inputs.arch }}-windows-static \
-DCMAKE_TOOLCHAIN_FILE="${{ runner.temp }}\vcpkg\scripts\buildsystems\vcpkg.cmake" \ -DCMAKE_TOOLCHAIN_FILE="${{ steps.vcpkg.outputs.vcpkg-cmake }}" \
# EOF # EOF
echo "::endgroup::" echo "::endgroup::"

View File

@@ -28,10 +28,8 @@ jobs:
uses: actions/checkout@v6 uses: actions/checkout@v6
- name: Setup vcpkg - name: Setup vcpkg
uses: ./.github/actions/setup-vcpkg id: vcpkg
with: uses: OpenTTD/actions/setup-vcpkg@v6
vcpkg-location: ${{ runner.temp }}/vcpkg
mono-install-command: 'sudo apt-get install -y --no-install-recommends mono-complete'
- name: Install dependencies - name: Install dependencies
run: | run: |
@@ -62,7 +60,7 @@ jobs:
# We only use breakpad from vcpkg, as its CMake files # We only use breakpad from vcpkg, as its CMake files
# are a bit special. So the Ubuntu's variant doesn't work. # are a bit special. So the Ubuntu's variant doesn't work.
${{ runner.temp }}/vcpkg/vcpkg install breakpad ${{ steps.vcpkg.outputs.vcpkg }} install breakpad
echo "::endgroup::" echo "::endgroup::"
env: env:

View File

@@ -19,7 +19,7 @@ jobs:
fetch-depth: 4 fetch-depth: 4
- name: Get pull-request commits - name: Get pull-request commits
uses: OpenTTD/actions/checkout-pull-request@v5 uses: OpenTTD/actions/checkout-pull-request@v6
- name: Check commits - name: Check commits
uses: OpenTTD/OpenTTD-git-hooks@main uses: OpenTTD/OpenTTD-git-hooks@main

View File

@@ -111,7 +111,8 @@ jobs:
echo "::endgroup::" echo "::endgroup::"
- name: Setup vcpkg - name: Setup vcpkg
uses: ./.github/actions/setup-vcpkg id: vcpkg
uses: OpenTTD/actions/setup-vcpkg@v6
with: with:
vcpkg-location: /vcpkg vcpkg-location: /vcpkg
mono-install-command: 'yum install -y mono-complete' mono-install-command: 'yum install -y mono-complete'
@@ -126,7 +127,7 @@ jobs:
echo "::group::CMake" echo "::group::CMake"
cmake ${GITHUB_WORKSPACE} \ cmake ${GITHUB_WORKSPACE} \
-DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake \ -DCMAKE_TOOLCHAIN_FILE=${{ steps.vcpkg.outputs.vcpkg-cmake }} \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \ -DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
-DOPTION_PACKAGE_DEPENDENCIES=ON \ -DOPTION_PACKAGE_DEPENDENCIES=ON \

View File

@@ -38,10 +38,8 @@ jobs:
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
- name: Setup vcpkg - name: Setup vcpkg
uses: ./.github/actions/setup-vcpkg id: vcpkg
with: uses: OpenTTD/actions/setup-vcpkg@v6
vcpkg-location: ${{ runner.temp }}/vcpkg
mono-install-command: 'brew install mono'
- name: Install dependencies - name: Install dependencies
env: env:
@@ -97,7 +95,7 @@ jobs:
cmake ${GITHUB_WORKSPACE} \ cmake ${GITHUB_WORKSPACE} \
-DCMAKE_OSX_ARCHITECTURES=arm64 \ -DCMAKE_OSX_ARCHITECTURES=arm64 \
-DVCPKG_TARGET_TRIPLET=arm64-osx \ -DVCPKG_TARGET_TRIPLET=arm64-osx \
-DCMAKE_TOOLCHAIN_FILE=${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake \ -DCMAKE_TOOLCHAIN_FILE=${{ steps.vcpkg.outputs.vcpkg-cmake }} \
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \ -DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \ -DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
@@ -118,7 +116,7 @@ jobs:
cmake ${GITHUB_WORKSPACE} \ cmake ${GITHUB_WORKSPACE} \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \ -DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DVCPKG_TARGET_TRIPLET=x64-osx \ -DVCPKG_TARGET_TRIPLET=x64-osx \
-DCMAKE_TOOLCHAIN_FILE=${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake \ -DCMAKE_TOOLCHAIN_FILE=${{ steps.vcpkg.outputs.vcpkg-cmake }} \
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \ -DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \ -DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \

View File

@@ -46,9 +46,8 @@ jobs:
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
- name: Setup vcpkg - name: Setup vcpkg
uses: ./.github/actions/setup-vcpkg id: vcpkg
with: uses: OpenTTD/actions/setup-vcpkg@v6
vcpkg-location: ${{ runner.temp }}/vcpkg
- name: Install dependencies - name: Install dependencies
shell: bash shell: bash
@@ -104,7 +103,7 @@ jobs:
cmake ${GITHUB_WORKSPACE} \ cmake ${GITHUB_WORKSPACE} \
-GNinja \ -GNinja \
-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \ -DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \
-DCMAKE_TOOLCHAIN_FILE="${{ runner.temp }}\vcpkg\scripts\buildsystems\vcpkg.cmake" \ -DCMAKE_TOOLCHAIN_FILE="${{ steps.vcpkg.outputs.vcpkg-cmake }}" \
-DOPTION_USE_NSIS=ON \ -DOPTION_USE_NSIS=ON \
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \ -DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
@@ -134,7 +133,7 @@ jobs:
cmake ${GITHUB_WORKSPACE} \ cmake ${GITHUB_WORKSPACE} \
-GNinja \ -GNinja \
-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \ -DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \
-DCMAKE_TOOLCHAIN_FILE="${{ runner.temp }}\vcpkg\scripts\buildsystems\vcpkg.cmake" \ -DCMAKE_TOOLCHAIN_FILE="${{ steps.vcpkg.outputs.vcpkg-cmake }}" \
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \ -DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \ -DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \

View File

@@ -88,7 +88,7 @@ jobs:
- prepare - prepare
name: Publish bundles name: Publish bundles
uses: OpenTTD/actions/.github/workflows/rw-cdn-upload.yml@v5 uses: OpenTTD/actions/.github/workflows/rw-cdn-upload.yml@v6
secrets: secrets:
CDN_SIGNING_KEY: ${{ secrets.CDN_SIGNING_KEY }} CDN_SIGNING_KEY: ${{ secrets.CDN_SIGNING_KEY }}
DEPLOYMENT_APP_ID: ${{ secrets.DEPLOYMENT_APP_ID }} DEPLOYMENT_APP_ID: ${{ secrets.DEPLOYMENT_APP_ID }}
@@ -103,7 +103,7 @@ jobs:
- prepare - prepare
name: Publish symbols name: Publish symbols
uses: OpenTTD/actions/.github/workflows/rw-symbols-upload.yml@v5 uses: OpenTTD/actions/.github/workflows/rw-symbols-upload.yml@v6
secrets: secrets:
SYMBOLS_SIGNING_KEY: ${{ secrets.SYMBOLS_SIGNING_KEY }} SYMBOLS_SIGNING_KEY: ${{ secrets.SYMBOLS_SIGNING_KEY }}
with: with: