-
Notifications
You must be signed in to change notification settings - Fork 118
142 lines (127 loc) · 4.44 KB
/
linux.yml
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Linux Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types:
- published
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install clang-format
uses: ./.github/actions/install-llvm
with:
packages: clang-format-16
- name: Format files
run: find include test -type f -a \( -name "*.cc" -o -name "*.h" \) -print0 | xargs -0 clang-format-16 -i
- name: Check for differences
run: |
git status --porcelain
git status --porcelain | xargs -I {} -0 test -z \"{}\"
build:
runs-on: ubuntu-latest
strategy:
matrix:
config:
- name: GCC 11 Release
cxx: g++-11
cc: gcc-11
mode: Release
- name: GCC 11 Debug
cxx: g++-11
cc: gcc-11
mode: Debug
valgrind: true
- name: Clang 16 Release
cxx: clang++-16
cc: clang-16
mode: Release
cxxflags: -stdlib=libc++
ldflags: -lc++abi
- name: Clang 16 Debug
cxx: clang++-16
cc: clang-16
mode: Debug
fuzz: true
- key: GCC 11 Sanitizer
cxx: g++-11
cc: gcc-11
mode: Debug
cflags: -fsanitize=address,undefined -fno-omit-frame-pointer
cxxflags: -fsanitize=address,undefined -fno-omit-frame-pointer
env:
UBSAN_OPTIONS: halt_on_error=1:abort_on_error=1
steps:
- uses: actions/checkout@v3
- name: Install Ninja
env:
DEBIAN_FRONTEND: noninteractive
run: sudo apt-get install -y --no-install-recommends ninja-build
# ==== INSTALL ====
- name: Install Clang
uses: ./.github/actions/install-llvm
with:
packages: libstdc++-12-dev libc++-16-dev libc++abi-16-dev clang-tidy-16 libunwind-16-dev llvm-16 libfuzzer-16-dev
# ==== BUILD ====
- name: CMake
run: |
cmake \
-G Ninja -S . -B build \
-DCMAKE_C_COMPILER=${{ matrix.config.cc }} \
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
-DCMAKE_C_FLAGS="${{ matrix.config.cflags }}" \
-DCMAKE_CXX_FLAGS="${{ matrix.config.cxxflags }}" \
-DCMAKE_CXX_LINKER_FLAGS=${{ matrix.config.ldflags }}" \
-DCMAKE_CXX_EXE_LINKER_FLAGS="${{ matrix.config.ldflags }} \
-DCMAKE_BUILD_TYPE=${{ matrix.config.mode }} \
-DCISTA_ZERO_OUT=${{ matrix.config.mode == 'Debug' && matrix.config.cc == 'gcc-11' }}
- name: Build
run: cmake --build build --target cista-test cista-test-single-header
# ==== TESTS ====
- name: Run Tests
run: ./build/cista-test
- name: Run Single Header Tests
run: ./build/cista-test-single-header
# ==== VALGRIND ====
- name: Install Valgrind
if: matrix.config.valgrind
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends valgrind
- name: Run Single Header Tests Valgrind
if: matrix.config.valgrind
run: valgrind --error-exitcode=1 --show-reachable=yes --leak-check=full ./build/cista-test
- name: Run Single Header Tests Tests Valgrind
if: matrix.config.valgrind
run: valgrind --error-exitcode=1 --show-reachable=yes --leak-check=full ./build/cista-test-single-header
# ==== FUZZ ====
- name: Fuzzing
if: matrix.config.fuzz
run: cmake --build build --target cista-fuzz
# ==== DISTRIBUTION ====
- name: Upload Distribution
if: matrix.config.mode == 'Release' && matrix.config.cc == 'gcc-11'
uses: actions/upload-artifact@v1
with:
name: cista.h
path: build/cista.h
# ==== RELEASE ====
- name: Upload Release
if: github.event.action == 'published' && matrix.config.mode == 'Release' && matrix.config.cc == 'gcc-11'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./build/cista.h
asset_name: cista.h
asset_content_type: text/plain