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

Introduce TICS workflow #46

Merged
merged 4 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
61 changes: 61 additions & 0 deletions .github/workflows/tics.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: TICS

on:
workflow_dispatch:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Verify snap builds successfully
id: build
uses: canonical/action-build@v1

- name: Upload the built snap
uses: actions/upload-artifact@v4
with:
name: snap_artifact
path: ${{ steps.build.outputs.snap }}
gabrielcocenza marked this conversation as resolved.
Show resolved Hide resolved

tics-report:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install dependencies
run: |
sudo apt update
python -m pip install --upgrade pip
python -m pip install flake8
rgildein marked this conversation as resolved.
Show resolved Hide resolved
# pin tox to the current major version to avoid
# workflows breaking all at once when a new major version is released.
python -m pip install 'tox<5'

- name: Get the snap artifact
uses: actions/download-artifact@v4
with:
name: snap_artifact

- name: Test with tox and produce coverage report
run: tox -e test-all

- name: Run TICS analysis
uses: tiobe/tics-github-action@v3
with:
mode: qserver
project: dcgm-snap
viewerUrl: https://canonical.tiobe.com/tiobeweb/TICS/api/cfg?name=default
branchdir: ${{ github.workspace }}
ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }}
installTics: true
12 changes: 11 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,22 @@ deps =
{[testenv:func]deps}

[testenv:reformat]
envdir = {toxworkdir}/lint
deps = {[testenv:lint]deps}
commands =
black .
isort .

[testenv:test-all]
deps =
pytest
pytest-cov
-r {toxinidir}/tests/functional/requirements.txt
allowlist_externals = mkdir
commands_pre = mkdir -p tests/report
commands =
pytest {toxinidir}/tests \
{posargs:-v --cov --cov-report=xml:tests/report/coverage.xml --junit-xml=tests/report/tests.xml}

[testenv:func]
deps =
pytest
Expand Down