forked from BoGanon/masp
-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (99 loc) · 3.39 KB
/
compilation.yml
File metadata and controls
114 lines (99 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Compilation
on:
push:
pull_request:
repository_dispatch:
types: [run_build]
workflow_dispatch: {}
jobs:
build:
runs-on: ${{ matrix.os[0] }}
strategy:
matrix:
os: [
[macos-latest, arm64, bash],
[macos-15-intel, x86_64, bash],
[ubuntu-latest, x86_64, bash],
[windows-latest, x86_64, msys2]
]
debug: [RelWithDebInfo]
sanitizer: [none, asan]
exclude:
- os: [windows-latest, x86_64, msys2]
sanitizer: asan
fail-fast: false
defaults:
run:
shell: ${{ matrix.os[2] }} {0}
steps:
- uses: actions/checkout@v4
- name: Install Ubuntu packages
if: matrix.os[0] == 'ubuntu-latest'
run: |
sudo apt-get -y update
sudo apt-get -y install cmake
- name: Install macOS packages (brew)
if: startsWith(matrix.os[0], 'macos-')
run: |
brew update
brew install cmake
# MacPorts path not used in current matrix; keep commented sample if needed
- name: Install MSYS2 packages
if: matrix.os[0] == 'windows-latest'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW32
install: |
base-devel git
mingw-w64-i686-gcc mingw-w64-i686-make mingw-w64-i686-cmake
mingw-w64-i686-libgnurx
update: true
- name: Compile MASP
run: |
export PS2DEV=$PWD/ps2dev
export PATH="$PS2DEV/bin:$PATH"
if [ "${{ matrix.sanitizer }}" = "asan" ]; then
# Enable ASAN and also add UBSan
export SAN="-fsanitize=undefined"
export EXTRA_CMAKE_FLAGS="-DENABLE_ASAN=ON -DCMAKE_C_FLAGS='$SAN' -DCMAKE_EXE_LINKER_FLAGS='$SAN'"
else
# Build without sanitizers
export EXTRA_CMAKE_FLAGS="-DENABLE_ASAN=OFF"
fi
cmake -B build-cmake -DCMAKE_BUILD_TYPE=${{ matrix.debug }} -DCMAKE_INSTALL_PREFIX=$PS2DEV ${EXTRA_CMAKE_FLAGS}
cmake --build build-cmake --config ${{ matrix.debug }}
- name: Run unit tests (ctest)
run: |
if [ "${{ matrix.sanitizer }}" = "asan" ]; then
# Enable ASAN checks; leak detection disabled for macOS compatibility
export EXTRA_ASAN_OPTIONS="check_initialization_order=1:strict_string_checks=1:print_stacktrace=1:detect_leaks=0"
export ASAN_OPTIONS=$EXTRA_ASAN_OPTIONS
fi
ctest --test-dir build-cmake -C ${{ matrix.debug }} --output-on-failure
- name: Upload artifacts
if: ${{ success() }}
uses: actions/upload-artifact@v4
with:
name: masp-${{ matrix.debug }}-${{ matrix.os[0] }}-${{ matrix.os[1] }}-${{ matrix.sanitizer }}
path: build-cmake/src/masp
build-alpine:
runs-on: ubuntu-latest
container: alpine:latest
steps:
- uses: actions/checkout@v4
- name: Install Alpine packages
run: |
apk add --no-cache build-base cmake git
- name: Compile MASP (Alpine, no sanitizers)
run: |
cmake -B build-cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_ASAN=OFF
cmake --build build-cmake --config RelWithDebInfo
- name: Run unit tests (ctest)
run: |
ctest --test-dir build-cmake -C RelWithDebInfo --output-on-failure
- name: Upload artifacts
if: ${{ success() }}
uses: actions/upload-artifact@v4
with:
name: masp-RelWithDebInfo-alpine-x86_64-none
path: build-cmake/src/masp