1
+ name : build
2
+ # GitHub action to compile atf on ubuntu-24.04 (amd64) and macos-latest (aarch64)
3
+ # * set-up prerequisites
4
+ # * configure && make && make check && make install
5
+ # * upload installed binaries as well as kyua reports as build artefact
6
+ #
7
+ # We run in a matrix with os/sanitize flags.
8
+
9
+ on :
10
+ pull_request :
11
+ branches :
12
+ - main
13
+ push :
14
+ workflow_dispatch :
15
+
16
+ permissions :
17
+ contents : read
18
+
19
+ jobs :
20
+ build :
21
+ name : build ${{ join(matrix.sanitize, '+') }} ${{ matrix.build-os }} ${{ matrix.compiler }}
22
+ runs-on : " ${{ matrix.build-os }}"
23
+ strategy :
24
+ fail-fast : false
25
+ matrix :
26
+ build-os :
27
+ - ubuntu-24.04
28
+ - macos-latest
29
+ sanitize :
30
+ - []
31
+ include :
32
+ - build-os : macos-latest
33
+ compiler : clang-19
34
+ pkgs :
35
+ - llvm@19
36
+ - automake
37
+ - libtool # for AC
38
+ # - pkgconf pre-installed on GH
39
+ llvm-bindir : /opt/homebrew/opt/llvm@19/bin
40
+ - build-os : ubuntu-24.04
41
+ compiler : clang-18
42
+ pkgs :
43
+ - clang-18
44
+ - automake
45
+ - libtool
46
+ - kyua
47
+ - pkgconf
48
+ llvm-bindir : /usr/lib/llvm-18/bin
49
+ steps :
50
+ - name : install packages (macOS)
51
+ if : runner.os == 'macOS'
52
+ run : |
53
+ # on MacOS we build with
54
+ # * latest clang@19 from brew (system provided clang lacks sanitizers)
55
+ # * ld from system
56
+ #
57
+
58
+ brew update --quiet || true
59
+ brew install ${{ join(matrix.pkgs, ' ') }}
60
+
61
+ # kyua was kicked out of brew due to lack of activity
62
+ # we patch away the disabled line and install the last built binary version
63
+ # note that it cannot be rebuilt as compiler defaults have changed
64
+ curl https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/k/kyua.rb | sed 's/[[:space:]]*disable!.*$//' > kyua.rb
65
+ brew install --formula ./kyua.rb
66
+
67
+ - name : install packages (Linux)
68
+ if : runner.os == 'Linux'
69
+ run : |
70
+ sudo apt-get update --quiet || true
71
+ sudo apt-get -yq --no-install-suggests --no-install-recommends install ${{ join(matrix.pkgs, ' ') }}
72
+ - uses : actions/checkout@v4
73
+ with :
74
+ path : src.atf
75
+ - name : setup environment
76
+ run : |
77
+ echo "CC=${{ matrix.llvm-bindir }}/clang" >> "${GITHUB_ENV}"
78
+ echo "CXX=${{ matrix.llvm-bindir }}/clang++" >> "${GITHUB_ENV}"
79
+ echo "CPP=${{ matrix.llvm-bindir }}/clang-cpp" >> "${GITHUB_ENV}"
80
+ echo "AR=${{ matrix.llvm-bindir }}/llvm-ar" >> "${GITHUB_ENV}"
81
+ echo "OBJDUMP=${{ matrix.llvm-bindir }}/llvm-objdump" >> "${GITHUB_ENV}"
82
+ echo "STRIP=${{ matrix.llvm-bindir }}/llvm-strip" >> "${GITHUB_ENV}"
83
+ echo "RANLIB=${{ matrix.llvm-bindir }}/llvm-ranlib" >> "${GITHUB_ENV}"
84
+ echo "NM=${{ matrix.llvm-bindir }}/llvm-nm" >> "${GITHUB_ENV}"
85
+ echo "SRC_ATF=${GITHUB_WORKSPACE}/src.atf" >> "${GITHUB_ENV}"
86
+ echo "BUILD_ATF=${GITHUB_WORKSPACE}/build.atf" >> "${GITHUB_ENV}"
87
+ echo "INST_ATF=${GITHUB_WORKSPACE}/inst.atf" >> "${GITHUB_ENV}"
88
+ echo "NPROC=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1`" >> "${GITHUB_ENV}"
89
+
90
+ - name : build atf
91
+ run : |
92
+ CFG_OPTS="--disable-dependency-tracking"
93
+ CFG_OPTS="${CFG_OPTS} --prefix=${INST_ATF}"
94
+ for i in ${{ join(matrix.sanitize, ' ') }}; do
95
+ CFG_OPTS="${CFG_OPTS} --enable-${i}"
96
+ done
97
+ echo Building atf with ${{ matrix.sanitize }} .. ${CFG_OPTS}
98
+ echo uname -a: $(uname -a)
99
+ echo uname -m: $(uname -m)
100
+ echo uname -p: $(uname -p)
101
+ kyua about | head -1
102
+ echo NPROC="${NPROC}"
103
+ echo CC="${CC}"
104
+ echo CPP="${CPP}"
105
+ echo PKG_CONFIG_PATH="${PKG_CONFIG_PATH}"
106
+ echo SRC_ATF="${SRC_ATF}"
107
+ echo BUILD_ATF="${BUILD_ATF}"
108
+ echo INST_ATF="${INST_ATF}"
109
+
110
+ cd "${SRC_ATF}"
111
+ autoreconf -isv -I/usr/local/share/aclocal
112
+
113
+ mkdir -p "${BUILD_ATF}"
114
+ cd "${BUILD_ATF}"
115
+ ${SRC_ATF}/configure ${CFG_OPTS}
116
+ make -j${NPROC} | tee make-all.log
117
+
118
+ - name : install&check atf
119
+ run : |
120
+ set +e
121
+ echo Installing and Checking atf
122
+ cd "${BUILD_ATF}"
123
+ make install installcheck-kyua
124
+ check_exit=$?
125
+
126
+ cd "${INST_ATF}/tests/atf"
127
+ if [ $check_exit -eq 0 ]; then
128
+ echo "# ✅ All mandatory checks passed" >> $GITHUB_STEP_SUMMARY
129
+ # kyua report
130
+ else
131
+ echo "# ❌ Some checks failed" >> $GITHUB_STEP_SUMMARY
132
+ echo "::error file=.github/workflows/build.yaml,line=173,endLine=173,title=Checks failed!::make check failed"
133
+ # kyua report --verbose
134
+ fi
135
+
136
+ # example run with tweaks
137
+ # running one test directly without overriding exitcode and not logging to stderr
138
+ ASAN_OPTIONS=exitcode=0:log_path=$PWD/testlog kyua debug atf-c++/atf_c++_test:include
139
+ cat testlog.*
140
+
141
+ kyua report --results-filter=xfail,broken,failed | sed 's/===>/##/' >> $GITHUB_STEP_SUMMARY
142
+ if [ $check_exit -ne 0 ]; then
143
+ kyua report --verbose --results-filter=xfail,broken,failed | sed 's/===>/##/' >> $GITHUB_STEP_SUMMARY
144
+ fi
145
+
146
+ kyua report-html --output ${BUILD_ATF}/html # produces html subdirectory
147
+ # also include plain text
148
+ kyua report --verbose --results-filter=xfail,broken,failed > ${BUILD_ATF}/html/test-reportfailed.txt
149
+ # also include plain JUnit
150
+ kyua report-junit --output ${BUILD_ATF}/html/test-reportfailed.xml
151
+ # also include the kyua log
152
+ cp -a ~/.kyua/logs ${BUILD_ATF}/html/
153
+
154
+ exit $check_exit
155
+
156
+ - name : tar install archive
157
+ run : |
158
+ test -d ${INST_ATF} && tar cvf atf-${{ matrix.build-os }}-${{ matrix.compiler }}.tar -C ${INST_ATF} .
159
+ if : ${{ success() && '' == join(matrix.sanitize, '') }} # only install successful non-debug builds
160
+
161
+ - name : tar test reports
162
+ run : |
163
+ tar cvf atf-${{ matrix.build-os }}-${{ matrix.compiler }}-report${{ join(matrix.sanitize, '_') }}.tar -C "${BUILD_ATF}/html" .
164
+ if : ${{ always() }}
165
+
166
+ - name : archive build artefacts
167
+ uses : actions/upload-artifact@v4
168
+ with :
169
+ name : atf-test${{ join(matrix.sanitize, '_') }}-${{ matrix.build-os }}-${{ matrix.compiler }}
170
+ path : atf*.tar
171
+ compression-level : 0
172
+ retention-days : 10
173
+ overwrite : true
174
+ if : ${{ always() }}
0 commit comments