Files
github-action/.gitea/workflows/quality-checks.yml

75 lines
2.4 KiB
YAML

name: Quality checks
# Reusable workflow (ADR-0005). A repository calls it with
#
# jobs:
# quality:
# uses: TirSystem/github-action/.gitea/workflows/quality-checks.yml@v1
#
# It checks the Python and shell files of the repository with pinned tools,
# changes no file and needs no secret.
on:
workflow_call:
inputs:
languages:
description: "Comma list of the languages to check: python, shell"
type: string
default: "python,shell"
working-directory:
description: "Directory, relative to the repository root, whose files are checked"
type: string
default: "."
ruff-version:
description: "Version of ruff (Python lint and format)"
type: string
default: "0.6.9"
mypy-version:
description: "Version of mypy (Python types, --strict)"
type: string
default: "1.11.2"
shellcheck-py-version:
description: "Version of the shellcheck-py package (ShellCheck 0.10.0)"
type: string
default: "0.10.0.1"
shfmt-py-version:
description: "Version of the shfmt-py package (shfmt 3.11.0)"
type: string
default: "3.11.0.2"
tools-ref:
description: "Tag or branch of TirSystem/github-action whose tools/quality-checks.sh is run; pin it to the exact tag together with the workflow"
type: string
default: "v1"
jobs:
quality-checks:
permissions:
contents: read
runs-on: ubuntu-latest
env:
LANGUAGES: ${{ inputs.languages }}
WORKING_DIRECTORY: ${{ inputs.working-directory }}
RUFF_VERSION: ${{ inputs.ruff-version }}
MYPY_VERSION: ${{ inputs.mypy-version }}
SHELLCHECK_PY_VERSION: ${{ inputs.shellcheck-py-version }}
SHFMT_PY_VERSION: ${{ inputs.shfmt-py-version }}
QC_VENV: /tmp/quality-tools
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Fetch the shared script
uses: actions/checkout@v4
with:
repository: TirSystem/github-action
ref: ${{ inputs.tools-ref }}
path: shared-scripts
- name: Validate the inputs
run: bash shared-scripts/tools/quality-checks.sh validate
- name: Install the tools
run: bash shared-scripts/tools/quality-checks.sh install
- name: Run the checks
run: bash shared-scripts/tools/quality-checks.sh run