Skip to content

vcpkg Update

vcpkg Update #65

Workflow file for this run

name: vcpkg Update
concurrency:
group: vcpkg-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
workflow_call:
schedule:
# Weekly on Friday at 2:00 a.m.
- cron: '0 2 * * 5'
jobs:
vcpkg-packages:
# Checks for new vcpkg version and tries to build the update package versions
# On success it updates the vcpkg_ref file so the main builds use the cache
# with the latest version.
strategy:
matrix:
arch: [x64, x86]
name: Build vcpkg packages for ${{ matrix.arch }}
runs-on: windows-2022
env:
VCPKG_ROOT: C:\vcpkg
VCPKG_TARGET_TRIPLET: ${{ matrix.arch }}-windows-static
outputs:
result-x64: ${{ steps.build.outputs.result-x64 }}
result-x86: ${{ steps.build.outputs.result-x86 }}
vcpkg_ref: ${{ steps.prepare.outputs.vcpkg_ref }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Get vcpkg version
id: prepare
run: |
pushd ${{ env.VCPKG_ROOT }}
HEAD=$(git rev-parse --short HEAD)
popd
echo "Current HEAD is $HEAD"
echo "vcpkg_key=${{ hashFiles( './install-dependencies.sh' ) }}-${HEAD}" >> $GITHUB_OUTPUT
echo "vcpkg_ref=$HEAD" >> $GITHUB_OUTPUT
shell: bash
- name: Check whether cache exists
id: lookup
uses: actions/cache@v4
with:
# Explicit path here because env is overridden by msvc-dev-cmd
path: C:\vcpkg\installed
key: |
${{ steps.prepare.outputs.vcpkg_key }}-${{ matrix.arch }}
- name: Building packages
if: steps.lookup.outputs.cache-hit != 'true'
run: |
./install-dependencies.sh vcpkg --triplet=${{ env.VCPKG_TARGET_TRIPLET }}
shell: bash
- name: Configure MSVC development console
if: steps.lookup.outputs.cache-hit != 'true'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Compiler
id: build
if: steps.lookup.outputs.cache-hit != 'true'
env:
VCPKG_ROOT: C:\vcpkg
run: |
mkdir $env:GITHUB_WORKSPACE\build
cd $env:GITHUB_WORKSPACE\build
cmake.exe -G "NMake Makefiles" .. -DVCPKG_TARGET_TRIPLET=${{ env.VCPKG_TARGET_TRIPLET }} -DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DOPTION_BUILD_WEBSITE_TOOLS=OFF -DOPTION_BUILD_TESTS=ON -DOPTION_ASAN=OFF -DOPTION_BUILD_CODECHECK=OFF -DOPTION_BUILD_WINSTATIC=ON -DOPTION_USE_GLBINDING=ON -DOPTION_FORCE_EMBEDDED_MINIZIP=ON
nmake
echo "result-${{ matrix.arch }}=true" >> $env:GITHUB_OUTPUT
update:
needs: vcpkg-packages
# NOCOM: just once to force update
# if: ${{ github.repository == 'tothxa/widelands' && needs.vcpkg-packages.outputs.result-x64 && needs.vcpkg-packages.outputs.result-x86 }}
name: Update vcpkg_ref
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.VARIABLES_TOKEN }}
steps:
- name: Set variable
run: |
gh variable set VCPKG_REF -b "${{ needs.vcpkg-packages.outputs.vcpkg_ref }}"
echo "${{ needs.vcpkg-packages.outputs.vcpkg_ref }}" > vcpkg_ref
- name: Store in cache
uses: actions/cache/save@v4
with:
path: vcpkg_ref
key: vcpkg_ref-"${{ env.GITHUB_JOB }}-${{ needs.vcpkg-packages.outputs.vcpkg_ref }}"