blob: 5138af74eed3a44db6f2a034695f5ba107f97f11 [file] [edit]
name: msvc
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
msvc:
runs-on: ${{ matrix.os }}
env:
MSVC_DEPS_PREFIX: ${{ github.workspace }}/msvc-deps-install
strategy:
fail-fast: false
matrix:
include:
- name: msvc-2025-x86
os: windows-2025
ARCH: x86
OPTIMIZATION: 1
- name: msvc-2025-amd64
os: windows-2025
ARCH: amd64
OPTIMIZATION: 3
name: ${{ matrix.name }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Ccache
id: compiler-cache
uses: ./.github/actions/compiler-cache
with:
variant: sccache
key: ${{ github.job }}-${{ matrix.os }}-${{ matrix.ARCH }}
- name: Setup Python
id: python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: '3.12'
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
with:
arch : ${{ matrix.ARCH }}
- name: Install Python Dependencies
run: |
pip3 install -r .ci/requirements.txt --require-hashes
- name: Install pkg-config
run: choco install pkgconfiglite --version=0.28 --yes --no-progress
- name: Identify MSVC Toolset
id: msvc-version
run: |
"version=$((Get-Item (Get-Command cl.exe).Source).VersionInfo.FileVersion)" >> $env:GITHUB_OUTPUT
"sdk=$($env:WindowsSDKVersion.TrimEnd('\'))" >> $env:GITHUB_OUTPUT
- name: Cache Installed Dependencies
id: msvc-deps
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ env.MSVC_DEPS_PREFIX }}
key: msvc-deps-${{ matrix.os }}-${{ matrix.ARCH }}-${{ steps.msvc-version.outputs.version }}-${{ steps.msvc-version.outputs.sdk }}-${{ steps.python.outputs.python-version }}-${{ hashFiles('subprojects/**/*.wrap', 'subprojects/packagefiles/**', '.ci/msvc-deps/**', '.ci/requirements.txt') }}
- name: Build Dependencies
if: steps.msvc-deps.outputs.cache-hit != 'true'
run: |
$source = Join-Path $env:RUNNER_TEMP harfbuzz-msvc-deps
Copy-Item .ci/msvc-deps $source -Recurse
New-Item -ItemType Directory "$source/subprojects"
Copy-Item subprojects/*.wrap "$source/subprojects"
if (Test-Path subprojects/packagefiles) {
Copy-Item subprojects/packagefiles "$source/subprojects/packagefiles" -Recurse
}
# Keep dependency build options in .ci/msvc-deps so the cache key tracks them.
meson setup build-msvc-deps $source --prefix="$env:MSVC_DEPS_PREFIX" --wrap-mode=forcefallback
meson compile -Cbuild-msvc-deps
meson install -Cbuild-msvc-deps --no-rebuild
- name: Use Installed Dependencies
run: |
"$env:MSVC_DEPS_PREFIX/bin" >> $env:GITHUB_PATH
"PKG_CONFIG_PATH=$env:MSVC_DEPS_PREFIX/lib/pkgconfig" >> $env:GITHUB_ENV
- name: Setup Meson
run: |
sccache --version
pkg-config --modversion glib-2.0 freetype2
meson setup build `
--wrap-mode=nofallback `
--buildtype=release `
-Doptimization=${{ matrix.OPTIMIZATION }} `
-Db_ndebug=true `
-Dglib=enabled `
-Dcairo=disabled `
-Dicu=disabled `
-Dfreetype=enabled `
-Dgdi=enabled `
-Ddirectwrite=enabled `
-Dgpu_demo=disabled
- name: Build
run: meson compile -Cbuild
- name: Test
run: meson test --print-errorlogs --suite=harfbuzz -Cbuild
- name: Save Compiler Cache
if: ${{ !cancelled() && steps.compiler-cache.outcome == 'success' }}
uses: ./.github/actions/save-compiler-cache
with:
key: ${{ steps.compiler-cache.outputs.key }}
variant: ${{ steps.compiler-cache.outputs.variant }}
start: ${{ steps.compiler-cache.outputs.start }}