Skip to content

Workflow file for this run

name: Run CodeChecker static analyzer on XAPI's C stubs
on:
push:
pull_request:
branches:
- master
- 'feature/**'
- '*-lcm'
jobs:
staticanalyzer:
name: Ocaml files
runs-on: ubuntu-22.04
env:
XAPI_VERSION: "v0.0.0-${{ github.sha }}"
# required for dune cache to work inside opam for now, otherwise it
# gets EXDEV and considers it a cache miss
DUNE_CACHE_STORAGE_MODE: copy
steps:
- name: Checkout code
uses: actions/checkout@v4
# we could just use the upstream repo here, but I want to ensure
# that we're able to run the static analyzer locally too
- name: Pull configuration from xs-opam
run: |
curl --fail --silent https://raw.githubusercontent.com/edwintorok/xs-opam/master/tools/xs-opam-ci.env | cut -f2 -d " " > .env
- name: Load environment file
id: dotenv
uses: falti/[email protected]
with:
log-variables: true
- name: Use ocaml
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ steps.dotenv.outputs.ocaml_version_full }}
dune-cache: true
opam-pin: false
opam-depext: false
- name: Install dune-compiledb to generate compile_commands.json
run: |
opam install dune-compiledb
- name: Generate compile_commands.json
run: dune rules | dune-compiledb
- uses: whisperity/codechecker-analysis-action@v1
id: codechecker
with:
ctu: true
logfile: ${{ github.workspace }}/compile_commands.json
analyze-output: "codechecker_results"
# cppcheck even for other analyzers apparently, this is
# codechecker's output
- uses: whisperity/codechecker-analysis-action@v1
id: codechecker2
with:
report-converter: true
original-analyzer: "cppcheck"
original-analysis-output: "codechecker_results"
- name: Upload CodeChecker report
uses: actions/upload-artifact@v2
with:
path: "${{ steps.codechecker.outputs.result-html-dir }}"
- name: Upload CodeChecker report
uses: actions/upload-artifact@v2
with:
path: "${{ steps.codechecker2.outputs.result-html-dir }}"
# - name: Upload SARIF report
# uses: github/codeql-action/upload-sarif@v2
# with:
# sarif_file: _build/default/xapi.sarif