Repository navigation
Conversation
…hey name nvm names a rule for each shell it tests, `SHELL_TARGETS := $(addprefix test-,$(SHELLS))` and `$(SHELL_TARGETS):`, and its CI runs `make test-bash`. The Make reader left the targets as written, so each read as "no rule of the makefile builds it" (seen in cpp-best-practices#376's corpus run). - addprefix, addsuffix, subst and patsubst join filter, filter-out, findstring and strip as text functions evaluated where their arguments are known. - A rule's targets and prerequisites that hold a reference are expanded with the variables set so far, as make expands them when it reads the rule; each word is a rule of its own. One left with a reference unexpanded (a `$(foreach)`) is kept as written, as before. Expanding prerequisites too keeps pyenv's `test-docker: $(TEST_UNIT_DOCKER_PREFIX)` pointing at the rule `$(TEST_UNIT_DOCKER_PREFIX):` now names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
The ansible collections and dotnet/command-line-api describe their CI in local templates
(`.azure-pipelines/templates/matrix.yml`, `eng/pipelines/*.yml`). The reader made each an
unknown ("templates are not read"), so none of their jobs or commands were seen.
- A step, job, stage or `extends` template of the repository is read where it is named. Its
path is relative to the file that names it, or to the root after `/`. Its jobs are named
after the pipeline, and its facts point at the template.
- Its parameters take the values passed, over their declared defaults (a list of name/default
entries or a mapping).
- Template expressions are evaluated by a new module, `ci/azure_expressions`, which reuses
the GitHub expression parser for the shared syntax:
- `${{ parameters.x }}` and an `each` loop's variable take their values;
- `${{ if }}`, `${{ elseif }}` and `${{ else }}` insert the branch that holds;
- `${{ each }}` inserts its body for each item;
- Azure's functions are evaluated (`eq`, `format`, `coalesce`, `length`, `replace`, …),
with string comparisons ignoring case;
- `${{ variables.x }}` is left for the job's variables where the scope does not set it;
- a condition on a variable the pipeline sets as it runs (command-line-api's
`${{ if in(variables['Build.Reason'], 'PullRequest') }}`) cannot be decided, so its branch
is followed as one the pipeline may take, as the Make reader follows a recipe the environment
decides; the branches after it may be taken too, until one surely is. That holds for the
predefined variables that depend on the run (`Build.*`, `System.*`, `Agent.*`, …).
Another variable not set where the template is expanded (a matrix leg's `_BuildConfig`)
is empty there, as Azure evaluates it.
- The parameters a pipeline passes are expanded where it passes them, as Azure does, so a job
matrix with a conditional leg reaches the template expanded.
- Still unknown, each with its reason: a template of another repository (`x.yml@tools`), a
missing one, a cycle, nesting past Azure's limit of 100 levels, and an expression the
evaluator does not know (`counter`, runtime values, `${{ insert }}`).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
Cirrus CI was detected but only scanned heuristically, so clj-kondo's macOS build and test task
made every CI question about it unknown.
A `.cirrus.yml` is now read as its tasks:
- `task:` and `<name>_task:`; a repeated `task:` key is each read, through a new
`yaml_support.load_pairs` that keeps the top level's pairs in order. A provider now says how
its text is parsed (`CiProvider.parse`).
- `docker_builder:` and `<name>_docker_builder:`.
- Each leg of a task's `matrix:` is a task of its own.
- The instance a task names, or the top's, gives its OS and its container's image: containers
run on Linux, `macos_instance` on macOS, `windows_container` on Windows,
`freebsd_instance` on FreeBSD, and `compute_engine_instance` and docker builders on their
`platform`; others, such as `persistent_worker`, run on an unknown OS.
- Scripts run in order with the top's and the task's `env:`:
- on Unix under `set -e` and `set -o pipefail`, which is how Cirrus's agent writes the
script;
- on Windows in cmd.
- A background script, or any script of a task that `allow_failures`, cannot fail the task.
Tests that write the same command for every provider now write a Cirrus task. The snapshots
list Cirrus CI among the providers that are read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #379 +/- ##
==========================================
- Coverage 99.50% 99.44% -0.07%
==========================================
Files 320 322 +2
Lines 21149 21495 +346
Branches 2540 2610 +70
==========================================
+ Hits 21045 21376 +331
- Misses 104 119 +15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These are the CI-reading gaps left over from #376 and #377: local Azure Pipelines templates, Cirrus CI, and make text functions. They are three commits, one per reader.
Make:
addprefix,addsuffix,subst,patsubst, and rules they namenvm names a rule for each shell it tests:
SHELL_TARGETS := $(addprefix test-,$(SHELLS)), then$(SHELL_TARGETS):. Its CI runsmake test-bash, which read as "no rule of the makefile builds it".filter,filter-out,findstringandstrip, evaluated where their arguments are known.$(foreach)) is kept as written, as before.test-docker: $(TEST_UNIT_DOCKER_PREFIX)had matched the rule$(TEST_UNIT_DOCKER_PREFIX):only because both were left as written.Azure Pipelines: the repository's own templates
The ansible collections and dotnet/command-line-api describe their CI in local templates. Each was an unknown ("templates are not read").
extendstemplate is read where it is named. Its path is relative to the file that names it, or to the root after/.ci/azure_expressions.py, reuses the GitHub expression parser for the shared syntax. It handles:${{ parameters.x }};${{ if }},${{ elseif }}and${{ else }};${{ each }};eq,format,coalesce,length,replace, …).in(variables['Build.Reason'], 'PullRequest')) can't be decided. Its branch is followed as one the pipeline may take, as the Make reader follows recipes the environment decides._BuildConfig) is empty, as Azure evaluates it.x.yml@tools);counter,${{ insert }}).Cirrus CI
Cirrus CI was only scanned heuristically, so clj-kondo's macOS build-and-test task made its CI questions unknown.
.cirrus.ymlis now read as its tasks:task:and<name>_task:(a repeatedtask:key is read each time), plus docker builders. Each leg of amatrix:is a task of its own.CiProvidergainsparse, and a newyaml_support.load_pairskeeps every pair.containerruns on Linux,macos_instanceon macOS,windows_containeron Windows,freebsd_instanceon FreeBSD;compute_engine_instanceruns on itsplatform;persistent_worker, run on an unknown OS.set -eandset -o pipefailon Unix, which is how Cirrus's agent writes them (internal/agent/executor/cmd.go), and in cmd on Windows.allow_failures, can't fail it.Corpus
Compared against main's recording:
test-<shell>targets;$(NVIM_PRG), a variable nothing sets. Those two recipes are reported in place of the three targets.Tests
tests/test_azure_expressions.py, the template tests intests/test_azure_pipelines.py,tests/test_cirrus_ci.py, the Make ones intests/test_expansion.py, and a limit test for templates.Gates
pytest, ruff, ruff format, mypy, lizard, coverage, jscpd and strict self-validation: all pass.
🤖 Generated with Claude Code
https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt