ci: vcpkg improvements

* Upgrade to 2025.07.25
* Configure vcpkg settings in vcpkg.json, this avoids needing to
  duplicate the vcpkg hash used in several places, and also avoids
  needing to set overlay ports/triplets directories from CMake
* Add caching workaround so that builds won't take forever every time
* Build on windows-2025
This commit is contained in:
Nadia Holmquist Pedersen
2025-08-16 06:32:01 +02:00
parent af84734e57
commit 367d05b302
4 changed files with 42 additions and 9 deletions

View File

@ -10,7 +10,6 @@ on:
- master - master
env: env:
VCPKG_COMMIT: 2ad004460f5db4d3b66f62f5799ff66c265c4b5d
MELONDS_GIT_BRANCH: ${{ github.ref }} MELONDS_GIT_BRANCH: ${{ github.ref }}
MELONDS_GIT_HASH: ${{ github.sha }} MELONDS_GIT_HASH: ${{ github.sha }}
MELONDS_BUILD_PROVIDER: GitHub Actions MELONDS_BUILD_PROVIDER: GitHub Actions
@ -24,6 +23,10 @@ jobs:
name: ${{ matrix.arch }} name: ${{ matrix.arch }}
runs-on: macos-14 runs-on: macos-14
env:
VCPKG_BINARY_SOURCES: clear;files,${{ github.workspace }}/vcpkg_cache,readwrite
steps: steps:
- name: Check out sources - name: Check out sources
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -32,10 +35,16 @@ jobs:
brew install autoconf automake autoconf-archive libtool python-setuptools brew install autoconf automake autoconf-archive libtool python-setuptools
- name: Set up CMake - name: Set up CMake
uses: lukka/get-cmake@latest uses: lukka/get-cmake@latest
- name: Restore vcpkg cache
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/vcpkg_cache
key: vcpkg-${{ matrix.arch }}-osx-${{ hashFiles('vcpkg.json') }}
restore-keys: vcpkg-${{ matrix.arch }}-osx-
- name: Set up vcpkg - name: Set up vcpkg
uses: lukka/run-vcpkg@v11 uses: lukka/run-vcpkg@v11
with: with:
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT }} vcpkgJsonGlob: vcpkg.json
- name: Build - name: Build
uses: lukka/run-cmake@v10 uses: lukka/run-cmake@v10
with: with:
@ -53,6 +62,11 @@ jobs:
name: macOS-${{ matrix.arch }} name: macOS-${{ matrix.arch }}
path: macOS-${{ matrix.arch }}.zip path: macOS-${{ matrix.arch }}.zip
retention-days: 1 retention-days: 1
- name: Save vcpkg cache
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/vcpkg_cache
key: vcpkg-${{ matrix.arch }}-osx-${{ hashFiles('vcpkg.json') }}
universal-binary: universal-binary:
name: Universal binary name: Universal binary

View File

@ -10,7 +10,6 @@ on:
- master - master
env: env:
VCPKG_COMMIT: 2ad004460f5db4d3b66f62f5799ff66c265c4b5d
MELONDS_GIT_BRANCH: ${{ github.ref }} MELONDS_GIT_BRANCH: ${{ github.ref }}
MELONDS_GIT_HASH: ${{ github.sha }} MELONDS_GIT_HASH: ${{ github.sha }}
MELONDS_BUILD_PROVIDER: GitHub Actions MELONDS_BUILD_PROVIDER: GitHub Actions
@ -18,10 +17,12 @@ env:
jobs: jobs:
build: build:
runs-on: windows-latest runs-on: windows-2025
defaults: defaults:
run: run:
shell: msys2 {0} shell: msys2 {0}
env:
VCPKG_BINARY_SOURCES: clear;files,${{ github.workspace }}/vcpkg_cache,readwrite
steps: steps:
- name: Check out sources - name: Check out sources
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -31,10 +32,16 @@ jobs:
msystem: ucrt64 msystem: ucrt64
update: true update: true
pacboy: gcc:p cmake:p ninja:p make:p pacboy: gcc:p cmake:p ninja:p make:p
- name: Restore vcpkg cache
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/vcpkg_cache
key: vcpkg-x86_64-mingw-${{ hashFiles('vcpkg.json') }}
restore-keys: vcpkg-x86_64-mingw-
- name: Set up vcpkg - name: Set up vcpkg
uses: lukka/run-vcpkg@v11 uses: lukka/run-vcpkg@v11
with: with:
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT }} vcpkgJsonGlob: vcpkg.json
- name: Configure - name: Configure
run: cmake --preset=release-mingw-x86_64 -DMELONDS_EMBED_BUILD_INFO=ON run: cmake --preset=release-mingw-x86_64 -DMELONDS_EMBED_BUILD_INFO=ON
- name: Build - name: Build
@ -43,3 +50,8 @@ jobs:
with: with:
name: melonDS-windows-x86_64 name: melonDS-windows-x86_64
path: .\build\release-mingw-x86_64\melonDS.exe path: .\build\release-mingw-x86_64\melonDS.exe
- name: Save vcpkg cache
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/vcpkg_cache
key: vcpkg-x86_64-mingw-${{ hashFiles('vcpkg.json') }}

View File

@ -9,15 +9,12 @@ if (VCPKG_ROOT STREQUAL "${_DEFAULT_VCPKG_ROOT}")
endif() endif()
FetchContent_Declare(vcpkg FetchContent_Declare(vcpkg
GIT_REPOSITORY "https://github.com/Microsoft/vcpkg.git" GIT_REPOSITORY "https://github.com/Microsoft/vcpkg.git"
GIT_TAG 2ad004460f5db4d3b66f62f5799ff66c265c4b5d GIT_TAG HEAD
EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL
SOURCE_DIR "${CMAKE_SOURCE_DIR}/vcpkg") SOURCE_DIR "${CMAKE_SOURCE_DIR}/vcpkg")
FetchContent_MakeAvailable(vcpkg) FetchContent_MakeAvailable(vcpkg)
endif() endif()
set(VCPKG_OVERLAY_TRIPLETS "${CMAKE_SOURCE_DIR}/cmake/overlay-triplets")
set(VCPKG_OVERLAY_PORTS "${CMAKE_SOURCE_DIR}/cmake/overlay-ports/faad2")
option(USE_RECOMMENDED_TRIPLETS "Use the recommended triplets that are used for official builds" ON) option(USE_RECOMMENDED_TRIPLETS "Use the recommended triplets that are used for official builds" ON)
# Duplicated here because it needs to be set before project() # Duplicated here because it needs to be set before project()

View File

@ -1,4 +1,14 @@
{ {
"vcpkg-configuration": {
"default-registry": {
"kind": "git",
"repository": "https://github.com/Microsoft/vcpkg",
"baseline": "dd3097e305afa53f7b4312371f62058d2e665320",
"reference": "dd3097e305afa53f7b4312371f62058d2e665320"
},
"overlay-ports": [ "./cmake/overlay-ports" ],
"overlay-triplets": [ "./cmake/overlay-triplets" ]
},
"default-features": ["qt6"], "default-features": ["qt6"],
"dependencies": [ "dependencies": [
"sdl2", "sdl2",