Skip to content

Commit

Permalink
Update VS CI
Browse files Browse the repository at this point in the history
The VS ecosystem is poorly documented, specially for CI use. Although
the old VS CI code worked at some point, the ecosystem moved and broke
it. It has been largely rewritten to work in the present day. Cross
compilation and UWP testing are missing.

Some VS-specific bugs were exposed and fixed:
Don't install or test time macros on VS. Fix a warning on msvc.
  • Loading branch information
guijan committed Dec 27, 2024
1 parent 69e9eab commit 9cedc0a
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 41 deletions.
24 changes: 9 additions & 15 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,26 +256,20 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
cc: [clang, msvc]
api: [win32, uwp]
arch: [aarch64, amd64]
cc: [cl, clang-cl]
steps:
- uses: actions/[email protected]
- run: pip install meson
- run: pip install meson ninja
- uses: actions/[email protected]
- uses: ilammy/[email protected]
- name: build
run: |
if ("${{matrix.api}}" -eq "uwp") {
$uwp = "--cross-file=.github/workflows/meson-vs-uwp.txt"
pwsh -c {
$env:CC="${{ matrix.cc }}";
# Don't do debug builds because that triggers a Windows bug:
# https://developercommunity.visualstudio.com/t/_setmaxstdio-hangs-the-program-if-the/10164855?space=62&q=setmaxstdio&viewtype=all
meson setup build --buildtype=release -Dtest_system=true
}
if ("${{matrix.arch}}" -eq "aarch64") {
$arm = "--cross-file=.github/workflows/meson-vs-aarch64.txt"
}
# Don't do debug builds because that triggers a Windows bug:
# https://developercommunity.visualstudio.com/t/_setmaxstdio-hangs-the-program-if-the/10164855?space=62&q=setmaxstdio&viewtype=all
meson setup $uwp $arm $build $asan --buildtype=release --backend=vs `
--cross-file .github/workflows/meson-vs-${{matrix.cc}}.txt `
-Dtest_system=true build
meson compile -C build
- name: test
run: meson test --no-suite system -C build
Expand All @@ -284,5 +278,5 @@ jobs:
- uses: actions/[email protected]
if: always()
with:
name: meson-logs-vs-${{matrix.cc}}-${{matrix.api}}-${{matrix.arch}}
name: meson-logs-vs-${{matrix.cc}}
path: build/meson-logs
5 changes: 0 additions & 5 deletions .github/workflows/meson-vs-aarch64.txt

This file was deleted.

4 changes: 0 additions & 4 deletions .github/workflows/meson-vs-clang.txt

This file was deleted.

4 changes: 0 additions & 4 deletions .github/workflows/meson-vs-msvc.txt

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/meson-vs-uwp.txt

This file was deleted.

3 changes: 2 additions & 1 deletion src/header_generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ main(int argc, char *argv[])
*/
qsort(argv, argc, sizeof(*argv), compar_str);

wasblank = linebufsz = 0;
wasblank = 0;
linebufsz = 0;
line = NULL;
for (;;) {
if ((linelen = mygetline(&line, &linebufsz, stdin)) == -1) {
Expand Down
19 changes: 11 additions & 8 deletions src/time/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023 Guilherme Janczak <[email protected]>
# Copyright (c) 2023-2024 Guilherme Janczak <[email protected]>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
Expand Down Expand Up @@ -30,13 +30,16 @@ time_macros = [
]

time_needed = false
foreach macro : time_macros
if not cc.has_header_symbol('sys/time.h', macro, args: args,
dependencies: deps)
time_needed = true
break
endif
endforeach
if cc.has_type('struct timeval', prefix: '#include <sys/time.h>') and \
cc.has_type('struct timespec', prefix: '#include <time.h>')
foreach macro : time_macros
if not cc.has_header_symbol('sys/time.h', macro, args: args,
dependencies: deps)
time_needed = true
break
endif
endforeach
endif

time_incdir = []
time_man = []
Expand Down
9 changes: 7 additions & 2 deletions test/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022 Guilherme Janczak <[email protected]>
# Copyright (c) 2022, 2024 Guilherme Janczak <[email protected]>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
Expand All @@ -23,10 +23,15 @@ tests = [
'arc4random', 'arc4random_buf', 'arc4random_uniform', 'closefrom', 'daemon',
'err', 'errc', 'errx', 'explicit_bzero', 'memrchr', 'freezero', 'getopt',
'getprogname', 'pledge', 'reallocarray', 'recallocarray', 'setproctitle',
'strlcat', 'strlcpy', 'strsep', 'strtonum', 'time-macros', 'unveil', 'warn',
'strlcat', 'strlcpy', 'strsep', 'strtonum', 'unveil', 'warn',
'warnc', 'warnx',
]

if cc.has_type('struct timeval', prefix: '#include <sys/time.h>') and \
cc.has_type('struct timespec', prefix: '#include <time.h>')
tests += 'time-macros'
endif

foreach testname : tests
suite = []
if syms.contains(testname)
Expand Down

0 comments on commit 9cedc0a

Please sign in to comment.