latest #179
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: Code analysis | |
on: [push, pull_request] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
CCACHE_DIR: "/dev/shm/.ccache" | |
CCACHE_MAXSIZE: "64M" | |
CCACHE_COMPRESS: "true" | |
jobs: | |
run_linters: | |
name: Script linters | |
runs-on: ubuntu-20.04 | |
if: github.event_name != 'pull_request' || contains('dreamer,kcgen,ant-222,Wengier', github.actor) == false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- run: sudo apt-get update | |
- name: Run shellcheck | |
run: ./scripts/verify-bash.sh | |
- name: Install pylint | |
run: | | |
sudo apt-get install python3-setuptools | |
sudo pip3 install pylint beautifulsoup4 html5lib jsonpickle | |
- name: Run pylint | |
run: ./scripts/verify-python.sh | |
- name: Install markdownlint | |
run: | | |
sudo apt-get install ruby-full | |
ruby --version | |
sudo gem install mdl | |
- name: Run markdownlint | |
run: ./scripts/verify-markdown.sh | |
- name: Install appstream-util | |
run: sudo apt-get install appstream-util | |
- name: Verify metainfo.xml | |
run: appstream-util validate-relax --nonet contrib/linux/dosbox-staging.metainfo.xml | |
build_clang_static_analyser: | |
name: Clang static analyzer | |
runs-on: ubuntu-20.04 | |
needs: run_linters | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- run: sudo apt-get update | |
- name: Install dependencies | |
run: | | |
sudo apt-get install clang-tools python3-bs4 $(cat .github/packages/ubuntu-20.04-apt.txt) | |
sudo pip3 install --upgrade meson ninja | |
- name: Prepare compiler cache | |
id: prep-ccache | |
shell: bash | |
run: | | |
mkdir -p "${CCACHE_DIR}" | |
echo "::set-output name=dir::$CCACHE_DIR" | |
echo "::set-output name=today::$(date -I)" | |
echo "::set-output name=yesterday::$(date --date=yesterday -I)" | |
- uses: actions/cache@v2 | |
id: cache-ccache | |
with: | |
path: ${{ steps.prep-ccache.outputs.dir }} | |
key: ccache-static-clang-${{ steps.prep-ccache.outputs.today }} | |
restore-keys: | | |
ccache-static-clang-${{ steps.prep-ccache.outputs.yesterday }} | |
- name: Cache subprojects | |
uses: actions/cache@v2 | |
with: | |
path: subprojects/packagecache | |
key: subprojects-${{ hashFiles('subprojects/*.wrap') }} | |
- name: Log environment | |
run: ./scripts/log-env.sh | |
- run: meson setup -Dunit_tests=disabled build | |
- name: Build and run scan-build | |
run: | | |
set -x | |
ninja -C build scan-build | |
mv build/meson-logs/scanbuild report | |
- name: Upload report | |
uses: actions/upload-artifact@v2 | |
with: | |
name: clang-analysis-report | |
path: report | |
- name: Summarize report | |
env: | |
MAX_BUGS: 27 | |
run: | | |
# summary | |
echo "Full report is included in build Artifacts" | |
echo | |
./scripts/count-clang-bugs.py report/*/index.html | |
dynamic_matrix: | |
name: ${{ matrix.conf.name }} | |
needs: run_linters | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
conf: | |
# AddressSanitizer is a fast memory error detector. Memory access | |
# instructions are instrumented to detect out-of-bounds and | |
# use-after-free bugs. | |
# See GCC manual to learn more. | |
- name: GCC address sanitizer | |
build_flags: -Db_sanitize=address | |
logs: gcc-asan-logs | |
max_issues: 0 | |
# UndefinedBehaviorSanitizer is a fast undefined behavior detector. | |
# Various computations are instrumented to detect undefined behavior | |
# at runtime, such as shift operation correctness, integer division by | |
# zero, null-pointer dereference, signed integer overflow, | |
# dereferencing memory with wrong alignment, and more. | |
# See GCC manual to learn more. | |
- name: GCC undefined sanitizer | |
build_flags: -Db_sanitize=undefined | |
logs: gcc-usan-logs | |
max_issues: 0 | |
# Clang allows enabling both AddressSanitizer and | |
# UndefinedBehaviorSanitizer at the same time. | |
# See Clang manual to learn more. | |
- name: Clang undefined+address sanitizer | |
build_flags: >- | |
--native-file=.github/meson/native-clang.ini | |
-Db_sanitize=address,undefined | |
-Dc_args=-fsanitize-recover=all | |
-Dcpp_args=-fsanitize-recover=all | |
-Db_asneeded=true | |
-Db_lundef=false | |
-Ddefault_library=static | |
--wrap-mode=forcefallback | |
-Dfluidsynth:try-static-deps=true | |
logs: clang-uasan-logs | |
max_issues: 4 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- run: sudo apt-get update | |
- name: Install dependencies | |
run: | | |
sudo apt-get install $(cat .github/packages/ubuntu-20.04-apt.txt) | |
sudo pip3 install --upgrade meson ninja | |
- name: Prepare compiler cache | |
id: prep-ccache | |
shell: bash | |
run: | | |
mkdir -p "${CCACHE_DIR}" | |
echo "::set-output name=dir::$CCACHE_DIR" | |
echo "::set-output name=today::$(date -I)" | |
echo "::set-output name=yesterday::$(date --date=yesterday -I)" | |
- uses: actions/cache@v2 | |
id: cache-ccache | |
with: | |
path: ${{ steps.prep-ccache.outputs.dir }} | |
key: ccache-sanitizers-${{ steps.prep-ccache.outputs.today }} | |
restore-keys: ccache-sanitizers-${{ steps.prep-ccache.outputs.yesterday }} | |
- name: Cache subprojects | |
uses: actions/cache@v2 | |
with: | |
path: subprojects/packagecache | |
key: subprojects-${{ hashFiles('subprojects/*.wrap') }} | |
- name: Log environment | |
run: ./scripts/log-env.sh | |
- run: meson setup -Dunit_tests=disabled ${{ matrix.conf.build_flags }} build | |
- run: ninja -C build | |
- name: Run sanitizer test cases | |
run: ./.github/scripts/run-sanitizers.sh build sanitizer-logs | |
- name: Upload logs | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ matrix.conf.logs }} | |
path: sanitizer-logs | |
- name: Summarize issues | |
run: > | |
xzcat sanitizer-logs/EnterExit.log.xz | | |
MAX_ISSUES=${{ matrix.conf.max_issues }} ./scripts/count-xsan-issues.py - |