From b4050b985396b86a72d1498490adcea57997e0c8 Mon Sep 17 00:00:00 2001 From: Douglas Chiang <39449881+douglasdotc@users.noreply.github.com> Date: Fri, 11 Oct 2024 09:48:50 +0100 Subject: [PATCH] Add TiCS CI (Infra) (#1490) * Add TiCS CI. Signed-off-by: Douglas Chiang * Change branch name for testing. Signed-off-by: Douglas Chiang * Turn to a cron job on main. Signed-off-by: Douglas Chiang * Fix dependencies for pytest. Signed-off-by: Douglas Chiang * Fix format. Signed-off-by: Douglas Chiang * Add missing dependencies for tics. Signed-off-by: Douglas Chiang * Add dependency for TiCS. Signed-off-by: Douglas Chiang * Fix dependency installation Signed-off-by: Douglas Chiang * Add sound dependency. Signed-off-by: Douglas Chiang * Add dependency. Signed-off-by: Douglas Chiang * Add dependency. Signed-off-by: Douglas Chiang * Add PIL dependency... Signed-off-by: Douglas Chiang * cron job Signed-off-by: Douglas Chiang * Update .github/workflows/checkbox-tics.yml Co-authored-by: Massimiliano * Update .github/workflows/checkbox-tics.yml Co-authored-by: Massimiliano * Update .github/workflows/checkbox-tics.yml Co-authored-by: Massimiliano * try tox pip install list Signed-off-by: Douglas Chiang * Fix path Signed-off-by: Douglas Chiang * Turn back to cron job Signed-off-by: Douglas Chiang --------- Signed-off-by: Douglas Chiang Co-authored-by: Massimiliano --- .github/workflows/checkbox-tics.yml | 86 +++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/checkbox-tics.yml diff --git a/.github/workflows/checkbox-tics.yml b/.github/workflows/checkbox-tics.yml new file mode 100644 index 000000000..e41b6c774 --- /dev/null +++ b/.github/workflows/checkbox-tics.yml @@ -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