a bit more cleaning #182
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: cooljeanius/emacs-apple | |
on: | |
push: | |
branches: | |
- "**/*" | |
pull_request: | |
jobs: | |
test: | |
runs-on: macos-13 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- run: brew analytics on && brew update | |
- name: Install Homebrew dependencies | |
env: | |
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 | |
HOMEBREW_VERBOSE_USING_DOTS: 1 | |
run: | | |
set -x | |
brew install make automake gettext texinfo gawk coreutils gnu-sed \ | |
gnu-which libstxxl rsync libtool | |
if test "${{ matrix.compiler }}" = "gcc"; then \ | |
brew install lcov libgccjit mingw-w64; \ | |
elif test "${{ matrix.compiler }}" = "clang"; then \ | |
brew install clang-build-analyzer clang-format; \ | |
elif test -n "${{ matrix.compiler }}"; then \ | |
echo "Unknown compiler ${{ matrix.compiler }} may or may not need additional deps…"; \ | |
else \ | |
echo "OK, that should be it; no additional dependencies needed."; \ | |
fi | |
- name: Initial build | |
run: | | |
if test -n "${{ matrix.compiler }}"; then \ | |
echo "This is the ${{ matrix.compiler }} build."; \ | |
which -a ${{ matrix.compiler }} || gwhich -a ${{ matrix.compiler }}; \ | |
else \ | |
echo "matrix.compiler unset (possibly wrong variable?)"; \ | |
fi | |
sh ./autogen.sh | |
env | uniq | sort | uniq | grep -v "\*\*\*" | grep -v "PWD\=" | |
if test "${{ matrix.compiler }}" = "gcc"; then \ | |
./configure --enable-silent-rules --disable-autodepend \ | |
--enable-gcc-warnings --enable-better-debugging \ | |
--with-x-toolkit=no --disable-dependency-tracking --with-ns \ | |
--enable-gcc-link-time-optimization \ | |
CC=gcc CXX=g++ OBJC=gcc OBJCXX=g++; \ | |
elif test "${{ matrix.compiler }}" = "clang"; then \ | |
./configure --enable-silent-rules --disable-autodepend \ | |
--enable-gcc-warnings --enable-better-debugging \ | |
--with-x-toolkit=no --disable-dependency-tracking --with-ns \ | |
--enable-clang-link-time-optimization \ | |
CC=clang CXX=clang++ OBJC=clang OBJCXX=clang++; \ | |
else \ | |
./configure --enable-silent-rules --disable-autodepend \ | |
--enable-gcc-warnings --enable-better-debugging \ | |
--with-x-toolkit=no --disable-dependency-tracking --with-ns; \ | |
fi | |
make gnulib_headers || (stat lib/Makefile && wc -l lib/Makefile) | |
if test -x "$(which gmake)" && test -x "$(which nproc)" && test -n "$(nproc)"; then \ | |
echo "attempting parallel build with $(nproc) jobs..."; \ | |
if test -x "$(which scan-build)" && test "${{ matrix.compiler }}" = "clang" && test -d /tmp && test -w /tmp; then \ | |
echo "...and running the build under $(which scan-build)..."; \ | |
scan-build -o /tmp gmake -j"$(nproc)" --output-sync only_temacs; \ | |
else \ | |
echo "...(a parallel build of the regular kind, that is)..."; \ | |
gmake -j"$(nproc)" --output-sync only_temacs; \ | |
fi; \ | |
else \ | |
echo "warning: on the slow path..."; \ | |
if test -x "$(which scan-build)" && test "${{ matrix.compiler }}" = "clang" && test -d /tmp && test -w /tmp; then \ | |
echo "attempting to build under $(which scan-build)..."; \ | |
scan-build -o /tmp make only_temacs; \ | |
else \ | |
make only_temacs; \ | |
fi; \ | |
fi | |
ls src/*emacs | |
cd lisp && make update-subdirs | |
- run: sync && make all_only_c && sync && find . -name '*.o' -print | |
if: "${{ success() }}" | |
- name: Build docs | |
if: "${{ success() }}" | |
env: | |
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 | |
HOMEBREW_VERBOSE: 1 | |
HOMEBREW_VERBOSE_USING_DOTS: 1 | |
run: | | |
if test -d doc && test -w doc && test -x "$(which makeinfo)" && test -x "$(which brew)" && test -x "$(which nproc)" && test -n "$(nproc)" && test "$(nproc)" -ge 2 && test -x "$(which make)" && test -r doc/Makefile && test -x "$(which texi2dvi)" && test -x "$(which texi2pdf)" && test -x "$(which dvips)"; then \ | |
echo "using $(which makeinfo) for makeinfo w/the following vers. info: $(makeinfo --version)"; \ | |
brew install texlive; \ | |
echo "nproc says we can use $(nproc) build jobs."; \ | |
make -j"$(nproc)" -C doc || make -C doc || \ | |
(make -C doc/emacs && make -C doc/lispintro && make -C doc/lispref && make -C doc/man); \ | |
if [ $? -ge 1 ]; then \ | |
echo "giving doc/misc another try"; \ | |
pushd doc/misc; \ | |
make echo-info; \ | |
make dvi; \ | |
make html; \ | |
make pdf; \ | |
make ps; \ | |
make dist; \ | |
popd; \ | |
else \ | |
echo "so much for doc/misc..."; \ | |
fi; \ | |
else \ | |
true || type true; \ | |
if test -x "$(which sync)"; then sync; fi; \ | |
echo "skipping building docs (due to 1 of many possible reasons)…"; \ | |
if test -d . && test -r doc/Makefile && test -w /dev/stdout; then \ | |
pwd && stat doc/Makefile && wc -l doc/Makefile && du doc/Makefile; \ | |
elif test -e doc/Makefile; then \ | |
stat doc/Makefile || wc -l doc/Makefile || du doc/Makefile; \ | |
elif test -d doc; then \ | |
ls -R doc; \ | |
else \ | |
sleep 1; \ | |
fi | |
fi | |
- name: Apple stuff | |
if: "${{ success() }}" | |
run: | | |
make install_source | |
if test "${{ matrix.compiler }}" = "clang" || test -n "$(gcc --version | grep clang)"; then \ | |
if test -x "$(which nproc)" && test -n "$(nproc)" && test "$(nproc)" -gt 1; then \ | |
make -j"$(nproc)" -C src check || \ | |
make -j"$(nproc)" -ki -C src check; \ | |
make -j"$(nproc)" -C lib-src all-plist || \ | |
make -j"$(nproc)" -ki -C lib-src all-plist; \ | |
make -j"$(nproc)" apple_helper_executables \ | |
MAC_VERS_CFLAGS="-mmacosx-version-min=10.7 -stdlib=libc++"; \ | |
make -j"$(nproc)" apple_check \ | |
MAC_VERS_CFLAGS="-mmacosx-version-min=10.7"; \ | |
elif test -x "$(which gnproc)" && test -n "$(gnproc)" && test "$(gnproc)" -gt 1; then \ | |
make -j"$(gnproc)" -C src check || \ | |
make -j"$(gnproc)" -ki -C src check; \ | |
make -j"$(gnproc)" -C lib-src all-plist || \ | |
make -j"$(gnproc)" -ki -C lib-src all-plist; \ | |
make -j"$(gnproc)" apple_helper_executables \ | |
MAC_VERS_CFLAGS="-mmacosx-version-min=10.7 -stdlib=libc++"; \ | |
make -j"$(gnproc)" apple_check \ | |
MAC_VERS_CFLAGS="-mmacosx-version-min=10.7"; \ | |
else \ | |
echo "warning: on the slow path..."; \ | |
make -C src check || make -ki -C src check; \ | |
make -C lib-src all-plist || make -ki -C lib-src all-plist; \ | |
make apple_helper_executables \ | |
MAC_VERS_CFLAGS="-mmacosx-version-min=10.7 -stdlib=libc++"; \ | |
make apple_check MAC_VERS_CFLAGS="-mmacosx-version-min=10.7"; \ | |
fi; \ | |
else \ | |
make dumpemacs; \ | |
make emacswrapper; \ | |
make test_mach_o_binary; \ | |
make -ki apple_check; \ | |
fi | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: | |
- clang | |
- gcc |