Skip to content

Commit

Permalink
CI: add new workflow with own caching for static analysis
Browse files Browse the repository at this point in the history
This needs to be merged to master first to enable the new workflow,
so it contains a dummy action in the makefile that just creates an empty
report.

Signed-off-by: Edwin Török <[email protected]>
  • Loading branch information
edwintorok committed Jan 10, 2023
1 parent f05b6ef commit 425c136
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/staticanalysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Run OCaml C stub static analyzer

on:
pull_request:
branches:
- master
- 'feature/**'
- '*-lcm'

jobs:
ocaml-format:
name: Ocaml files
runs-on: ubuntu-22.04
env:
package: "xapi-lintcstubs"

steps:
- name: Checkout code
uses: actions/checkout@v3

- 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]

- name: Use ocaml
uses: avsm/setup-ocaml@v2
with:
ocaml-version: ${{ steps.dotenv.outputs.ocaml_version_full }}
opam-repository: ${{ steps.dotenv.outputs.repository }}
dune-cache: true

- name: Install dependencies for static analyzer
run: |
opam update
opam pin add xapi-lintcstubs . --no-action
opam install --deps-only ${{env.package}}
- name: Run static analyzer
run: opam exec -- make analyze

- name: Upload SARIF report
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: _build/default/xapi.sarif
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ check:
clean:
dune clean

analyze:
mkdir -p _build/default
touch _build/default/xapi.sarif

lint:
dune build @python
pylint --disable=line-too-long,too-few-public-methods,unused-argument,no-self-use,invalid-name,broad-except,protected-access,redefined-builtin,too-many-lines,wildcard-import,too-many-branches,too-many-arguments,unused-wildcard-import,raising-format-tuple,too-many-statements,duplicate-code _build/default/xapi-storage/python/xapi/storage/api/v5/*.py
Expand Down

0 comments on commit 425c136

Please sign in to comment.