Skip to content

Commit

Permalink
Merge branch 'main' into chore/SOLENG-833/inline-workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelallan72 authored Dec 1, 2024
2 parents 16314c6 + a75e577 commit ef51169
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 1 deletion.
63 changes: 63 additions & 0 deletions .github/workflows/tics.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
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 }}

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
# tics action requires flake8 to be installed on the runner
# https://github.com/tiobe/tics-github-action/issues/410
python -m pip install flake8
# 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 tics

- 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
11 changes: 10 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,21 @@ deps =
{[testenv:func]deps}

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

[testenv:tics]
deps =
pytest
pytest-cov
-r {toxinidir}/tests/functional/requirements.txt
description = Run all tests for snap and produce coverage report
commands =
pytest {toxinidir}/tests \
-v --cov --cov-report=xml:{toxinidir}/tests/report/coverage.xml --junit-xml={toxinidir}/tests/report/tests.xml

[testenv:func]
deps =
pytest
Expand Down

0 comments on commit ef51169

Please sign in to comment.