diff --git a/.github/workflows/go-pr-analysis.yml b/.github/workflows/go-pr-analysis.yml index 1b73f131..1d5cc130 100644 --- a/.github/workflows/go-pr-analysis.yml +++ b/.github/workflows/go-pr-analysis.yml @@ -25,6 +25,10 @@ on: description: 'Directory depth level to extract app name' type: number default: 2 + normalize_to_filter: + description: 'Collapse every changed file under a filter_paths entry into that one component (working_dir = the filter itself), instead of the path_level-trimmed directory. Default true: without it, a change deeper than path_level segments inside a filtered component (e.g. "apps/dict/components/hub/api/services/command/x.go" under the filter "apps/dict/components/hub/api") spawns a bogus matrix entry rooted at that subdirectory, where no Makefile and no testable package exist — so no coverage.txt is produced, the upload finds no file, and the coverage job fails with "Artifact not found". Mirrors the same input in frontend-pr-analysis.yml.' + type: boolean + default: true app_name_prefix: description: 'Prefix for app names in matrix output' type: string @@ -129,6 +133,7 @@ jobs: path-level: ${{ inputs.path_level }} get-app-name: 'true' app-name-prefix: ${{ inputs.app_name_prefix }} + normalize-to-filter: ${{ inputs.normalize_to_filter }} fallback-app-name: ${{ inputs.app_name_prefix != '' && inputs.app_name_prefix || 'app' }} # ============================================ diff --git a/.github/workflows/go-pr-validation.yml b/.github/workflows/go-pr-validation.yml index 3538889c..eb221d06 100644 --- a/.github/workflows/go-pr-validation.yml +++ b/.github/workflows/go-pr-validation.yml @@ -108,6 +108,10 @@ on: description: 'Directory depth level to extract the component name from filter_paths' type: number default: 2 + normalize_to_filter: + description: 'Collapse every changed file under a filter_paths entry into that one component (working_dir = the filter itself) instead of the path_level-trimmed directory. Forwarded to go-pr-analysis; see that workflow for why the default is true.' + type: boolean + default: true coverage_threshold: description: 'Minimum coverage percentage required (0-100)' type: number @@ -272,6 +276,7 @@ jobs: app_name_prefix: ${{ inputs.app_name_prefix }} filter_paths: ${{ inputs.filter_paths }} path_level: ${{ inputs.path_level }} + normalize_to_filter: ${{ inputs.normalize_to_filter }} coverage_threshold: ${{ inputs.coverage_threshold }} fail_on_coverage_threshold: ${{ inputs.fail_on_coverage_threshold }} go_private_modules: ${{ inputs.go_private_modules }} diff --git a/docs/go-pr-analysis-workflow.md b/docs/go-pr-analysis-workflow.md index 9a2427d8..333bbac5 100644 --- a/docs/go-pr-analysis-workflow.md +++ b/docs/go-pr-analysis-workflow.md @@ -97,6 +97,7 @@ jobs: | `runner_type` | GitHub runner type | No | `firmino-lxc-runners` | | `filter_paths` | JSON array of paths to monitor for changes. If empty, treats repo as single-app. | No | `''` | | `path_level` | Directory depth level to extract app name | No | `2` | +| `normalize_to_filter` | Collapse every changed file under a `filter_paths` entry into that one component (`working_dir` = the filter itself) instead of the `path_level`-trimmed directory. With `false`, a change deeper than `path_level` segments inside a filtered component spawns a bogus matrix entry rooted at that subdirectory — no testable package, so no `coverage.txt`, and the coverage job fails with "Artifact not found". | No | `true` | | `app_name_prefix` | Prefix for app names in matrix output | No | `''` | | `go_version` | Go version to use | No | `1.23` | | `golangci_lint_version` | GolangCI-Lint version | No | `v1.62.2` | diff --git a/docs/go-pr-validation.md b/docs/go-pr-validation.md index ff46c2ea..f9903ba6 100644 --- a/docs/go-pr-validation.md +++ b/docs/go-pr-validation.md @@ -44,6 +44,7 @@ The `go-analysis`, `security` and `lib-version` pipelines each have a `*-gate` a | `app_name_prefix` | Prefix used to namespace coverage/build artifacts | string | `''` | | `filter_paths` | Newline-separated component path prefixes for monorepo per-component analysis (lint/tests/coverage) **and** security scanning; empty = single-app root run. When using it for security, leave `dockerfile_path` empty so each component Dockerfile is discovered | string | `''` | | `path_level` | Directory depth level to extract the component name from `filter_paths` | number | `2` | +| `normalize_to_filter` | Collapse every changed file under a `filter_paths` entry into that one component instead of the `path_level`-trimmed directory; forwarded to `go-pr-analysis` | boolean | `true` | | `coverage_threshold` | Minimum coverage percentage (0-100) | number | `80` | | `fail_on_coverage_threshold` | Fail when coverage is below threshold | boolean | `true` | | `go_private_modules` | GOPRIVATE pattern for private modules | string | `''` |