diff --git a/.github/workflows/tics.yaml b/.github/workflows/tics.yaml new file mode 100644 index 000000000..dcc0580c3 --- /dev/null +++ b/.github/workflows/tics.yaml @@ -0,0 +1,71 @@ +name: TICS + +on: + push: + branches: + - main + # to easy test changes to the workflow + - tiobe + +jobs: + CI: + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - 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 python3 python3-dev libapt-pkg-dev libyaml-dev + echo "::endgroup::" + echo "::group::pip install" + python -m pip install 'tox<5.0' tox-gh + echo "::endgroup::" + + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + brew install skopeo + + - name: Setup Tox environment + run: tox --workdir /tmp/tox run-parallel --parallel auto --parallel-no-spinner --parallel-live --colored yes -e test-py3.10 --notest + + - name: Test with tox + run: | + echo "::group::skopeo" + # From tests.yaml + # Ensure the version of skopeo comes from homebrew + # This is only necessary until we move to noble. + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + # Allow skopeo to access the contents of /run/containers + sudo chmod 777 /run/containers + # Add an xdg runtime dir for skopeo to look into for an auth.json file + sudo mkdir -p /run/user/$(id -u) + sudo chown $USER /run/user/$(id -u) + export XDG_RUNTIME_DIR=/run/user/$(id -u) + echo "::endgroup::" + + tox --workdir /tmp/tox run --skip-pkg-install --no-list-dependencies --result-json results/tox-py310.json --colored yes -e test-py3.10 + + - name: Upload test results + if: success() || failure() + uses: actions/upload-artifact@v4 + with: + name: test-results-ubuntu-22.04 + path: results/ + + - name: Run TICS analysis + uses: tiobe/tics-github-action@v3 + env: + PATH: "/tmp/tox/test-py3.10/bin:/snap/bin:/home/runner/.local/bin:/home/runner/.cargo/bin:/bin:/usr/bin:/usr/local/bin:" + with: + mode: qserver + project: charmcraft + viewerUrl: https://canonical.tiobe.com/tiobeweb/TICS/api/cfg?name=default + branchdir: ${{ github.workspace }} + ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }} + installTics: true diff --git a/pyproject.toml b/pyproject.toml index 4476ed8e4..f37b1ebf1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,6 +53,7 @@ dev = [ # When updating these, also update the dev/lint/types groups in renovat "hypothesis", "pydocstyle", "pyfakefs", + "pylint", "pytest", "pytest-cov", "pytest-mock", @@ -122,7 +123,7 @@ line-length = 99 [tool.codespell] ignore-words-list = "buildd,crate,keyserver,comandos,ro,dedent,dedented,tread,socio-economic" -skip = ".tox,.git,build,.*_cache,__pycache__,*.tar,*.snap,*.png,./node_modules,./docs/_build,.direnv,.venv,venv,.vscode,charmcraft.spec" +skip = "requirements*.txt,.tox,.git,build,.*_cache,__pycache__,*.tar,*.snap,*.png,./node_modules,./docs/_build,.direnv,.venv,venv,.vscode,charmcraft.spec" quiet-level = 3 check-filenames = true diff --git a/requirements-dev.txt b/requirements-dev.txt index 595f70d03..44e732249 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,4 @@ +astroid==3.2.4 attrs==23.2.0 certifi==2024.7.4 cffi==1.16.0 @@ -13,6 +14,7 @@ craft-providers==1.24.1 craft-store==2.6.2 cryptography==42.0.8 Deprecated==1.2.14 +dill==0.3.8 distro==1.9.0 docker==7.1.0 flake8==7.0.0 @@ -23,6 +25,7 @@ hypothesis==6.100.5 idna==3.7 importlib_metadata==7.1.0 iniconfig==2.0.0 +isort==5.13.2 jaraco.classes==3.4.0 jeepney==0.8.0 Jinja2==3.1.4 @@ -50,6 +53,7 @@ pydocstyle==6.3.0 pyfakefs==5.4.1 pyflakes==3.2.0 pygit2==1.14.1 +pylint==3.2.6 pymacaroons==0.13.0 PyNaCl==1.5.0 pyparsing==3.1.2 @@ -76,6 +80,7 @@ snap-helpers==0.4.2 snowballstemmer==2.2.0 sortedcontainers==2.4.0 tabulate==0.9.0 +tomlkit==0.13.0 types-Deprecated==1.2.9.20240311 types-PyYAML==6.0.12.20240311 typing_extensions==4.11.0