Fix and refactor scan-build workflow to run on the master branch (#3325)

This commit is contained in:
itchyny authored and GitHub committed 2025-05-20 20:00:53 +09:00
1 parent b733dfaee7
commit 4e2ccc4c9b
1 file changed
+20 -48
+20 -48
View File
@@ -1,75 +1,47 @@
name: Linux Clang scan-build Static Analyzer Build name: Clang scan-build Static Analyzer Build
on: on:
# Don't do this for PRs. It eats up minutes.
push: push:
branches: branches:
- 'master' - master
- 'scan-build'
paths:
- '.github/workflows/scanbuild.yml'
jobs: jobs:
unix: scan-build:
runs-on: ${{ matrix.os }} runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
name: [linux-clang]
include:
- name: linux-clang
os: ubuntu-latest
compiler: clang
cflags: ''
steps: steps:
- name: Clone repository - name: Clone repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Open Submodule(s) with:
run: | submodules: true
git submodule update --init --recursive
- name: Install packages - name: Install packages
if: startsWith(matrix.os, 'ubuntu')
run: | run: |
sudo apt-get update -qq sudo apt-get update -qq
sudo apt-get install -y automake autoconf bison flex gdb python3 valgrind clang-tools sudo apt-get install -y automake autoconf gdb valgrind clang clang-tools
- name: Prep echo "CC=clang" >> "$GITHUB_ENV"
run: |
#pyenv global 3.6.7
#pip3 install pipenv
#(cd docs && pipenv sync)
#if [ -n "$COVERAGE" ]; then pip install --user cpp-coveralls; fi
echo SHELL=$SHELL
echo PATH=$PATH
which bison
bison --version
- name: Build - name: Build
env:
CC: ${{ matrix.compiler }}
MAKEVARS: ${{ matrix.makevars }}
run: | run: |
autoreconf -i autoreconf -i
./configure --with-oniguruma=builtin --enable-valgrind $COVERAGE ./configure --enable-valgrind CFLAGS="-g -O0"
scan-build --keep-going make -j4 scan-build --keep-going --exclude vendor/ make -j"$(nproc)"
- name: Test - name: Test
env:
CC: ${{ matrix.compiler }}
MAKEVARS: ${{ matrix.makevars }}
run: | run: |
ulimit -c unlimited ulimit -c unlimited
scan-build --keep-going make -j4 check scan-build --keep-going --exclude vendor/ make -j"$(nproc)" check
- name: Core dump stacks - name: Core dump stacks
run: | run: |
echo "thread apply all bt" > /tmp/x if [[ -f core ]]; then
find . -name core -print | while read core; do gdb -batch -x x `file "$core"|sed -e "s/^[^']*'//" -e "s/[ '].*$//"` "$core"; done gdb -batch -ex "thread apply all bt" \
if [ "$(find . -name core -print | wc -l)" -gt 0 ]; then false; fi "$(file core | sed "s/^[^']*'//; s/[ '].*$//")" core
exit 1
fi
- name: Test logs - name: Test logs
if: ${{ failure() }} if: ${{ failure() }}
run: | run: |
cat test-suite.log cat test-suite.log tests/*.log
cat tests/*.log
- name: Upload Logs - name: Upload Logs
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: Scan-Build Reports name: Scan-Build Reports
path: '/tmp/scan-build*/' path: /tmp/scan-build*
if-no-files-found: ignore
retention-days: 7