Add rustflags passthrough to setup-rust and rust-build-release - #391
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Summary
Validation
WalkthroughThe changes add caller-controlled ChangesRust flags configuration
Repository maintenance
Documentation formatting
Sequence Diagram(s)sequenceDiagram
participant Caller
participant rust-build-release
participant GITHUB_ENV
participant setup-rust
participant Cargo
Caller->>rust-build-release: provide rustflags
rust-build-release->>GITHUB_ENV: export RUSTFLAGS
rust-build-release->>setup-rust: start toolchain setup
setup-rust->>Cargo: apply forwarded rustflags
Possibly related PRs
Suggested reviewers: Poem
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (2 errors)
✅ Passed checks (18 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Reviewer's GuideAdds a configurable rustflags passthrough to the setup-rust and rust-build-release composite actions, including wiring into nested setup-rust-toolchain calls, a guarded export step in rust-build-release, tests, and documentation/changelog updates while preserving existing default behavior. Sequence diagram for rustflags passthrough in setup-rust and rust-build-releasesequenceDiagram
actor Workflow
participant RustBuildRelease as rust-build-release
participant SetupRust as setup-rust
participant SetupRustToolchain as setup-rust-toolchain
Workflow->>RustBuildRelease: run (inputs.rustflags)
alt inputs.rustflags != ''
RustBuildRelease->>RustBuildRelease: Export caller RUSTFLAGS
alt env.RUSTFLAGS already set
RustBuildRelease-->>RustBuildRelease: keep inherited RUSTFLAGS
else env.RUSTFLAGS unset
RustBuildRelease-->>RustBuildRelease: write RUSTFLAGS to GITHUB_ENV
end
else inputs.rustflags == ''
RustBuildRelease-->>RustBuildRelease: environment untouched
end
RustBuildRelease->>SetupRust: Setup Rust toolchain (rustflags input)
SetupRust->>SetupRustToolchain: call with rustflags: ${{ inputs.rustflags }}
alt env.RUSTFLAGS unset in setup-rust-toolchain
SetupRustToolchain-->>SetupRustToolchain: export RUSTFLAGS "-D warnings"
else env.RUSTFLAGS set
SetupRustToolchain-->>SetupRustToolchain: keep existing RUSTFLAGS
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f667b1b631
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. Ensure that this is validated against the current version of the codegraph. If further refinement to address this finding would be deleterious, please supply a clear explanatory one to two paragraph markdown message I can paste into the CodeScene web ui's diagnostic suppression function so this diagnostic can be silenced. .github/actions/rust-build-release/tests/test_manifest_input_step.py Comment on lines +66 to +93 def _parse_env_file(text: str) -> dict[str, str]:
"""Parse ``GITHUB_ENV`` content, honouring heredoc-delimited values."""
values: dict[str, str] = {}
lines = text.splitlines()
index = 0
while index < len(lines):
line = lines[index]
index += 1
if not line:
continue
name, separator, remainder = line.partition("=")
if separator:
values[name] = remainder
continue
name, separator, delimiter = line.partition("<<")
if not separator:
message = f"unparsable environment-file line: {line!r}"
raise AssertionError(message)
collected: list[str] = []
while index < len(lines) and lines[index] != delimiter:
collected.append(lines[index])
index += 1
if index >= len(lines):
message = f"unterminated heredoc for {name}"
raise AssertionError(message)
index += 1
values[name] = "\n".join(collected)
return values❌ New issue: Complex Method |
This comment was marked as resolved.
This comment was marked as resolved.
|
@coderabbitai Please investigate the cause of the following issue using codegraph exploration and research, identify a fix and provide an AI coding agent prompt for the fix: |
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.coverage:
- Around line 52-53: Remove the machine-specific .coverage artifact from the
change, add .coverage to the repository’s ignore configuration, and leave
coverage generation to CI. Do not retain the absolute worktree path; only
preserve repository-relative coverage data if intentionally versioned.
In @.github/actions/rust-build-release/action.yml:
- Around line 81-84: The inherited RUSTFLAGS check in
.github/actions/rust-build-release/action.yml lines 81-84 must use the Bash
3.2-compatible set-variable form [[ -n ${RUSTFLAGS+x} ]] instead of [[ -v
RUSTFLAGS ]]; update the corresponding assertion in
.github/actions/rust-build-release/tests/test_manifest_input_step.py line 197 to
expect the new guard.
In @.github/actions/rust-build-release/tests/test_manifest_input_step.py:
- Around line 55-56: Update the subprocess.run call in the test to pass
check=False explicitly, preserving the existing manual returncode assertion and
command execution behavior.
In @.github/actions/setup-rust/action.yml:
- Around line 44-46: Insert a comma before “so” in the RUSTFLAGS description at
.github/actions/setup-rust/action.yml lines 44-46 and the corresponding README
text at .github/actions/setup-rust/README.md line 23; make no other wording
changes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 3d36f68c-9f28-483d-abf7-bcb8dd8380d8
📒 Files selected for processing (25)
.coverage.github/actions/linux-packages/scripts/package.py.github/actions/release-to-pypi-uv/tests/_helpers.py.github/actions/rust-build-release/CHANGELOG.md.github/actions/rust-build-release/README.md.github/actions/rust-build-release/action.yml.github/actions/rust-build-release/tests/test_manifest_input_step.py.github/actions/setup-rust/CHANGELOG.md.github/actions/setup-rust/README.md.github/actions/setup-rust/action.yml.github/actions/setup-rust/tests/test_setup_rust_manifest.py.rules/python-00.md.rules/python-context-managers.md.rules/python-exception-design-raising-handling-and-logging.md.rules/python-generators.md.rules/python-return.md.rules/python-typing.mddocs/cmd-mox-users-guide.mddocs/execplans/2-4-5-extend-architecture-enforcement-to-orchestration-code.mddocs/execplans/add-mutation-testing-workflows.mddocs/execplans/support-cranelift-codegen.mddocs/local-validation-of-github-actions-with-act-and-pytest.mddocs/python-action-scripts.mddocs/scripting-standards.mdworkflow_scripts/graphql_client.py
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
leynos/polythene(auto-detected)
🛑 Comments failed to post (1)
.coverage (1)
52-53: 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
Information Disclosure (CWE-200): Exposure of Sensitive Information to an Unauthorized Actor
Remove the machine-specific coverage database from the change.
Line 52-53 records an absolute
/home/leynos/.../worktrees/...path, exposing local filesystem metadata and making the generated coverage artefact stale and non-portable. Remove.coveragefrom the patch, ignore it, and regenerate coverage in CI; retain only repository-relative data if versioning is intentional.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.coverage around lines 52 - 53, Remove the machine-specific .coverage artifact from the change, add .coverage to the repository’s ignore configuration, and leave coverage generation to CI. Do not retain the absolute worktree path; only preserve repository-relative coverage data if intentionally versioned.
|
@coderabbitai review |
✅ Action performedReview finished.
|
42e70a8 to
4b6120a
Compare
The shell-fragment tests run the export step against a fake GITHUB_ENV, so nothing checked that the heredoc it writes is one a real runner accepts, nor that the resulting RUSTFLAGS reaches a later step. Add two opt-in act tests covering propagation and inherited-value precedence. The workflow runs on the release event because the nested setup-rust skips sccache for releases, and the sccache post-step fails under act. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. Ensure that this is validated against the current version of the codegraph. If further refinement to address this finding would be deleterious, please supply a clear explanatory one to two paragraph markdown message I can paste into the CodeScene web ui's diagnostic suppression function so this diagnostic can be silenced. Code Duplication.github/actions/rust-build-release/tests/test_rustflags_export.py: What lead to degradation?The module contains 2 functions with similar structure: test_export_rustflags_defers_to_inherited_empty_value,test_export_rustflags_defers_to_inherited_value Why does this problem occur?Duplicated code often leads to code that's harder to change since the same logical change has to be done in multiple functions. More duplication gives lower code health. How to fix it?A certain degree of duplicated code might be acceptable. The problems start when it is the same behavior that is duplicated across the functions in the module, ie. a violation of the Don't Repeat Yourself (DRY) principle. DRY violations lead to code that is changed together in predictable patterns, which is both expensive and risky. DRY violations can be identified using CodeScene's X-Ray analysis to detect clusters of change coupled functions with high code similarity. Read More |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
The empty and non-empty cases differed only in the inherited value, so fold them into one parametrized test. Each case gets its own temporary directory, since the helper truncates the environment file per invocation. The property test stays separate: it asserts the same precedence across generated payloads rather than the two worked examples. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
@coderabbitai Have the following now been resolved? .github/actions/rust-build-release/tests/test_manifest_input_step.py (1)
🤖 Detailed instructionsVerify each finding against current code. Fix only still-valid issues, skip the In @.github/actions/rust-build-release/tests/test_manifest_input_step.py around Source: Path instructions |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
test_dir=".github/actions/rust-build-release/tests"
main_test="$test_dir/test_manifest_input_step.py"
printf '%s\n' '--- current relevant files ---'
fd -t f . "$test_dir" | sort | rg 'test_manifest_input_step|heredoc|conftest|fixture|rustflags'
printf '%s\n' '--- physical and logical line counts ---'
for file in $(fd -t f -e py . "$test_dir" | sort); do
case "$file" in
*test_manifest_input_step*.py|*heredoc*.py|*/conftest.py|*fixture*.py)
physical=$(wc -l < "$file")
logical=$(awk 'NF && $1 !~ /^`#/`' "$file" | wc -l)
printf '%s: physical=%s logical_noncomment=%s\n' "$file" "$physical" "$logical"
;;
esac
done
printf '%s\n' '--- main module outline ---'
ast-grep outline "$main_test" --items all --view expanded
printf '%s\n' '--- helper definitions and relevant test definitions ---'
rg -n -C 2 \
'^(def (_load_action_manifest|_find_step|_export_rustflags_run_script|_run_export_script|_parse_env_file|_parse_heredoc_value|_write_od_stub)|def test_.*(heredoc|delimiter|collision|round_trip|export_rustflags))' \
"$test_dir" --glob '*.py' || true
printf '%s\n' '--- current main module boundaries ---'
nl -ba "$main_test" | sed -n '1,520p'Length of output: 10348 🏁 Script executed: #!/bin/bash
set -euo pipefail
test_dir=".github/actions/rust-build-release/tests"
printf '%s\n' '--- line counts for split-related Python modules ---'
for file in \
"$test_dir/test_manifest_input_step.py" \
"$test_dir/test_rustflags_export.py" \
"$test_dir/rust_build_release_test_helpers.py" \
"$test_dir/conftest.py"
do
if [ -f "$file" ]; then
physical=$(wc -l < "$file")
logical=$(awk 'NF && $1 !~ /^`#/`' "$file" | wc -l)
printf '%s: physical=%s logical_noncomment=%s\n' "$file" "$physical" "$logical"
else
printf '%s: absent\n' "$file"
fi
done
printf '%s\n' '--- extracted test module outline ---'
ast-grep outline "$test_dir/test_rustflags_export.py" --items all --view expanded
printf '%s\n' '--- shared helper module outline ---'
if [ -f "$test_dir/rust_build_release_test_helpers.py" ]; then
ast-grep outline "$test_dir/rust_build_release_test_helpers.py" --items all --view expanded
fi
printf '%s\n' '--- imports shared by the split modules ---'
sed -n '1,45p' "$test_dir/test_manifest_input_step.py"
sed -n '1,65p' "$test_dir/test_rustflags_export.py"
if [ -f "$test_dir/rust_build_release_test_helpers.py" ]; then
sed -n '1,180p' "$test_dir/rust_build_release_test_helpers.py"
fi
printf '%s\n' '--- changed test-directory Python files in PR ---'
git diff --name-status origin/main...HEAD -- "$test_dir" -- '*.py' 2>/dev/null || true
printf '%s\n' '--- conftest diff summary ---'
git diff --numstat origin/main...HEAD -- "$test_dir/conftest.py" 2>/dev/null || trueLength of output: 9735
The current codegraph satisfies the reported requirement.
No further change is required for this finding.
The sandbox could inspect the codegraph but could not run tests. Test execution remains unverified. You are interacting with an AI system. |
rust-build-release pins a remote setup-rust revision, so the existing act jobs never ran the action this branch changes. Add two jobs that use the local action directly, with an explicit toolchain so exactly one of its three install paths is taken. The first shows the input reaching a later step. The second pins the deferral to an inherited value: setup-rust forwards the input unconditionally, so that behaviour belongs to the nested setup-rust-toolchain and a version bump could otherwise change it silently. Both were observed under act before the assertions were written. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/test-rustflags-export.yml (1)
81-83: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winRemove the trailing blank line.
YAMLlint flags an extra blank line at the end of the file (
empty-lines). Trim it.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/test-rustflags-export.yml around lines 81 - 83, Remove the trailing blank line at the end of the workflow after the setup_rust_inherited_rustflags step, leaving the file ending immediately after the final content line so YAML lint passes.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/test-rustflags-export.yml:
- Around line 8-11: Add a concurrency block to the workflow trigger
configuration so runs are grouped consistently and newer workflow_dispatch or
release runs cancel superseded in-progress runs. Preserve the existing triggers
and configure cancellation for in-progress executions.
- Around line 1-12: Add a workflow-level permissions block to the “Test
rustflags export” workflow, granting only contents: read. Do not add write
permissions or change the existing triggers and job behavior.
- Line 18: Update all four actions/checkout@v4 uses in the workflow to the
pinned commit 11d5960a326750d5838078e36cf38b85af677262 with the # v4 annotation,
and set persist-credentials to false for each checkout step.
In `@docs/developers-guide.md`:
- Around line 519-520: Update the prose in the heredoc explanation to remove the
comma before “because” in the phrase “as a plain assignment because the value
may contain newlines,” preserving the rest of the wording and meaning.
---
Outside diff comments:
In @.github/workflows/test-rustflags-export.yml:
- Around line 81-83: Remove the trailing blank line at the end of the workflow
after the setup_rust_inherited_rustflags step, leaving the file ending
immediately after the final content line so YAML lint passes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: adb7e1e6-7d06-47db-b5b5-ecd4f5167785
📒 Files selected for processing (8)
.github/actions/rust-build-release/action.yml.github/actions/rust-build-release/tests/rust_build_release_test_helpers.py.github/actions/rust-build-release/tests/test_manifest_input_step.py.github/actions/rust-build-release/tests/test_rustflags_export.py.github/workflows/test-rustflags-export.ymldocs/developers-guide.mdtests/workflows/fixtures/release.event.jsontests/workflows/test_rustflags_export_workflow.py
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
leynos/polythene(auto-detected)
The pinned setup-rust-toolchain writes its rustflags input to GITHUB_ENV as `echo "RUSTFLAGS=$NEW_RUSTFLAGS"`, a plain assignment. Before this branch that value was the action's own hardcoded default; adding the rustflags input made it caller-controlled, so a line break in it would append further environment-file entries and set variables the caller never asked for. The nested action cannot be changed, so reject CR and LF before forwarding. The rejected value is never echoed. Tests cover the three line-break forms and pin the guard to the sink it protects by reproducing that echo and showing it does create a second entry. Move the rustflags tests into their own module to stay within the file size limit, with the manifest lookups they share in a sibling helper. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Pin the checkouts to the SHA the rest of the repository uses, drop their credentials, restrict the token to contents: read, and cancel superseded runs. The workflow was the only one of eighteen with no permissions block at all. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
@coderabbitai Have the following now been resolved? .github/workflows/test-rustflags-export.yml (1)
🤖 Detailed instructionsVerify each finding against current code. Fix only still-valid issues, skip the In @.github/workflows/test-rustflags-export.yml around lines 81 - 83, Remove the Source: Linters/SAST tools |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
workflow=".github/workflows/test-rustflags-export.yml"
printf '%s\n' '--- final numbered lines ---'
tail -n 12 "$workflow" | cat -n
printf '%s\n' '--- final bytes ---'
tail -c 32 "$workflow" | od -An -tx1c
printf '%s\n' '--- blank-line check after final content ---'
python3 - "$workflow" <<'PY'
from pathlib import Path
import sys
path = Path(sys.argv[1])
data = path.read_bytes()
print(f"ends_with_single_lf={data.endswith(b'\\n') and not data.endswith(b'\\n\\n')}")
print(f"trailing_lf_count={len(data) - len(data.rstrip(b'\\n'))}")
print(f"last_nonempty_line={next(line for line in reversed(data.decode('utf-8').splitlines()) if line.strip())!r}")
PY
printf '%s\n' '--- YAML lint configuration candidates ---'
fd -a -i '.yamllint*' . || true
rg -n -C 3 'empty-lines|yamllint' .yamllint* pyproject.toml Makefile .github 2>/dev/null || trueLength of output: 1856 🏁 Script executed: #!/bin/bash
set -euo pipefail
workflow=".github/workflows/test-rustflags-export.yml"
printf '%s\n' '--- final lines with end-of-line markers ---'
tail -n 4 "$workflow" | sed -n 'l'
printf '%s\n' '--- terminal newline structure ---'
python3 - "$workflow" <<'PY'
from pathlib import Path
import sys
data = Path(sys.argv[1]).read_bytes()
trailing_newlines = len(data) - len(data.rstrip(b"\n"))
print(f"trailing_newlines={trailing_newlines}")
print(f"has_extra_terminal_blank_line={trailing_newlines > 1}")
print(f"ends_with_newline={data.endswith(b'\n')}")
PY
printf '%s\n' '--- whitespace errors in current diff ---'
git diff --check
printf '%s\n' '--- YAML lint configuration ---'
fd -a -i '.yamllint*' . || true
rg -n -C 3 'empty-lines|yamllint' \
.yamllint .yamllint.yaml .yamllint.yml pyproject.toml Makefile \
.github 2>/dev/null || trueLength of output: 1679 🏁 Script executed: #!/bin/bash
set -euo pipefail
workflow=".github/workflows/test-rustflags-export.yml"
python3 - "$workflow" <<'PY'
from pathlib import Path
import sys
data = Path(sys.argv[1]).read_bytes()
trailing_newlines = len(data) - len(data.rstrip(b"\n"))
ends_with_newline = data.endswith(b"\n")
print(f"trailing_newlines={trailing_newlines}")
print(f"has_extra_terminal_blank_line={trailing_newlines > 1}")
print(f"ends_with_newline={ends_with_newline}")
PY
printf '%s\n' '--- whitespace errors in current diff ---'
git diff --check
printf '%s\n' '--- YAML lint configuration references ---'
rg -n -C 3 'empty-lines|yamllint' \
.yamllint .yamllint.yaml .yamllint.yml pyproject.toml Makefile \
.github 2>/dev/null || trueLength of output: 1056
Do not make a change for this finding. The current file ends after: run: echo "setup_rust_inherited_rustflags=[${RUSTFLAGS-unset}]"The file has exactly one terminal newline and no trailing blank line:
You are interacting with an AI system. |
|
@coderabbitai please create new GitHub issues for the following: ❌ Failed checks (2 errors)
|
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- affected helper module ---'
helper='.github/actions/rust-build-release/tests/_packaging_utils.py'
if [[ -f "$helper" ]]; then
sed -n '1,120p' "$helper"
else
printf 'Missing: %s\n' "$helper"
fi
printf '%s\n' '--- setup-rust RustFLAGS forwarding ---'
setup='.github/actions/setup-rust/action.yml'
rg -n -C 8 'rustflags|RUSTFLAGS|GITHUB_ENV|NEW_RUSTFLAGS' "$setup" || true
printf '%s\n' '--- candidate runtime tests ---'
rg -n -C 5 'RUSTFLAGS|rustflags|GITHUB_ENV|NEW_RUSTFLAGS' \
.github/actions/setup-rust/tests \
.github/actions/rust-build-release/tests \
--glob '*.py' || true
printf '%s\n' '--- potentially duplicate open issues ---'
gh issue list --repo leynos/shared-actions --state open --limit 100 \
--search '("packaging_utils" OR "module docstring" OR "RUSTFLAGS" OR "rustflags" OR "GITHUB_ENV" OR "newline injection") in:title,body' \
--json number,title,url,body,assigneesLength of output: 65743
Creating issues now would record already completed work as open defects. ✏️ Learnings added
You are interacting with an AI system. |
Summary
This branch adds a
rustflagspassthrough to thesetup-rustandrust-build-releasecomposite actions so consumers can stop the nestedactions-rust-lang/setup-rust-toolchainstep from silently stripping flags their builds require.That nested step exports
RUSTFLAGS="-D warnings"into the job environment whenever the variable is unset, and an ambientRUSTFLAGSoverrides Cargo'sbuild.rustflagsconfiguration. Projects whose source tree requires specific flags in.cargo/config.toml— netsuke's-Zpolonius=nextborrow-checker flag being the motivating case (leynos/netsuke#465, leynos/netsuke#472) — therefore fail to compile in any step after setup unless every recipe re-states the flags.setup-rust/action.ymlgains arustflagsinput forwarded to all three nestedsetup-rust-toolchaininvocations. The default preserves the historical-D warnings; the empty string leavesRUSTFLAGSunset so the project's Cargo configuration applies.rust-build-release/action.ymlgains arustflagsinput exported ahead of its internally pinnedsetup-ruststep, through aGITHUB_ENVheredoc with env-var indirection (no template expansion inside the script). A pre-existingRUSTFLAGSstill takes precedence. Implementing the export locally avoids bumping the internalsetup-rust-v1pin inside this pull request.Review walkthrough
setup-rust/action.ymlfor the input declaration and the three forwarding sites.rust-build-release/action.yml, including its inherited-value guard and ordering before "Setup Rust toolchain".test_setup_rust_manifest.pyandtest_manifest_input_step.py, plus the README and changelog updates for both actions.Validation
uv run --with pytest --with pyyaml pytest .github/actions/setup-rust/tests/ .github/actions/rust-build-release/tests/test_manifest_input_step.py -q: all pass (30 + 7).uv tool run ruff checkandruff format --checkon the changed test files: clean.markdownlint-cli2on the changed READMEs and changelogs: 0 errors.Notes
Behaviour is unchanged for existing consumers:
setup-rustdefaults to the historical-D warnings, andrust-build-releasedefaults to not touching the environment. Netsuke currently works around the issue with job-levelRUSTFLAGSenv blocks; once this lands and the action tags move, it can adopt the inputs instead.References
Summary by Sourcery
Add configurable RUSTFLAGS passthrough to the shared Rust setup and release build composite actions to avoid clobbering project-specific compiler flags while preserving default behaviour for existing consumers.
New Features:
Enhancements:
Tests: