Skip to content

Code quality nightly scan #204

Code quality nightly scan

Code quality nightly scan #204

name: Code quality nightly scan
on:
schedule:
- cron: '0 4 * * *'
workflow_dispatch:
env:
apt_dependencies: >-
ca-certificates curl dconf-cli gcc gettext git libnss-wrapper libsmbclient-dev
libkrb5-dev libwbclient-dev pkg-config python3-coverage samba sudo
libglib2.0-dev gvfs libpam0g-dev
jobs:
tics:
name: TIOBE TiCS Framework
runs-on: ${{ vars.RUNNER }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install dependencies
run: |
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y ${{ env.apt_dependencies }}
go install honnef.co/go/tools/cmd/staticcheck@latest
dotnet tool install -g dotnet-reportgenerator-globaltool
- name: TiCS scan
env:
TICSAUTHTOKEN: ${{ secrets.TICSAUTHTOKEN }}
GH_TOKEN: ${{ github.token }}
run: |
set -e
# Download, combine and move coverage to the right place so TiCS can parse it
RUN_ID=$(gh run list --workflow 'QA & sanity checks' --limit 1 --status success --json databaseId -b main | jq '.[].databaseId')
gh run download $RUN_ID -n coverage.zip -D /tmp/coverage
E2E_RUN_ID=$(gh run list --workflow 'E2E - Run tests' --limit 1 --status success --json databaseId -b main | jq '.[].databaseId')
gh run download $E2E_RUN_ID -n pam-coverage.zip -D /tmp/coverage
reportgenerator "-reports:/tmp/coverage/*.xml" "-targetdir:.coverage" -reporttypes:Cobertura
mv .coverage/Cobertura.xml .coverage/coverage.xml
# Install TiCS
. <(curl --silent --show-error 'https://canonical.tiobe.com/tiobeweb/TICS/api/public/v1/fapi/installtics/Script?cfg=default&platform=linux&url=https://canonical.tiobe.com/tiobeweb/TICS/')
# TiCS requires all artifacts to be built
go build ./cmd/...
TICSQServer -project adsys -tmpdir /tmp/tics -branchdir .