Fix code scanning alert no. 74: Time-of-check time-of-use filesystem … #216
Workflow file for this run
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 | |
on: | |
push: | |
branches: | |
- "**/*" | |
pull_request: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
# 'Transformers::TravisCI::Scripts::Dependencies' dependencies are | |
# currently unsupported | |
# 'compiler' was not transformed because there is no suitable equivalent | |
# in GitHub Actions | |
- run: sudo apt-get update -qq && echo "apt-get packages are up to date" | |
- name: Install dependencies with apt-get | |
run: | | |
export DEBIAN_FRONTEND=noninteractive | |
sudo apt-get install --no-install-recommends -y -qq -o=Dpkg::Use-Pty=0 \ | |
libc-dev ${{ matrix.compiler }} make autoconf automake \ | |
libncurses-dev gobjc gobjc++ gobjc-multilib gobjc++-multilib \ | |
autopoint | |
- name: Initial build | |
run: | | |
sh ./autogen.sh | |
./configure --without-makeinfo --without-gif --without-gnutls \ | |
--enable-silent-rules --disable-autodepend --without-imagemagick \ | |
--enable-gcc-warnings --with-x-toolkit=no --with-xpm=no \ | |
--disable-openmp CC=${{ matrix.compiler }} OBJC=${{ matrix.compiler }} | |
make gnulib_headers || (stat lib/Makefile && wc -l lib/Makefile) | |
make only_temacs | |
ls src/*emacs | |
cd lisp && make update-subdirs | |
- name: Extra build | |
if: "${{ success() }}" | |
run: | | |
make all_only_c | |
if test -x "$(which clang)" && test -n "$(clang --version 2>/dev/null)"; then \ | |
echo "attempting to use $(which clang) for static analysis"; \ | |
echo "but first, let us check the version that it reports..."; \ | |
clang --version; \ | |
if test -x "$(which nproc)" && test -n "$(nproc)" && test "$(nproc)" -gt 1; then \ | |
if test -x "$(which scan-build)" && test "${{ matrix.compiler }}" = "clang" && test -d /tmp && test -w /tmp; then \ | |
echo "first, an attempt at using $(which scan-build)..."; \ | |
scan-build -o /tmp make -j"$(nproc)" only_temacs all_only_c; \ | |
else \ | |
echo "skipping scan-build..."; \ | |
fi; \ | |
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; \ | |
elif test -x "$(which gnproc)" && test -n "$(gnproc)" && test "$(gnproc)" -gt 1; then \ | |
if test -x "$(which scan-build)" && test "${{ matrix.compiler }}" = "clang" && test -d /tmp && test -w /tmp; then \ | |
echo "first, an attempt at using $(which scan-build)..."; \ | |
scan-build -o /tmp make -j"$(gnproc)" only_temacs all_only_c; \ | |
else \ | |
echo "skipping scan-build..."; \ | |
fi; \ | |
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; \ | |
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; \ | |
fi; \ | |
else \ | |
echo "no usable clang found for static analysis!"; \ | |
fi | |
- name: Build docs | |
if: "${{ success() }}" | |
run: | | |
if test -d doc && test -x "$(which makeinfo)"; then \ | |
echo "using $(which makeinfo) for makeinfo w/the following vers. info: $(makeinfo --version)"; \ | |
sudo apt-get -qq install -y texlive ghostscript texlive-luatex \ | |
texlive-pstricks chktex dvidvi dvipng latexdiff latexmk dot2tex \ | |
texlive-latex-extra; \ | |
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 \ | |
echo "Need valid makeinfo to build docs."; \ | |
fi | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: | |
- clang | |
- gcc |