Skip to content

feat: add deps-only to the nss action - #140

Merged
larseggert merged 1 commit into
mainfrom
nss-deps-only
Sep 4, 2026
Merged

larseggert merged 1 commit into
mainfrom
nss-deps-only

Conversation

@larseggert

Copy link
Copy Markdown
Collaborator

Installs the per-platform NSS build toolchain and sets up the environment without acquiring NSS, so that a caller can build its own checkout. Export the build flags as NSS_BUILD_FLAGS so those callers build NSS the same way this action does.

Copilot AI balanced review requested due to automatic review settings September 4, 2026 06:49
Comment thread .github/workflows/test.yml Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Input validation, target-aware flags, and a guaranteed-failing test assertion must be corrected.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds an NSS dependencies-only mode for callers building custom checkouts.

Changes:

  • Adds deps-only toolchain setup.
  • Exports shared NSS build flags.
  • Documents and tests the new mode.
File summaries
File Description
README.md Documents dependencies-only usage.
nss/action.yml Implements toolchain-only setup and build flags.
.github/workflows/test.yml Adds cross-platform coverage.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 3
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/test.yml Resolved
Comment thread nss/action.yml Resolved
Comment thread nss/action.yml Resolved

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useful addition, and exporting the flag string is the right way to keep callers in lockstep with the action. Two themes cut across the diff.

The suitable=1 overload costs more than it saves. Setting suitable in deps-only mode skips two steps (Retrieve NSS, Restore NSS cache) but forces four steps to special-case the mode anyway, and leaves Build/Save NSS cache gated on a condition whose name ("system NSS is suitable") no longer describes what it tests. The alternative reads better for roughly the same line count: leave system_nss honest (skip it entirely when deps-only), and add inputs.deps-only != 'true' to the four steps that must not run (Retrieve NSS, Restore/Save NSS cache, Build) — then every condition means what it says and check_build/Set up environment need no override at all. Renaming build_nss to something toolchain-shaped would finish the job.

NSS_BUILD_FLAGS isn't yet a complete contract. It omits the target-specific -t ia32, isn't part of the cache key, and is read back from the ambient job environment by the step that produced it. Details inline; the common fix is to compute the full flag string (including target flags) once in Set up environment and hand it to Build as a step output rather than via $GITHUB_ENV.

Unrelated to the above: the github-advanced-security bot's $/nss suggestion on line 268 applies equally to the pre-existing uses: ./nss at lines 240, 335 and 357, so it's a repo-wide pattern rather than something this PR introduces — either fix all four or leave it.

Comment thread nss/action.yml Resolved
Comment thread nss/action.yml Resolved
Comment thread nss/action.yml Resolved
Comment thread nss/action.yml Resolved
Comment thread nss/action.yml Resolved
Comment thread .github/workflows/test.yml Resolved
Comment thread README.md Resolved
Comment thread README.md Resolved
Copilot AI review requested due to automatic review settings September 4, 2026 07:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The action accepts unsupported Android dependency-only targets and performs unnecessary Android setup instead of failing early.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread nss/action.yml Resolved

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The revision addressed everything substantive from the previous round: the conditional-requirement validation step is in, -t ia32 is folded into NSS_BUILD_FLAGS (which also collapsed the duplicated build.sh invocation in Build — nice), the internal build is pinned to steps.setup_env.outputs.build-flags so an ambient value can't change what gets cached under a flag-agnostic key, the test's $NSS_DIR assertion now checks for build.sh, and the Windows toolchain assertion no longer passes on the runner image's ninja. Two things remain, both inline.

Repo-wide observations:

  • build_nss is now a misnomer. The step was renamed to "Check if the build toolchain is needed", but the output it sets is still build_nss and it gates seven toolchain steps that all legitimately run in deps-only mode, where no NSS is built. steps.check_build.outputs.build_nss && inputs.deps-only != 'true' on Build/Save NSS cache then reads as a contradiction. Renaming the output to toolchain would make the conditions self-explanatory.
  • NSS_DIR is not caller-configurable. The contract obliges a deps-only caller to place its checkout at $GITHUB_WORKSPACE/nss, which is what neqo does today but is otherwise an odd constraint on a "bring your own checkout" mode. An optional nss-dir input (defaulting to today's value) would fit the mode better; not worth blocking on if the only consumer already complies.
  • The advertised contract is still unexercised (second half of my earlier comment on the test job, unresolved): nothing runs $NSS_DIR/build.sh $NSS_BUILD_FLAGS against a real checkout, which is what would have caught the -t ia32 omission and would catch the CFLAGS gap below. test-nss already pays for a from-source build on these runners, so the marginal cost of one such job is a reasonable guard against drift in the flag string.

Comment thread nss/action.yml Resolved
Comment thread README.md Resolved
Copilot AI review requested due to automatic review settings September 4, 2026 09:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unsupported x86 targets bypass validation in dependency-only mode, and documented/tested toolchain behavior is incomplete.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Comment thread .github/workflows/test.yml Resolved
Comment thread nss/action.yml Resolved
Comment thread README.md Resolved

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds a deps-only mode to the nss action and, as a prerequisite, promotes the build flags to a single definition (NSS_BUILD_FLAGS/NSS_BUILD_CFLAGS, exported both as job env for callers and as step outputs for the action's own Build). The dual export is a bit unusual but is the right call here: it keeps one source of truth while making the internal build immune to ambient env, and it collapsed the duplicated build.sh invocations into one.

The previous round's findings all look addressed in a337c55: conditional-input validation added, Android rejected up front, -t ia32 folded into the exported flags (and the i686 branch merged into else), CFLAGS promoted to NSS_BUILD_CFLAGS, Build pinned to step outputs, the suitable overload replaced with explicit deps-only != 'true' gates, per-platform toolchain assertions in the test, and the README qualified with the system-NSS caveat, sccache, and the Android exclusion.

Two architectural observations:

  • The mode is expressed as inputs.deps-only != 'true' on six step conditions, and any future step has to remember to opt in or out. Given check_build.outputs.build_nss is now effectively "the toolchain is needed", a single deps-only-aware output computed once (e.g. check_build also emitting acquire_nss) would keep the branching in one place instead of scattered across if: expressions.
  • Check if the build toolchain is needed was renamed but still emits build_nss, which now means "install the toolchain" rather than "build NSS". Renaming the output to match would remove a small readability trap for the next reader.

Comment thread nss/action.yml Resolved
Comment thread nss/action.yml Resolved
Comment thread .github/workflows/test.yml Resolved
Comment thread README.md Resolved
Copilot AI review requested due to automatic review settings September 4, 2026 09:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new test job uses a malformed local action reference, and the documented Windows build command differs from the action.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread .github/workflows/test.yml Resolved
Comment thread README.md Resolved

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hoisting the flag set into a single NSS_BUILD_FLAGS/NSS_BUILD_CFLAGS definition and pinning it onto Build via step outputs is the right shape — the internal build and the documented caller recipe now genuinely share one source of truth, and folding -t ia32 and the 32-bit target rejection into Set up environment/Validate inputs removes the duplicated target logic from Build. The Validate inputs step also makes the previously-implicit target contract explicit for all modes, which is a small improvement over the old behaviour (an unsupported i?86-* target with a cache hit used to succeed).

All previously raised points look addressed: conditional-required validation, ambient-env pinning of the build flags, -t ia32 in the exported value, CFLAGS parity between the action and the README recipe, Android rejection under deps-only, per-platform precision in the toolchain assertions and the README wording, and the now-dead RUNNER_OS on Build.

Two things that apply to the PR as a whole:

  • Public API. Dropping required: true from minimum-version/sha256 moves the missing-input failure from actionlint (static, at lint time, for local ./nss callers) to a runtime step. That's the necessary trade for a conditional requirement, but it is a real loss for downstream repos that lint their workflows; worth a line in the commit message or release notes. The new Validate inputs logic is itself untested — a job with continue-on-error: true on the $/nss step plus an if: steps.x.outcome != 'failure' assertion would cover both branches cheaply.
  • Mode plumbing. deps-only != 'true' now appears on seven steps, and check_build is overloaded to mean "toolchain needed" in one mode and "NSS build needed" in the other (hence the renamed step whose output is still build_nss). An alternative shape is a separate nss-deps composite that installs the toolchain and exports the flags, with nss composing it and doing acquire/cache/build — no per-step guards, no inputs that are inert in one mode, and deps-only callers get an action whose interface is exactly what they need. Probably not worth the churn now, but if a third mode ever shows up, the guard-per-step approach won't scale.

Comment thread README.md Resolved
Comment thread README.md Resolved
Comment thread .github/workflows/test.yml Resolved
Installs the per-platform NSS build toolchain and sets up the environment without acquiring NSS, so a caller can build its own checkout.

Export the build flags as NSS_BUILD_FLAGS and NSS_BUILD_CFLAGS so those callers build NSS exactly as this action does.

minimum-version and sha256 are now conditionally required, validated at run time rather than statically by actionlint.
Copilot AI review requested due to automatic review settings September 4, 2026 10:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation is consistent with existing build paths and includes appropriate cross-platform coverage.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: deps-only for the nss action

The reshaping is a clear improvement over the previous round: build flags are now a single constant computed once in Set up environment, Build consumes them via step outputs (so ambient job env can't redefine them), and the target/32-bit validation was hoisted into a step that runs in both modes. The new matrix job covers the three OSes plus the one path where the exported flags vary.

Previously raised, now resolved: the missing required-input replacement check; -t ia32 absent from NSS_BUILD_FLAGS; the i?86-* guard being unreachable in deps-only; deps-only + Android silently accepted; the $NSS_DIR existence assertion that could never fail; gyp/ninja unasserted on Windows; RUNNER_OS left dead in Build; the README recipe omitting the sccache exports and unconditionally setting an empty CFLAGS; and cache not being listed as a no-op.

Responding to another reviewer: the comment calling uses: $/nss malformed is not right — $/ is GitHub's same-repository reference and this repo already uses it in eight workflows (clippy.yml, mutants.yml, rustfmt.yml, machete.yml, sanitize.yml, rdme.yml, mutants-pr.yml, claude-review.yml); it is also what code-scanning alert #87 asks for. The only real wrinkle is intra-file inconsistency: the sibling test-nss, test-nss-i686 and test-nss-android jobs still say ./nss, and the two forms resolve differently (workspace checkout vs. workflow repo+ref). Worth converting the others in a follow-up rather than reverting this one.

Architectural note: the exported contract is "two env vars plus a shell recipe the caller must replicate", and that recipe now exists twice — in Build and in the README — with the CC/CXX/CFLAGS handling having drifted between them across two review rounds already. Emitting an executable single source of truth instead (e.g. the action writes a small nss-build.sh wrapper into the workspace and exports its path) would collapse NSS_BUILD_FLAGS, NSS_BUILD_CFLAGS, the sccache exports and the target handling into one thing that CI can actually run, and would let the deps-only test assert that the toolchain works rather than that four variables have plausible values.

Minor, both outside the diff: check_build's output is still named build_nss although the step is now "Check if the build toolchain is needed" and is always true in deps-only; and Store Ubuntu release code name (Linux) still runs in deps-only mode even though its only consumer, the cache key, is skipped.

Comment thread nss/action.yml
Comment on lines +60 to +64
i686-*-linux-gnu) ;;
i?86-*)
echo "::error::Unsupported 32-bit x86 target: $TARGET_PLATFORM (only i686-*-linux-gnu is handled)"
exit 1 ;;
esac

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

The i?86-* rejection closes only part of the hole: any other non-empty target (aarch64-unknown-linux-gnu, aarch64-apple-darwin, …) falls off the end of the case and gets an NSS_BUILD_FLAGS with no -t at all, so a deps-only caller following the documented recipe silently builds for the host arch — the exact failure mode this step was added to prevent for i586. deps-only is the mode where nothing downstream can catch it, so reject unrecognised targets here:

Suggested change
i686-*-linux-gnu) ;;
i?86-*)
echo "::error::Unsupported 32-bit x86 target: $TARGET_PLATFORM (only i686-*-linux-gnu is handled)"
exit 1 ;;
esac
i686-*-linux-gnu) ;;
i?86-*)
echo "::error::Unsupported 32-bit x86 target: $TARGET_PLATFORM (only i686-*-linux-gnu is handled)"
exit 1 ;;
"") ;;
*) # No -t flag is derived for these, so build.sh would target the host.
[ "$DEPS_ONLY" != "true" ] ||
{ echo "::error::deps-only does not support target $TARGET_PLATFORM; build.sh would build for the host architecture"; exit 1; } ;;
esac

