Public Access
90 lines
3.2 KiB
YAML
90 lines
3.2 KiB
YAML
name: 'Quality checks'
|
|
description: 'Run lint, unit tests with coverage, test speed, docs, translations, and security scan'
|
|
|
|
# Composite action for the 6-step quality check sequence used by the
|
|
# devx validate job. Replaces the inline block:
|
|
# - Lint all
|
|
# - Unit tests with 100% coverage
|
|
# - Check unit test speed
|
|
# - Documentation gate (coverage + stale refs + lint + version refs + prose)
|
|
# - Translation completeness check
|
|
# - Dependency security scan
|
|
#
|
|
# Each step activates the venv defensively (`. .venv/bin/activate 2>/dev/null
|
|
# || true`) so the action works whether or not the setup step created a
|
|
# venv at the repo root (pre-built CI images symlink /opt/venv to .venv).
|
|
#
|
|
# Gitea 1.27 notes:
|
|
# - Every `run` step needs explicit `shell:`.
|
|
# - Inputs are string-typed; numeric thresholds are passed through as
|
|
# strings to `devx.tools.check_test_speed`.
|
|
|
|
inputs:
|
|
package:
|
|
description: 'Package name for doc version checks (e.g., devx, grm). Empty = no DEVX_DOC_VERSIONS_PKG override.'
|
|
required: false
|
|
default: ''
|
|
test-speed-max:
|
|
description: 'Max total test seconds (passed to check_test_speed --max-seconds)'
|
|
required: false
|
|
default: '15'
|
|
test-speed-max-single:
|
|
description: 'Max single test seconds (passed to check_test_speed --max-single-seconds)'
|
|
required: false
|
|
default: '0.5'
|
|
translations-file:
|
|
description: 'Path to translations.json (empty = default location src/devx/translations.json)'
|
|
required: false
|
|
default: ''
|
|
|
|
runs:
|
|
using: 'composite'
|
|
steps:
|
|
- name: Lint all
|
|
shell: bash
|
|
run: |
|
|
. .venv/bin/activate 2>/dev/null || true
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
make lint-all
|
|
- name: Unit tests with 100% coverage
|
|
shell: bash
|
|
run: |
|
|
. .venv/bin/activate 2>/dev/null || true
|
|
make pytest-cov
|
|
- name: Check unit test speed
|
|
shell: bash
|
|
run: |
|
|
. .venv/bin/activate 2>/dev/null || true
|
|
python3 -m devx.tools.check_test_speed \
|
|
--max-seconds "${{ inputs.test-speed-max }}" \
|
|
--max-single-seconds "${{ inputs.test-speed-max-single }}"
|
|
- name: Documentation gate (coverage + stale refs + lint + version refs + prose)
|
|
shell: bash
|
|
env:
|
|
DEVX_DOC_COVERAGE_STRICT: "1"
|
|
DEVX_VALE_LEVEL: warning
|
|
run: |
|
|
. .venv/bin/activate 2>/dev/null || true
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
if [ -n "${{ inputs.package }}" ]; then
|
|
export DEVX_DOC_VERSIONS_PKG="${{ inputs.package }}"
|
|
fi
|
|
make devx-docs-check
|
|
- name: Translation completeness check
|
|
shell: bash
|
|
run: |
|
|
. .venv/bin/activate 2>/dev/null || true
|
|
if [ -n "${{ inputs.translations-file }}" ]; then
|
|
python3 -m devx.ci.check_translations --translations "${{ inputs.translations-file }}"
|
|
else
|
|
python3 -m devx.ci.check_translations
|
|
fi
|
|
- name: Dependency security scan
|
|
shell: bash
|
|
run: |
|
|
. .venv/bin/activate 2>/dev/null || true
|
|
# Install pip in venv if missing (needed by pip-audit)
|
|
.venv/bin/python -m ensurepip 2>/dev/null || true
|
|
PIPAPI_PYTHON_LOCATION=$PWD/.venv/bin/python \
|
|
pip-audit --desc --skip-editable 2>&1 || true
|