-
Notifications
You must be signed in to change notification settings - Fork 883
build(nix): add per-crate crane workspace builds #1652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
SDAChess
wants to merge
17
commits into
main
Choose a base branch
from
sscatton/nix-add-build-with-crane
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+797
−342
Draft
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
aaba5f2
build(nix): add per-crate crane workspace builds
SDAChess 4c896f9
refactor(nix): centralize crate build specs
SDAChess b40bbf7
fix(nix): provide protoc for builds
SDAChess 2584fe1
refactor(nix): propagate workspace crate inputs
SDAChess bffcd76
test(sandbox): make unit tests hermetic
SDAChess e02b655
test(nix): add per-crate cargo test checks
SDAChess 06cdc26
ci: replace branch checks with nix workflow
SDAChess 0c3cd1f
ci: add nix rustfmt lint check
SDAChess 86c1dee
ci: add nix clippy lint checks
SDAChess 1daafb9
ci: upload nix outputs to cachix
SDAChess d7bc4a7
ci: use cachix action for nix cache
SDAChess 3df3532
ci: deduplicate nix workflow setup
SDAChess a1de5fd
ci: factor nix build workflow action
SDAChess cad0cde
ci: build nix container images
SDAChess 8cb82f1
ci: add nix SPDX header check
SDAChess 3576220
ci: batch nix workflow targets
SDAChess eab1d5e
fix(nix): repair supervisor crate source packaging (#1953)
elezar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: Nix Build | ||
| description: Install Nix, configure Cachix, and build flake targets. | ||
|
|
||
| inputs: | ||
| build: | ||
| description: Flake output namespace, such as packages or checks. | ||
| required: true | ||
| system: | ||
| description: Nix system to build for. | ||
| required: true | ||
| targets: | ||
| description: Newline-separated package or check targets to build. | ||
| required: true | ||
| cachix_auth_token: | ||
| description: Cachix write token. | ||
| required: true | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Install Nix | ||
| uses: DeterminateSystems/nix-installer-action@main | ||
| with: | ||
| extra-conf: | | ||
| accept-flake-config = true | ||
|
|
||
| - name: Set up Cachix | ||
| uses: cachix/cachix-action@5f2d7c5294214f71b873db4b969586b980625e71 # v17 | ||
| with: | ||
| name: openshell | ||
| authToken: ${{ inputs.cachix_auth_token }} | ||
| skipAddingSubstituter: true | ||
|
|
||
| - name: Build targets | ||
| shell: bash | ||
| env: | ||
| BUILD: ${{ inputs.build }} | ||
| SYSTEM: ${{ inputs.system }} | ||
| TARGETS: ${{ inputs.targets }} | ||
| run: | | ||
| attrs=() | ||
| while IFS= read -r target; do | ||
| [ -n "$target" ] || continue | ||
| attrs+=(".#${BUILD}.${SYSTEM}.${target}") | ||
| done <<< "$TARGETS" | ||
|
|
||
| nix build "${attrs[@]}" --no-link --no-update-lock-file |
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| name: Nix CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - "pull-request/[0-9]+" | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build (${{ matrix.target.system }}) | ||
| runs-on: ${{ matrix.target.runner }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| target: | ||
| - system: x86_64-linux | ||
| runner: linux-amd64-cpu8 | ||
| - system: aarch64-linux | ||
| runner: linux-arm64-cpu8 | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
|
|
||
| - name: Build packages | ||
| uses: ./.github/actions/setup-nix | ||
| with: | ||
| build: packages | ||
| system: ${{ matrix.target.system }} | ||
| targets: | | ||
| openshell | ||
| openshell-gateway | ||
| openshell-sandbox | ||
| openshell-driver-kubernetes | ||
| openshell-driver-podman | ||
| openshell-driver-vm | ||
| cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
|
|
||
| images: | ||
| name: Build Images (${{ matrix.target.system }}) | ||
| needs: build | ||
| runs-on: ${{ matrix.target.runner }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| target: | ||
| - system: x86_64-linux | ||
| runner: linux-amd64-cpu8 | ||
| - system: aarch64-linux | ||
| runner: linux-arm64-cpu8 | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
|
|
||
| - name: Build images | ||
| uses: ./.github/actions/setup-nix | ||
| with: | ||
| build: packages | ||
| system: ${{ matrix.target.system }} | ||
| targets: | | ||
| openshell-gateway-image | ||
| openshell-supervisor-image | ||
| cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
|
|
||
| test: | ||
| name: Test (${{ matrix.target.system }}) | ||
| needs: build | ||
| runs-on: ${{ matrix.target.runner }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| target: | ||
| - system: x86_64-linux | ||
| runner: linux-amd64-cpu8 | ||
| - system: aarch64-linux | ||
| runner: linux-arm64-cpu8 | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
|
|
||
| - name: Run tests | ||
| uses: ./.github/actions/setup-nix | ||
| with: | ||
| build: checks | ||
| system: ${{ matrix.target.system }} | ||
| targets: | | ||
| openshell-bootstrap-test | ||
| openshell-cli-test | ||
| openshell-core-test | ||
| openshell-driver-docker-test | ||
| openshell-driver-kubernetes-test | ||
| openshell-driver-podman-test | ||
| openshell-driver-vm-test | ||
| openshell-ocsf-test | ||
| openshell-policy-test | ||
| openshell-prover-test | ||
| openshell-providers-test | ||
| openshell-router-test | ||
| openshell-sandbox-test | ||
| openshell-server-macros-test | ||
| openshell-server-test | ||
| openshell-tui-test | ||
| openshell-vfio-test | ||
| cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
|
|
||
| lint: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean that the |
||
| name: Lint | ||
| runs-on: linux-amd64-cpu8 | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
|
|
||
| - name: Run lints | ||
| uses: ./.github/actions/setup-nix | ||
| with: | ||
| build: checks | ||
| system: x86_64-linux | ||
| targets: | | ||
| rustfmt | ||
| spdx-headers | ||
| openshell-bootstrap-clippy | ||
| openshell-cli-clippy | ||
| openshell-core-clippy | ||
| openshell-driver-docker-clippy | ||
| openshell-driver-kubernetes-clippy | ||
| openshell-driver-podman-clippy | ||
| openshell-driver-vm-clippy | ||
| openshell-ocsf-clippy | ||
| openshell-policy-clippy | ||
| openshell-prover-clippy | ||
| openshell-providers-clippy | ||
| openshell-router-clippy | ||
| openshell-sandbox-clippy | ||
| openshell-server-macros-clippy | ||
| openshell-server-clippy | ||
| openshell-tui-clippy | ||
| openshell-vfio-clippy | ||
| cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is somewhat of an arbitrary location to start the 🧵, but one that that jumped out as I'm reviewing is how often we need to repeat crate names. Is that assessment right? Is this something we can improve on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends, we can definitely store this in a variable. I just wanted to be as explicit as possible but we can definitely make it shorter.