Comment thread nss/action.yml
Comment on lines +270 to +273
# build.sh defaults target_arch to the host, so set it for the one
# cross-arch target supported here.
IA32=""
[[ $TARGET_PLATFORM == i686-*-linux-gnu ]] && IA32=" -t ia32"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

i686-*-linux-gnu is now matched independently in three steps — Validate inputs, Install build dependencies (Linux) and here — and all three must agree or the toolchain and the flags drift apart. Since Validate inputs already classifies the target, consider having it emit the -t ia32 string (or an ia32=1 marker) as a step output and consuming that in the other two.

Comment thread nss/action.yml
Comment on lines +290 to +294
# Also as outputs, so that Build below cannot pick up ambient values.
{
echo "build-flags=$FLAGS"
echo "build-cflags=$CFLAGS_FOR_NSS"
} >> "$GITHUB_OUTPUT"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

These are step outputs, not action outputs, so the only contract a deps-only caller can consume is the GITHUB_ENV copy — which then sits in the environment of every remaining step in the job (cargo, tests, other actions) purely to carry a build recipe. The values already exist as outputs, so promoting them next to ndk-version gives callers the idiomatic, non-ambient path (${{ steps.nss.outputs.build-flags }}):

outputs:
  ndk-version:
    description: "Android NDK version derived from application-services (Android builds only)"
    value: ${{ steps.android-ndk.outputs.ndk-version }}
  build-flags:
    description: "build.sh flags this action uses (empty when system NSS is used)"
    value: ${{ steps.setup_env.outputs.build-flags }}
  build-cflags:
    description: "CFLAGS this action exports around build.sh (empty on Windows)"
    value: ${{ steps.setup_env.outputs.build-cflags }}

Comment thread .github/workflows/test.yml Resolved
Comment thread README.md Resolved
@larseggert
larseggert merged commit 47d5a4b into main Sep 4, 2026
63 checks passed
@larseggert
larseggert deleted the nss-deps-only branch September 4, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants