Skip to content

ci: unbreak and stabilise the Windows main job - #1

Merged
justinjoy merged 2 commits into
mainfrom
fix/ci-windows-fopen-deprecation
May 6, 2026
Merged

ci: unbreak and stabilise the Windows main job#1
justinjoy merged 2 commits into
mainfrom
fix/ci-windows-fopen-deprecation

Conversation

@justinjoy

@justinjoy justinjoy commented May 6, 2026

Copy link
Copy Markdown
Collaborator

Two atomic commits, both targeting the Windows main-CI job.

1. tests: silence MSVC fopen deprecation in test_lexer

-Werror build on clang-cl flagged tests/test_lexer.c:57's fopen() as -Wdeprecated-declarations (MSVC's CRT prefers Annex K fopen_s). Annex K *_s variants are not portable to glibc/musl, so the call site is left as-is and _CRT_SECURE_NO_WARNINGS is defined for the test target only when the compiler uses MSVC argument syntax.

2. ci: persist Windows vcpkg cache even when build/test fails

actions/cache@v5's combined action runs save as a post-step skipped when the job fails. Every previous Main run failed at the build step → no cache was ever saved (gh cache list showed zero entries) → every subsequent run rebuilt glib from source. Switched to the split cache/restore + cache/save pattern (already used on the PR workflow), with save before configure so the cache is committed regardless of later step outcomes.

Test plan

  • Local meson setup -Ddefault_library=static -Dwerror=true && meson test --suite unit green (Linux, gcc).
  • python3 -c "yaml.safe_load(...)" confirms ci-main.yml is valid YAML.
  • CI on this PR: build-windows, build-macos-latest, build-ubuntu-latest all green.
  • After merge: next Main run saves the vcpkg cache; the run after that hits it (visible as a sub-minute "Restore vcpkg ..." step duration).

justinjoy added 2 commits May 6, 2026 11:34
MSVC's CRT marks fopen() as deprecated in favour of the Annex K *_s
variants, which are not portable to glibc/musl. clang-cl inherits the
same warning under MSVC argument syntax, so the Windows main-CI build
fails under -Werror at tests/test_lexer.c:57. Define
_CRT_SECURE_NO_WARNINGS only for this test target so the production
library stays unaffected.
actions/cache@v5's combined action runs save as a post-step that is
skipped when the job fails. The first runs of CI Main on this repo all
failed at "Build and test (clang-cl)" so the post-save was never
executed and the vcpkg binary + installed-tree caches were never
persisted; every subsequent main run still missed and rebuilt glib from
source. gh cache list shows zero caches as a result.

Switch the Windows job to the split actions/cache/restore@v5 +
actions/cache/save@v5 pattern (already in use on the PR workflow), with
save running before configure so the cache is committed regardless of
later step outcomes. Save steps are gated on cache-hit and marked
continue-on-error so a save race does not red the run.
@justinjoy justinjoy changed the title tests: silence MSVC fopen deprecation in test_lexer ci: unbreak and stabilise the Windows main job May 6, 2026
@justinjoy
justinjoy merged commit efa3afc into main May 6, 2026
3 checks passed
@justinjoy
justinjoy deleted the fix/ci-windows-fopen-deprecation branch June 29, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant