Skip to content

Fix/minor issues

Fix/minor issues #718

Workflow file for this run

name: CPP Checks
on:
pull_request:
branches-ignore:
- main
workflow_dispatch:
concurrency:
group: codechecks-${{ github.head_ref }}
cancel-in-progress: true
env:
storage-url: ${{secrets.CI_STORAGE_URL}}
storage-user: ${{secrets.CI_STORAGE_USER}}
storage-token: ${{secrets.CI_STORAGE_TOKEN}}
host_jobs: $J
local-compilers-backup: $LOCAL_COMPILERS_BACKUP
jobs:
cppcheck:
runs-on: [self-hosted]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Env setup
id: host
shell: bash
run: |
echo "Current host supports ${{env.host_jobs}} parallel jobs"
echo "jobs=${{env.host_jobs}}" >> $GITHUB_OUTPUT
- name: Run CPP checks on Bambu source
id: cppcheck
uses: ./.github/actions/cppcheck
with:
jobs: ${{steps.host.outputs.jobs}}
args: --enable=all --force --suppress=unusedFunction --suppress=unmatchedSuppression --inline-suppr
- name: Upload cppcheck HTML report
uses: actions/upload-artifact@v4
with:
name: CPPCheck-report
path: ${{steps.cppcheck.outputs.report-dir}}
- name: CPPCheck found too many errors
uses: actions/github-script@v4
if: ${{ steps.cppcheck.outputs.error-count > 20 }}
with:
script: core.setFailed('Too many errors detected from cppcheck')
clang-check:
runs-on: [self-hosted]
env:
dist-dir: dist
compilers: gcc-4.9,gcc-5,gcc-6,gcc-7,gcc-8,clang-4,clang-5,clang-6,clang-7,clang-11,clang-12,clang-13,clang-16
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Env setup
id: setup
shell: bash
run: |
echo "Current host supports ${{env.host_jobs}} parallel jobs"
echo "jobs=${{env.host_jobs}}" >> $GITHUB_OUTPUT
env_id="$(echo $(sed 's/,/\n/g' <<< "${{env.compilers}}" | sort -V) | sed 's/ //g')"
if [[ ! -z "${{env.build-compiler}}" ]]; then
if [[ "$env_id" != *"${{env.build-compiler}}"* ]]; then
env_id+="${{env.build-compiler}}"
fi
fi
echo "version=$(cat configure.ac | grep AC_INIT | sed -E 's/.*,(.*),.*/\1/g;s/ //g')" >> $GITHUB_OUTPUT
echo "env_id=$env_id" >> $GITHUB_OUTPUT
echo "timestamp=$(date -u +'%Y-%m-%d-%H;%M;%S')" >> $GITHUB_OUTPUT
- name: CCache cache files
uses: actions/cache@v4
with:
path: .ccache
key: scanbuild-ccache-${{steps.setup.outputs.version}}-${{steps.setup.outputs.timestamp}}
restore-keys: |
scanbuild-ccache-${{steps.setup.outputs.version}}-
- name: Autoconf cache files
uses: actions/cache@v4
with:
path: .autoconf
key: scanbuild-autoconf-${{steps.setup.outputs.version}}-${{steps.setup.outputs.env_id}}-${{ steps.setup.outputs.timestamp }}
restore-keys: |
scanbuild-autoconf-${{steps.setup.outputs.version}}-${{steps.setup.outputs.env_id}}-
- name: Download compilers
shell: bash
run: |
mkdir "${{env.dist-dir}}"
bash ./.devcontainer/library-scripts/compiler-download.sh "${{env.dist-dir}}" "${{env.compilers}}" "${{env.local-compilers-backup}}"
- name: Scan build Bambu
id: scanbuild
uses: ./.github/actions/scanbuild
with:
jobs: ${{steps.setup.outputs.jobs}}
config-args: CC=clang-11 CXX=clang++-11 --disable-release --enable-flopoco --enable-glpk
- name: Upload scan-build report
uses: actions/upload-artifact@v4
with:
name: scanbuild-report
path: ${{steps.scanbuild.outputs.report-dir}}