33
44name : Build on Linux/macOS
55
6- # Drop permissions to minimum, for security
7- permissions :
8- contents : read
9-
106on :
117 pull_request :
128 push :
139 schedule :
1410 - cron : ' 0 3 * * 5' # Every Friday at 3am
1511 workflow_dispatch :
1612
13+ # Minimum permissions for security
14+ permissions :
15+ contents : read
16+
1717jobs :
1818 linux :
19- name : Build (${{ matrix.cc }} on ${{ matrix.runs-on }})
19+ name : Build (${{ matrix.cc }}/${{ matrix.make }} on ${{ matrix.runs-on }})
2020 runs-on : ${{ matrix.runs-on }}
2121 strategy :
2222 fail-fast : false
@@ -26,26 +26,37 @@ jobs:
2626 cxx : g++-13
2727 clang_major_version : null
2828 clang_repo_suffix : null
29+ make : make
2930 runs-on : ubuntu-22.04
3031 - cc : clang-17
3132 cxx : clang++-17
3233 clang_major_version : 17
3334 clang_repo_suffix : -17
35+ make : bmake
3436 runs-on : ubuntu-22.04
3537 - cc : clang-18
3638 cxx : clang++-18
3739 clang_major_version : 18
3840 clang_repo_suffix :
41+ make : bmake
3942 runs-on : ubuntu-22.04
43+ - cc : gcc-11
44+ cxx : g++-11
45+ clang_major_version : null
46+ clang_repo_suffix : null
47+ make : make
48+ runs-on : macos-12
4049 - cc : gcc-13
4150 cxx : g++-13
4251 clang_major_version : null
4352 clang_repo_suffix : null
53+ make : bmake
4454 runs-on : macos-12
4555 - cc : clang-15
4656 cxx : clang++-15
4757 clang_major_version : 15
4858 clang_repo_suffix : null
59+ make : bsdmake
4960 runs-on : macos-12
5061 steps :
5162 - name : Add Clang/LLVM repositories
@@ -61,14 +72,25 @@ jobs:
6172 run : |-
6273 sudo apt-get update
6374 sudo apt-get install --yes --no-install-recommends \
75+ bmake \
6476 libncurses-dev \
6577 pkg-config
6678
79+ - name : Install build dependencies
80+ if : " ${{ runner.os == 'macOS' }}"
81+ run : |-
82+ brew tap homebrew/cask-fonts
83+ brew install \
84+ bmake \
85+ bsdmake \
86+ coreutils
87+
6788 - name : Install build dependency Clang ${{ matrix.clang_major_version }}
6889 if : " ${{ runner.os == 'Linux' && contains(matrix.cxx, 'clang') }}"
6990 run : |-
7091 sudo apt-get install --yes --no-install-recommends -V \
71- clang-${{ matrix.clang_major_version }}
92+ clang-${{ matrix.clang_major_version }} \
93+ libclang-rt-${{ matrix.clang_major_version }}-dev
7294
7395 - name : Add versioned aliases for Clang ${{ matrix.clang_major_version }}
7496 if : " ${{ runner.os == 'macOS' && contains(matrix.cxx, 'clang') }}"
@@ -84,23 +106,74 @@ jobs:
84106 env :
85107 CC : ${{ matrix.cc }}
86108 CXX : ${{ matrix.cxx }}
109+ MAKE : ${{ matrix.make }}
87110 run : |-
88- CFLAGS='-std=gnu99 -pedantic -Werror' make all torture
111+ set -x
112+
113+ # macOS default linker does not seem to support --as-needed,
114+ # would error out saying "ld: unknown option: --as-needed"
115+ if [[ ${{ runner.os }} = macOS ]]; then
116+ as_needed=
117+ else
118+ as_needed='-Wl,--as-needed'
119+ fi
120+
121+ # ASan: https://clang.llvm.org/docs/AddressSanitizer.html
122+ # UBSan: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
123+ sanitizer='-fsanitize=address,undefined -fno-sanitize-recover=all'
124+
125+ ${MAKE} --version 2>/dev/null || true
126+
127+ CFLAGS="-std=gnu99 -pedantic -Werror ${sanitizer}" LDFLAGS="${as_needed} ${sanitizer}" ${MAKE}
89128
90129 - name : ' Install'
130+ env :
131+ MAKE : ${{ matrix.make }}
91132 run : |-
92133 set -x -o pipefail
93- make install DESTDIR="${PWD}"/ROOT/
134+ ${MAKE} install DESTDIR="${PWD}"/ROOT/
94135 find ROOT/ | sort | xargs ls -ld
95136
96137 - name : ' Uninstall'
138+ env :
139+ MAKE : ${{ matrix.make }}
97140 run : |-
98141 set -x
99- make uninstall DESTDIR="${PWD}"/ROOT/
142+ ${MAKE} uninstall DESTDIR="${PWD}"/ROOT/
100143 [[ "$(find ROOT/ -not -type d | tee /dev/stderr)" == '' ]] # i.e. fail CI if leftover files
101144
145+ - name : ' Run UI tests'
146+ run : |-
147+ ./recordings/record.sh
148+ rm -Rf recordings/venv/
149+
150+ - name : ' Upload UI test renderings for inspection'
151+ uses : actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
152+ with :
153+ name : ttyplot_ui_test_${{ github.sha }}_${{ matrix.runs-on }}_${{ matrix.cc }}_${{ matrix.make }}
154+ path : recordings/actual*
155+ if-no-files-found : error
156+
157+ - name : ' Evaluate UI test results'
158+ run : |-
159+ cat <<"EOF"
160+ ################################################################
161+ ## If this step FAILS you can get the expected ANSI screenshots
162+ ## back in sync with reality by running:
163+ ##
164+ ## $ ./recordings/get_back_in_sync.sh
165+ ##
166+ ## More details on the topic can be found in CONTRIBUTING.md .
167+ ################################################################
168+ EOF
169+
170+ diff -u recordings/{expected,actual}.txt
171+ rm -f recordings/actual.txt
172+
102173 - name : ' Clean'
174+ env :
175+ MAKE : ${{ matrix.make }}
103176 run : |-
104177 set -x -o pipefail
105- make clean
178+ ${MAKE} clean
106179 [[ "$(git ls-files -o | tee /dev/stderr | wc -l)" -eq 0 ]]
0 commit comments