Skip to content

Commit 2803fa2

Browse files
committed
ci(macos): surface ctest failures and ensure generic-family fonts
- workflow: run ctest with --output-on-failure --rerun-failed and dump LastTest.log on failure - tests: set WORKING_DIRECTORY=PROJECT_SOURCE_DIR for unit-tests so relative assets resolve - cmake/opensans.cmake: download one font per CSS generic family (sans-serif/serif/monospace/cursive/fantasy) via a shared helper
1 parent 11adeb2 commit 2803fa2

3 files changed

Lines changed: 73 additions & 28 deletions

File tree

.github/workflows/build-macos.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,12 @@ jobs:
134134
if: steps.changes.outputs.compiled == 'true' || steps.last.outputs.force == 'true'
135135

136136
- name: '🧪 Running Tests'
137-
run: ctest --test-dir ${{github.workspace}}/build
137+
run: |
138+
ctest --test-dir "${{ github.workspace }}/build" --output-on-failure --rerun-failed || {
139+
echo "==== LastTest.log ===="
140+
cat "${{ github.workspace }}/build/Testing/Temporary/LastTest.log" || true
141+
exit 1
142+
}
138143
if: steps.changes.outputs.compiled == 'true' || steps.last.outputs.force == 'true'
139144

140145
- name: '✅ Skip build (no compiled changes)'

cmake/opensans.cmake

Lines changed: 64 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,76 @@
11
# Copyright 2015,2026 AeonGames, Rodrigo Hernandez
22
# Licensed under the terms of the Apache 2.0 License.
33
#
4-
# Open Sans is licensed under the Apache License, Version 2.0.
5-
# https://github.com/google/fonts/blob/main/ofl/opensans/OFL.txt
6-
7-
set(OPENSANS_FONT_DIR "${CMAKE_BINARY_DIR}/bin/fonts")
8-
file(MAKE_DIRECTORY "${OPENSANS_FONT_DIR}")
4+
# Downloads at least one representative font for every CSS generic
5+
# font family so the test suite (and demos) always have something
6+
# for the FontDatabase to match against, regardless of the host's
7+
# system fonts. All fonts below are OFL or Apache 2.0 licensed.
8+
#
9+
# sans-serif -> Open Sans (Apache 2.0)
10+
# serif -> Noto Serif (OFL)
11+
# monospace -> Roboto Mono (Apache 2.0)
12+
# cursive -> Caveat (OFL)
13+
# fantasy -> Bungee (OFL)
14+
#
15+
# Files land in <build>/bin/fonts/ which FontDatabase auto-scans on
16+
# Initialize().
917

10-
set(OPENSANS_REGULAR "${OPENSANS_FONT_DIR}/OpenSans[wdth,wght].ttf")
11-
set(OPENSANS_ITALIC "${OPENSANS_FONT_DIR}/OpenSans-Italic[wdth,wght].ttf")
18+
set(AEONGUI_FONT_DIR "${CMAKE_BINARY_DIR}/bin/fonts")
19+
file(MAKE_DIRECTORY "${AEONGUI_FONT_DIR}")
1220

13-
if(NOT EXISTS "${OPENSANS_REGULAR}")
14-
message(STATUS "Downloading Open Sans (Regular)...")
15-
file(DOWNLOAD
16-
"https://github.com/google/fonts/raw/main/ofl/opensans/OpenSans%5Bwdth%2Cwght%5D.ttf"
17-
"${OPENSANS_REGULAR}"
18-
STATUS download_status
19-
SHOW_PROGRESS)
20-
list(GET download_status 0 download_status_code)
21-
if(download_status_code)
22-
file(REMOVE "${OPENSANS_REGULAR}")
23-
message(WARNING "Failed to download Open Sans Regular: ${download_status}")
21+
# _aeongui_download_font(<label> <url> <output-path>)
22+
#
23+
# Downloads <url> into <output-path> if the file does not already
24+
# exist. Removes a partial file and emits a warning on failure so
25+
# subsequent configures retry without breaking the build.
26+
function(_aeongui_download_font label url output)
27+
if(EXISTS "${output}")
28+
return()
2429
endif()
25-
endif()
26-
27-
if(NOT EXISTS "${OPENSANS_ITALIC}")
28-
message(STATUS "Downloading Open Sans (Italic)...")
30+
message(STATUS "Downloading ${label}...")
2931
file(DOWNLOAD
30-
"https://github.com/google/fonts/raw/main/ofl/opensans/OpenSans-Italic%5Bwdth%2Cwght%5D.ttf"
31-
"${OPENSANS_ITALIC}"
32+
"${url}"
33+
"${output}"
3234
STATUS download_status
3335
SHOW_PROGRESS)
3436
list(GET download_status 0 download_status_code)
3537
if(download_status_code)
36-
file(REMOVE "${OPENSANS_ITALIC}")
37-
message(WARNING "Failed to download Open Sans Italic: ${download_status}")
38+
file(REMOVE "${output}")
39+
message(WARNING "Failed to download ${label}: ${download_status}")
3840
endif()
39-
endif()
41+
endfunction()
42+
43+
# sans-serif
44+
_aeongui_download_font(
45+
"Open Sans (Regular)"
46+
"https://github.com/google/fonts/raw/main/ofl/opensans/OpenSans%5Bwdth%2Cwght%5D.ttf"
47+
"${AEONGUI_FONT_DIR}/OpenSans[wdth,wght].ttf")
48+
49+
_aeongui_download_font(
50+
"Open Sans (Italic)"
51+
"https://github.com/google/fonts/raw/main/ofl/opensans/OpenSans-Italic%5Bwdth%2Cwght%5D.ttf"
52+
"${AEONGUI_FONT_DIR}/OpenSans-Italic[wdth,wght].ttf")
53+
54+
# serif
55+
_aeongui_download_font(
56+
"Noto Serif"
57+
"https://github.com/google/fonts/raw/main/ofl/notoserif/NotoSerif%5Bwdth%2Cwght%5D.ttf"
58+
"${AEONGUI_FONT_DIR}/NotoSerif[wdth,wght].ttf")
59+
60+
# monospace
61+
_aeongui_download_font(
62+
"Roboto Mono"
63+
"https://github.com/google/fonts/raw/main/apache/robotomono/RobotoMono%5Bwght%5D.ttf"
64+
"${AEONGUI_FONT_DIR}/RobotoMono[wght].ttf")
65+
66+
# cursive
67+
_aeongui_download_font(
68+
"Caveat"
69+
"https://github.com/google/fonts/raw/main/ofl/caveat/Caveat%5Bwght%5D.ttf"
70+
"${AEONGUI_FONT_DIR}/Caveat[wght].ttf")
71+
72+
# fantasy
73+
_aeongui_download_font(
74+
"Bungee"
75+
"https://github.com/google/fonts/raw/main/ofl/bungee/Bungee-Regular.ttf"
76+
"${AEONGUI_FONT_DIR}/Bungee-Regular.ttf")

tests/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ else()
8282
PROPERTIES COMPILE_FLAGS "-DSOURCE_PATH=\"\\\"${PROJECT_SOURCE_DIR}\\\"\"")
8383
endif()
8484
add_test(NAME unit-tests COMMAND unit-tests)
85+
set_tests_properties(unit-tests PROPERTIES
86+
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
87+
)
8588

8689
# Test plugin shared library for SVGScriptElement tests
8790
add_library(test_plugin SHARED test_plugin.c)

0 commit comments

Comments
 (0)