Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TiCS CI (Infra) #1490

Merged
merged 19 commits into from
Oct 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .github/workflows/checkbox-tics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: TICS Code Quality Analysis

on:
schedule:
- cron: '00 19 * * *'
workflow_dispatch:

permissions:
contents: read

jobs:
TICS:
runs-on: ubuntu-latest
environment: TICS
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libsystemd-dev python3-pip pylint flake8 libbluetooth3 libbluetooth-dev libasound2-dev python3-zbar python3-pil

- name: Install Checkbox
run: |
sudo python -m pip install -e $PWD/checkbox-ng
sudo python -m pip install -e $PWD/checkbox-support
sudo python -m pip install \
pyparsing==2.4.7 \
requests==2.25.1 \
XlsxWriter==3.0.2 \
Jinja2==3.0.3 \
psutil==5.9.5 \
libsvm==3.23.0.4 \
urwid==2.1.2 \
systemd-python==235 \
distro==1.7.0 \
coverage==7.3.0 \
flake8 \
MarkupSafe==2.0.1 \
pytest \
opencv_python==4.8.1.78 \
natsort==8.0.2 \
tqdm==4.57.0 \
PyYAML==6.0.1 \
numpy==1.26.4 \
pytest-cov==4.1.0

- name: Run coverage tests
run: |
REPO_DIR="$PWD"
COVR_DIR="$PWD/.coverage"

# Providers
echo "::group::coverage tests for providers..."
providers="base certification-client certification-server docker genio gpgpu iiotg resource sru tpm2"
for provider in $providers; do
cd "$REPO_DIR/providers/$provider"
coverage run --append --branch --data-file="$COVR_DIR/.coverage" manage.py test -u
done
echo "::endgroup::"

# Checkbox-ng
echo "::group::coverage tests for checkbox-ng..."
coverage run --append --branch --data-file=$COVR_DIR/.coverage -m pytest $REPO_DIR/checkbox-ng
echo "::endgroup::"

# Checkbox-support
echo "::group::coverage tests for checkbox-support..."
coverage run --append --branch --data-file=$COVR_DIR/.coverage -m pytest $REPO_DIR/checkbox-support/checkbox_support/
echo "::endgroup::"

# Coverage report XML
echo "::group::coverage XML report..."
coverage xml -i --data-file $COVR_DIR/.coverage -o $COVR_DIR/cobertura.xml
echo "::endgroup::"

- name: TICS GitHub Action
uses: tiobe/tics-github-action@v3
with:
mode: qserver
project: checkbox
viewerUrl: https://canonical.tiobe.com/tiobeweb/TICS/api/cfg?name=default
branchdir: ${{ github.workspace }}
ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }}
installTics: true
calc: ALL