generated from canonical/is-charms-template-repo
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
actions: Add Tiobe TICS cron job (#249)
This commit adds: - the necessary tox env targets for generating Cobertura coverage report XML format - a GitHub Workflow which runs the unit tests with coverage enabled, and calls the `TICSServer` to upload the analysis results Signed-off-by: Claudiu Belu <[email protected]> Co-authored-by: Nashwan Azhari <[email protected]>
- Loading branch information
1 parent
d795c73
commit 3a8051d
Showing
4 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: TICS nightly quality scan | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 10 * * *' | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
TICS: | ||
permissions: | ||
contents: read | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
# Latest branches | ||
- { branch: main } | ||
|
||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@v2 | ||
with: | ||
egress-policy: audit | ||
|
||
- name: Checking out repo | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{matrix.branch}} | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Install Go for Cobertura Coverage Converter | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.22" | ||
|
||
- name: Run Tests With Coverage | ||
run: | | ||
set -eux -o pipefail | ||
# tox required for running the unit tests with coverage: | ||
pip install tox | ||
tox -e unit,coverage-xml | ||
# TiCS expects the report to be under a "$(pwd)/cover" directory. | ||
mkdir -p "$GITHUB_WORKSPACE/cover" | ||
GENERATED_COVERAGE_XML="$GITHUB_WORKSPACE/charms/worker/k8s/coverage.xml" | ||
mv "$GENERATED_COVERAGE_XML" cover/coverage.xml | ||
- name: Run TICS | ||
run: | | ||
export TICSAUTHTOKEN=${{ secrets.TICSAUTHTOKEN }} | ||
# NOTE(aznashwan): TiCS install script doesn't define defaults; cannot '-u' | ||
set -ex -o pipefail | ||
# Install the TiCS and staticcheck | ||
go install honnef.co/go/tools/cmd/[email protected] | ||
. <(curl --silent --show-error 'https://canonical.tiobe.com/tiobeweb/TICS/api/public/v1/fapi/installtics/Script?cfg=default&platform=linux&url=https://canonical.tiobe.com/tiobeweb/TICS/') | ||
TICSQServer -project k8s-operator -tmpdir /tmp/tics -branchdir "$GITHUB_WORKSPACE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters