Files
LOGAR/.gitea/workflows/codechecker.yml
T

74 lines
2.6 KiB
YAML

name: CodeChecker Static Analysis
on:
push:
branches:
- main
- '**'
pull_request:
workflow_dispatch:
jobs:
codechecker:
name: CodeChecker Static Analysis & Upload
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Python Environment & Linters
run: |
python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install --upgrade pip
pip3 install codechecker pylint flake8
pip3 install -r compilation/requirements.txt || true
- name: Run Static Analyzers
run: |
. .venv/bin/activate
mkdir -p ./reports_raw ./cc_reports
echo "[*] Running Pylint analysis across LOGAR codebase..."
pylint src compilation tests --output-format=json > ./reports_raw/pylint.json || true
echo "[*] Running Flake8 analysis across LOGAR codebase..."
flake8 src compilation tests --format=default > ./reports_raw/flake8.txt || true
- name: Convert Reports to CodeChecker Format
run: |
. .venv/bin/activate
if [ -s ./reports_raw/pylint.json ]; then
report-converter -t pylint -o ./cc_reports ./reports_raw/pylint.json || true
fi
if [ -s ./reports_raw/flake8.txt ]; then
report-converter -t flake8 -o ./cc_reports ./reports_raw/flake8.txt || true
fi
- name: Configure CodeChecker Authentication & Store Results
env:
CC_TOKEN: ${{ secrets.CODECHECKER_TOKEN || 'b97dc4d121e3d3b7e9cb4fa4e07ff7a9' }}
CC_USER: "GITEA"
CC_SERVER: "https://codechecker.eibl.tech/Default"
run: |
. .venv/bin/activate
mkdir -p ~/.codechecker
cat << EOF > ~/.codechecker.passwords.json
{
"client_autologin": true,
"credentials": {
"codechecker.eibl.tech": "${CC_USER}:${CC_TOKEN}",
"codechecker.eibl.tech:443": "${CC_USER}:${CC_TOKEN}",
"*": "${CC_USER}:${CC_TOKEN}"
}
}
EOF
chmod 600 ~/.codechecker.passwords.json
RUN_NAME="LOGAR_${GITHUB_REF_NAME:-main}"
echo "[*] Storing CodeChecker reports to ${CC_SERVER} under run '${RUN_NAME}'..."
CodeChecker store ./cc_reports \
--name "$RUN_NAME" \
--tag "${GITHUB_SHA}" \
--url "$CC_SERVER" || echo "[!] CodeChecker store warning"
echo "[+] CodeChecker analysis complete. View reports at https://codechecker.eibl.tech"