Build harfbuzz and nativeaot afs.cmd with GHA #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build hb-subset | |
on: | |
push: | |
branches: [ "master" ] | |
paths: | |
- 'AssFontSubset.Core/**.cs' | |
- 'AssFontSubset.Core/**.csproj' | |
- 'AssFontSubset.Console/**.cs' | |
- 'AssFontSubset.Console/**.csproj' | |
pull_request: | |
branches: [ "master" ] | |
paths: | |
- 'AssFontSubset.Core/**.cs' | |
- 'AssFontSubset.Core/**.csproj' | |
- 'AssFontSubset.Console/**.cs' | |
- 'AssFontSubset.Console/**.csproj' | |
workflow_dispatch: | |
jobs: | |
build: | |
name: build-${{ matrix.target }}-${{ matrix.arch }} | |
runs-on: ${{ matrix.os }} | |
env: | |
identifier: ${{ matrix.target }}-${{ matrix.arch }} | |
strategy: | |
matrix: | |
harfbuzz_ver: ['10.1.0'] | |
target: [win, osx, linux-musl] | |
arch: [x64, arm64] | |
include: | |
- os: windows-latest | |
target: win | |
- os: windows-latest | |
target: linux-musl | |
- os: macos-latest | |
target: osx | |
steps: | |
- name: Set up cache | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: ./HarfBuzzBinding/target | |
key: hb-subset-${{ matrix.harfbuzz_ver }}-${{ env.identifier }}-static | |
restore-keys: | | |
hb-subset-${{ matrix.harfbuzz_ver }}-${{ env.identifier }}-static | |
- name: Check out code | |
if: steps.cache.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
- name: Prepare | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
python -m pip install meson ninja | |
cd ./HarfBuzzBinding | |
git clone --recurse-submodules https://github.com/harfbuzz/harfbuzz.git -b ${{ matrix.harfbuzz_ver }} --depth=1 harfbuzz-${{ matrix.harfbuzz_ver }} | |
- name: Setup msbuild (target windows x64) | |
if: matrix.target == 'win' && matrix.arch == 'x64' && steps.cache.outputs.cache-hit != 'true' | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Setup msbuild (target windows arm64) | |
if: matrix.target == 'win' && matrix.arch == 'arm64' && steps.cache.outputs.cache-hit != 'true' | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: amd64_arm64 | |
- name: Setup Zig Compiler (target linux) | |
if: matrix.target == 'linux-musl' && steps.cache.outputs.cache-hit != 'true' | |
uses: mlugg/setup-zig@v1 | |
with: | |
version: "master" | |
- name: Configure (windows-x64) | |
if: matrix.target == 'win' && matrix.arch == 'x64' && steps.cache.outputs.cache-hit != 'true' | |
run: | | |
cd ./HarfBuzzBinding/harfbuzz-${{ matrix.harfbuzz_ver }} | |
meson --native-file ../scripts/project.ini -Ddefault_library=static -Db_vscrt=static_from_buildtype build/${{ env.identifier }}-static | |
- name: Configure (windows-arm64) | |
if: matrix.target == 'win' && matrix.arch == 'arm64' && steps.cache.outputs.cache-hit != 'true' | |
run: | | |
cd ./HarfBuzzBinding/harfbuzz-${{ matrix.harfbuzz_ver }} | |
meson --cross-file ../scripts/project.ini --cross-file ../scripts/${{ env.identifier }}.ini -Ddefault_library=static -Db_vscrt=static_from_buildtype build/${{ env.identifier }}-static | |
- name: Configure (linux-musl) | |
if: matrix.target == 'linux-musl' && steps.cache.outputs.cache-hit != 'true' | |
run: | | |
cd ./HarfBuzzBinding/harfbuzz-${{ matrix.harfbuzz_ver }} | |
meson --native-file ../scripts/zig.ini --cross-file ../scripts/zig.ini --cross-file ../scripts/project.ini --cross-file ../scripts/${{ env.identifier }}.ini -Ddefault_library=static build/${{ env.identifier }}-static | |
- name: Configure (osx-arm64) | |
if: matrix.target == 'osx' && matrix.arch == 'arm64' && steps.cache.outputs.cache-hit != 'true' | |
run: | | |
cd ./HarfBuzzBinding/harfbuzz-${{ matrix.harfbuzz_ver }} | |
meson --native-file ../scripts/project.ini -Ddefault_library=static build/${{ env.identifier }}-static | |
- name: Configure (osx-x64) | |
if: matrix.target == 'osx' && matrix.arch == 'x64' && steps.cache.outputs.cache-hit != 'true' | |
run: | | |
cd ./HarfBuzzBinding/harfbuzz-${{ matrix.harfbuzz_ver }} | |
meson --cross-file ../scripts/project.ini --cross-file ../scripts/${{ env.identifier }}.ini -Ddefault_library=static build/${{ env.identifier }}-static | |
- name: Build | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
cd ./HarfBuzzBinding/harfbuzz-${{ matrix.harfbuzz_ver }} | |
meson compile -C build/${{ env.identifier }}-static | |
mkdir ../target | |
cp build/${{ env.identifier }}-static/src/*.a ../target/ | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: hb-subset-${{ matrix.harfbuzz_ver }}-${{ env.identifier }}-static | |
path: ./HarfBuzzBinding/target |