From 84f971ec1316015de087cef64025311813e5c41b Mon Sep 17 00:00:00 2001 From: Deezzir Date: Wed, 4 Dec 2024 19:38:45 -0500 Subject: [PATCH 1/2] Modify TICS workflow to use tox env --- .../templates/github/snap_tics.yaml.tftpl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/terraform-plans/templates/github/snap_tics.yaml.tftpl b/terraform-plans/templates/github/snap_tics.yaml.tftpl index 609eeeb..0436681 100644 --- a/terraform-plans/templates/github/snap_tics.yaml.tftpl +++ b/terraform-plans/templates/github/snap_tics.yaml.tftpl @@ -23,25 +23,26 @@ jobs: run: | sudo apt update python -m pip install --upgrade pip - # tics action requires flake8 and pylint to be installed on the runner - # https://github.com/tiobe/tics-github-action/issues/410 - python -m pip install flake8 pylint # 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' - # The snap is built already in the check workflow and available as an artifact, - # but we want this TICS workflow to be independent, - # so we can run the workflow periodically or on demand. + # The snap is built already in the check workflow and available as an artifact, + # but we want this TICS workflow to be independent, + # so we can run the workflow periodically or on demand. - name: Build the snap id: build uses: canonical/action-build@v1 - name: Test with tox and produce coverage report - run: tox -e tics + run: tox --workdir /tmp/tox -e tics - name: Run TICS analysis uses: tiobe/tics-github-action@v3 + env: + # Add the the tox bin directory to the PATH so that the TICS action can find the tests dependencies. + # Other paths are added to the PATH to make sure that the TICS action can find the required binaries. + PATH: "/tmp/tox/tics/bin:/snap/bin:/home/runner/.local/bin:/home/runner/.cargo/bin:/bin:/usr/bin:/usr/local/bin:" with: mode: qserver project: ${project} From ab9409bd94e10d58b1e49094117663d88ee38c3a Mon Sep 17 00:00:00 2001 From: Deezzir Date: Thu, 5 Dec 2024 18:02:19 -0500 Subject: [PATCH 2/2] Add comment to explain the intent --- terraform-plans/templates/github/snap_tics.yaml.tftpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terraform-plans/templates/github/snap_tics.yaml.tftpl b/terraform-plans/templates/github/snap_tics.yaml.tftpl index 0436681..0020d7e 100644 --- a/terraform-plans/templates/github/snap_tics.yaml.tftpl +++ b/terraform-plans/templates/github/snap_tics.yaml.tftpl @@ -35,11 +35,13 @@ jobs: uses: canonical/action-build@v1 - name: Test with tox and produce coverage report + # Create an environment in /tmp for the TICS action to use. run: tox --workdir /tmp/tox -e tics - name: Run TICS analysis uses: tiobe/tics-github-action@v3 env: + # TICS action requires all the project's dependencies to be present to run the analysis. # Add the the tox bin directory to the PATH so that the TICS action can find the tests dependencies. # Other paths are added to the PATH to make sure that the TICS action can find the required binaries. PATH: "/tmp/tox/tics/bin:/snap/bin:/home/runner/.local/bin:/home/runner/.cargo/bin:/bin:/usr/bin:/usr/local/bin:"