Skip to content

Build afs.cmd

Build afs.cmd #53

Workflow file for this run

name: Build afs.cmd
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, linux-musl, osx]
arch: [x64, arm64]
include:
- os: windows-latest
target: win
- os: windows-latest
target: linux-musl
- os: macos-latest
target: osx
dotnet_version: ['9.x']
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet_version }}
- name: Checkout
uses: actions/checkout@v4
# - name: Update submodule
# run: git submodule update --init --recursive
- name: Test
run: |
dotnet --version
cd ./AssFontSubset.CoreTests
dotnet restore
dotnet test
cd ..
- name: Setup Zig Compiler (target linux)
if: matrix.target == 'linux-musl'
uses: mlugg/setup-zig@v1
with:
version: "master"
- name: Add llvm-objcopy (target linux)
if: matrix.target == 'linux-musl'
run: |
Invoke-WebRequest -Uri https://github.com/MIRIMIRIM/FontFlat/releases/download/harfbuzz-libs/llvm-objcopy.exe -OutFile ./AssFontSubset.Console/llvm-objcopy.exe
- name: Use prebuilt harfbuzz subset
uses: actions/cache/restore@v4
with:
path: ./HarfBuzzBinding/target
key: hb-subset-${{ matrix.harfbuzz_ver }}-${{ env.identifier }}-static
fail-on-cache-miss: true
- name: Change to afs.cmd and Publish
if: matrix.target != 'linux-musl'
run: |
mkdir native
mv ./HarfBuzzBinding/target/* ./native/
cd ./AssFontSubset.Console
dotnet restore
dotnet publish -c Release -r ${{ env.identifier }} -f net9.0
cd ..
# need zig fix? https://github.com/ziglang/zig/pull/20081
- name: Change to afs.cmd and Publish (target linux)
if: matrix.target == 'linux-musl'
run: |
mkdir native
mv ./HarfBuzzBinding/target/* ./native/
cd ./AssFontSubset.Console
dotnet restore
dotnet publish -c Release -r ${{ env.identifier }} -f net8.0
cd ..
- name: Set short version
shell: bash
run: |
ver_short=`git rev-parse --short HEAD`
echo "VERSION=$ver_short" >> $GITHUB_ENV
- name: Upload exe files
if: matrix.target != 'linux-musl'
uses: actions/upload-artifact@v4
with:
name: AssFontSubset.Console_g${{ env.VERSION }}_${{ env.identifier }}
path: |
AssFontSubset.Console/bin/Release/net9.0/${{ env.identifier }}/publish/
!AssFontSubset.Console/bin/Release/net9.0/${{ env.identifier }}/publish/*.pdb
!AssFontSubset.Console/bin/Release/net9.0/${{ env.identifier }}/publish/*.dbg
!AssFontSubset.Console/bin/Release/net9.0/${{ env.identifier }}/publish/*.dwarf
!AssFontSubset.Console/bin/Release/net9.0/${{ env.identifier }}/publish/*.dsym
- name: Upload exe files
if: matrix.target == 'linux-musl'
uses: actions/upload-artifact@v4
with:
name: AssFontSubset.Console_g${{ env.VERSION }}_${{ env.identifier }}
path: |
AssFontSubset.Console/bin/Release/net8.0/${{ env.identifier }}/publish/
!AssFontSubset.Console/bin/Release/net8.0/${{ env.identifier }}/publish/*.pdb
!AssFontSubset.Console/bin/Release/net8.0/${{ env.identifier }}/publish/*.dbg
!AssFontSubset.Console/bin/Release/net8.0/${{ env.identifier }}/publish/*.dwarf
!AssFontSubset.Console/bin/Release/net8.0/${{ env.identifier }}/publish/*.dsym