diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd438cc7..1e477500 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,7 +51,8 @@ jobs: os: ${{ fromJSON(vars.TRACE_CI_RUNNERS == 'self-hosted' && '["ubuntu-latest","macos-latest"]' || '["ubuntu-latest","windows-latest","macos-latest"]') }} runtime: [MonoGame, FNA] # Under TRACE_CI_RUNNERS=self-hosted (docs/self-hosted-runners.md in Trace Arena) Linux legs run on the local x64 runner and - # macOS legs on the local macOS runner. + # macOS legs on the local macOS runner. The Linux steps that render through the Vulkan software renderer are skipped there: it + # crashes under x64 emulation ("rosetta error: mmap_anonymous_rw mmap failed"), and the native arm64 runner lacks the freetype native library. runs-on: ${{ vars.TRACE_CI_RUNNERS == 'self-hosted' && (matrix.os == 'macos-latest' && fromJSON('["self-hosted","macOS","ARM64"]') || fromJSON('["self-hosted","Linux","X64","yiazmat-linux-x64-emulated"]')) || matrix.os }} env: FORMA_RUNTIME: ${{ matrix.runtime }} @@ -94,13 +95,13 @@ jobs: run: | sudo apt-get update sudo apt-get install -y --no-install-recommends libegl1 libgl1 libgl1-mesa-dri libglx0 libglx-mesa0 mesa-vulkan-drivers vulkan-tools xvfb - software_icd=$(find /opt/google/chrome -name 'vk_swiftshader_icd.json' -print -quit) + software_icd=$(find /opt/google/chrome -name 'vk_swiftshader_icd.json' -print -quit 2>/dev/null || true) software_icd=${software_icd:-$(find /usr/share/vulkan/icd.d -name 'lvp_icd*.json' -print -quit)} test -n "$software_icd" echo "VK_ICD_FILENAMES=$software_icd" >> "$GITHUB_ENV" echo "VK_DRIVER_FILES=$software_icd" >> "$GITHUB_ENV" - name: Validate Linux selected runtime - if: runner.os == 'Linux' + if: runner.os == 'Linux' && vars.TRACE_CI_RUNNERS != 'self-hosted' shell: bash env: LIBGL_ALWAYS_SOFTWARE: 1 @@ -123,7 +124,7 @@ jobs: MonoGamePlatform=DesktopVK FormaNativeRuntime=true xvfb-run -a -s '-screen 0 1440x900x24 +extension GLX' dotnet run --project tests/Forma.SvgRenderSmoke/Forma.SvgRenderSmoke.csproj --configuration Release -p:FormaRuntime=MonoGame -p:MonoGamePlatform=DesktopVK -p:FormaNativeRuntime=true -p:SvgBackend=Skia fi - name: Validate Linux FNA video - if: runner.os == 'Linux' && matrix.runtime == 'FNA' + if: runner.os == 'Linux' && matrix.runtime == 'FNA' && vars.TRACE_CI_RUNNERS != 'self-hosted' shell: bash env: LIBGL_ALWAYS_SOFTWARE: 1 @@ -133,7 +134,7 @@ jobs: FNA3D_OPENGL_WINDOW_DEPTHSTENCILFORMAT: None run: env -u VK_ICD_FILENAMES -u VK_DRIVER_FILES xvfb-run -a -s '-screen 0 1440x900x24 +extension GLX' bash scripts/check-fna-video-smoke.sh - name: Compare Linux peer rendering - if: runner.os == 'Linux' && matrix.runtime == 'MonoGame' + if: runner.os == 'Linux' && matrix.runtime == 'MonoGame' && vars.TRACE_CI_RUNNERS != 'self-hosted' shell: bash env: LIBGL_ALWAYS_SOFTWARE: 1 @@ -273,7 +274,7 @@ jobs: run: | sudo apt-get update sudo apt-get install -y --no-install-recommends libegl1 libgl1 libgl1-mesa-dri libglx0 libglx-mesa0 mesa-vulkan-drivers xvfb - software_icd=$(find /opt/google/chrome -name 'vk_swiftshader_icd.json' -print -quit) + software_icd=$(find /opt/google/chrome -name 'vk_swiftshader_icd.json' -print -quit 2>/dev/null || true) software_icd=${software_icd:-$(find /usr/share/vulkan/icd.d -name 'lvp_icd*.json' -print -quit)} test -n "$software_icd" echo "VK_ICD_FILENAMES=$software_icd" >> "$GITHUB_ENV" @@ -282,6 +283,7 @@ jobs: env: LIBGL_ALWAYS_SOFTWARE: 1 SDL_VIDEODRIVER: x11 + FORMA_SKIP_FONT_XNB_CMP: ${{ vars.TRACE_CI_RUNNERS == 'self-hosted' && '1' || '' }} run: bash scripts/retry.sh env -u VK_ICD_FILENAMES -u VK_DRIVER_FILES xvfb-run -a -s '-screen 0 1440x900x24 +extension GLX' bash scripts/test-package-consumer.sh - uses: actions/upload-artifact@v7 with: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 192b5713..b9b0c951 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -128,6 +128,7 @@ jobs: shell: bash run: | pages_root="$RUNNER_TEMP/forma-pages" + git worktree prune if git ls-remote --exit-code origin refs/heads/gh-pages >/dev/null 2>&1; then git fetch origin gh-pages git worktree add "$pages_root" origin/gh-pages diff --git a/scripts/check-thorvg-linux.sh b/scripts/check-thorvg-linux.sh index b11a2109..df691929 100644 --- a/scripts/check-thorvg-linux.sh +++ b/scripts/check-thorvg-linux.sh @@ -5,9 +5,16 @@ repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" image="forma-thorvg-linux:local" docker build --platform linux/amd64 --file "$repo_root/scripts/Dockerfile.thorvg-linux" --tag "$image" "$repo_root" +# Inside a self-hosted runner container (Docker-outside-of-docker) the checkout is not a path the Docker host knows, so the +# container borrows this container's volumes and runs in the checkout instead of mounting it at /repo. +if [[ -f /.dockerenv && -n "${HOSTNAME:-}" ]]; then + repo_mount=(--volumes-from "$HOSTNAME" --workdir "$repo_root") +else + repo_mount=(--volume "$repo_root:/repo") +fi docker run --rm \ --platform linux/amd64 \ - --volume "$repo_root:/repo" \ + "${repo_mount[@]}" \ --env MESON=/usr/local/bin/meson \ --env THORVG_ARTIFACTS_DIR=/tmp/forma-thorvg-linux \ "$image" \ diff --git a/scripts/test-package-consumer.sh b/scripts/test-package-consumer.sh index eb56b36d..0fa8962a 100644 --- a/scripts/test-package-consumer.sh +++ b/scripts/test-package-consumer.sh @@ -27,11 +27,15 @@ for runtime in MonoGame FNA; do catalog_project="$repository_root/samples/Forma.Catalog.FNA/Forma.Catalog.FNA.csproj" fi dotnet build "$catalog_project" --configuration Release -p:FormaRuntime="$runtime" --nologo - for font_name in Catalog CatalogCode; do - cmp \ - "$repository_root/tests/Assets/Fonts/$font_name.xnb" \ - "$repository_root/samples/Forma.Catalog.$runtime/bin/$runtime/Release/net10.0/Content/Fonts/$font_name.xnb" - done + # The committed font binaries are byte-exact only on native x64 Linux. The local self-hosted runners (Apple Silicon: x64 under + # Rosetta, or native arm64) compile different bytes, so the CI workflow sets FORMA_SKIP_FONT_XNB_CMP there and hosted CI keeps the check. + if [[ -z "${FORMA_SKIP_FONT_XNB_CMP:-}" ]]; then + for font_name in Catalog CatalogCode; do + cmp \ + "$repository_root/tests/Assets/Fonts/$font_name.xnb" \ + "$repository_root/samples/Forma.Catalog.$runtime/bin/$runtime/Release/net10.0/Content/Fonts/$font_name.xnb" + done + fi done for runtime in MonoGame FNA; do