From 69b59480ee5692ecc5bb7a7e89d722be8516c0ef Mon Sep 17 00:00:00 2001 From: Sergio Schvezov Date: Fri, 14 Jun 2024 19:45:11 -0300 Subject: [PATCH] ci: enable TiCS integration (#4855) - [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [ ] Have you successfully run `tox run -m lint`? - [ ] Have you successfully run `tox run -e test-py310`? (supported versions: `py39`, `py310`, `py311`, `py312`) ----- - new tox target for a single coverage result for an easier TiCS workflow - Run TiCS on pushes to main --------- Signed-off-by: Sergio Schvezov --- .github/workflows/tics.yaml | 40 +++++++++++++++++++++++++++++++++++++ tox.ini | 8 ++++++++ 2 files changed, 48 insertions(+) create mode 100644 .github/workflows/tics.yaml diff --git a/.github/workflows/tics.yaml b/.github/workflows/tics.yaml new file mode 100644 index 0000000000..9d840c0978 --- /dev/null +++ b/.github/workflows/tics.yaml @@ -0,0 +1,40 @@ +name: TICS + +on: + push: + branches: + - main + +jobs: + CI: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + echo "::group::apt-get update" + sudo apt-get update + echo "::endgroup::" + echo "::group::apt-get install..." + sudo apt-get install -y libapt-pkg-dev libyaml-dev xdelta3 patchelf + echo "::endgroup::" + echo "::group::pip install" + python -m pip install 'tox<5.0' tox-gh + echo "::endgroup::" + + - name: Setup Tox environment + run: tox run-parallel --parallel auto --parallel-no-spinner --parallel-live --colored yes -e test-all-py310 --notest + + - name: Test with tox + run: tox run --skip-pkg-install --result-json results/tox-py310.json --colored yes -e test-all-py310 + + - name: Run TICS analysis + uses: tiobe/tics-github-action@v3 + with: + mode: qserver + project: snapcraft + viewerUrl: https://canonical.tiobe.com/tiobeweb/TICS/api/cfg?name=default + ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }} + installTics: true diff --git a/tox.ini b/tox.ini index 968f36e473..a18d9fe950 100644 --- a/tox.ini +++ b/tox.ini @@ -74,6 +74,14 @@ commands = pytest {tty:--color=yes} --cov=snapcraft --cov-report=xml:results/coverage-{env_name}.xml --junit-xml=results/test-results-{env_name}.xml tests/unit {posargs} pytest {tty:--color=yes} --junit-xml=results/legacy-test-results-{env_name}.xml tests/legacy {posargs} +[testenv:test-all-py310] +base = testenv, test +description = Run all tests with the interpreter used in the snap +allowlist_externals = mkdir +commands_pre = mkdir -p results +commands = + pytest {tty:--color=yes} --cov=snapcraft --cov-report=xml:results/coverage-{env_name}.xml --junit-xml=results/test-results-{env_name}.xml tests {posargs} + [lint] # Standard linting configuration package = editable extras = dev