-
Notifications
You must be signed in to change notification settings - Fork 9
nix build system part 3 (don't merge me yet) #1252
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
daniel-noland
wants to merge
16
commits into
main
Choose a base branch
from
refactor-flags6
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.
Draft
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
007b0d7
build(nix): shell.nix support
daniel-noland 056a769
build(nix): phase out rust-toolchain.toml
daniel-noland 44b010c
build(nix): frr build
daniel-noland 8ff7b76
fix(build): remove gc-sections and as-needed
daniel-noland 92aef8c
build: rework build.rs scripts
daniel-noland b6b8fa9
build(nix): clean up dpdk build
daniel-noland 29d1e57
fix(build): wrong bluefield2 platform
daniel-noland 515571b
build(nix): fix missing prime in libunwind build
daniel-noland bd3307d
build(nix): formatting
daniel-noland 8a978de
build(nix): dataplane debug contianer
daniel-noland 568330b
build(nix): add minimal gdb build
daniel-noland e8d4200
fix(build): incorrect tokio features in dev-depends
daniel-noland b2fd9e8
fix(doc): typo
daniel-noland ff5e0d8
chore(docs): clean up pointless include for link
daniel-noland 19b8859
roll over to new build
daniel-noland 5c80d39
wip
daniel-noland 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 |
|---|---|---|
| @@ -1,13 +1,10 @@ | ||
| [env] | ||
| COMPILE_ENV = { value = "compile-env", relative = true, force = false } | ||
| PATH = { value = "compile-env/bin", relative = true, force = true } | ||
| LIBCLANG_PATH = { value = "compile-env/lib", relative = true, force = true } | ||
| PKG_CONFIG_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/release/lib/pkgconfig", relative = true, force = true } | ||
| DATAPLANE_SYSROOT = { value = "sysroot", relative = true, force = false } | ||
| C_INCLUDE_PATH = { value = "sysroot/include", relative = true, force = false } | ||
| LIBRARY_PATH = { value = "sysroot/lib", relative = true, force = false } | ||
| GW_CRD_PATH = { value = "devroot/src/gateway/config/crd/bases", relative = true, force = false } | ||
| PKG_CONFIG_PATH = { value = "sysroot/lib/pkgconfig", relative = true, force = false } | ||
| LIBCLANG_PATH = { value = "devroot/lib", relative = true, force = false } | ||
|
|
||
| [build] | ||
| target = "x86_64-unknown-linux-gnu" | ||
| rustc = "compile-env/bin/rustc" | ||
| rustflags = ["--cfg", "tokio_unstable"] | ||
|
|
||
| [target.x86_64-unknown-linux-gnu] | ||
| runner = ["scripts/test-runner.sh"] | ||
| rustflags = ["--cfg=tokio_unstable"] |
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,8 @@ | ||
| [env] | ||
| CC = { value = "aarch64-unknown-linux-gnu-clang", relative = false, force = true } | ||
|
|
||
| [build] | ||
| target = "aarch64-unknown-linux-gnu" | ||
|
|
||
| [target.aarch64-unknown-linux-gnu] | ||
| rustflags = ["--cfg=tokio_unstable", "-Clinker=aarch64-unknown-linux-gnu-clang", "-Clink-arg=-fuse-ld=lld"] |
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,8 @@ | ||
| [env] | ||
| CC = { value = "aarch64-unknown-linux-musl-clang", relative = false, force = true } | ||
|
|
||
| [build] | ||
| target = "aarch64-unknown-linux-musl" | ||
|
|
||
| [target.aarch64-unknown-linux-musl] | ||
| rustflags = ["--cfg=tokio_unstable", "-Clinker=aarch64-unknown-linux-musl-clang", "-Clink-arg=-fuse-ld=lld"] |
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,8 @@ | ||
| [env] | ||
| CC = { value = "x86_64-unknown-linux-gnu-clang", relative = false, force = true } | ||
|
|
||
| [build] | ||
| target = "x86_64-unknown-linux-gnu" | ||
|
|
||
| [target.x86_64-unknown-linux-gnu] | ||
| rustflags = ["--cfg=tokio_unstable", "-Clinker=x86_64-unknown-linux-gnu-clang", "-Clink-arg=-fuse-ld=lld"] |
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,8 @@ | ||
| [env] | ||
| CC = { value = "x86_64-unknown-linux-musl-clang", relative = false, force = true } | ||
|
|
||
| [build] | ||
| target = "x86_64-unknown-linux-musl" | ||
|
|
||
| [target.x86_64-unknown-linux-musl] | ||
| rustflags = ["--cfg=tokio_unstable", "-Clinker=x86_64-unknown-linux-musl-clang", "-Clink-arg=-fuse-ld=lld"] |
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 @@ | ||
| devroot/.clangd |
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,5 @@ | ||
| max-jobs = 4 | ||
| experimental-features = nix-command | ||
| substituters = https://dnoland-test-cache.cachix.org/ https://cache.nixos.org https://cache.nixos.org/ | ||
| trusted-public-keys = dnoland-test-cache.cachix.org-1:AsVLS3c7NGIJbUHW5xOlK69zPEzY5jNF+ax0jd1LKUA= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | ||
| always-allow-substitutes = true | ||
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 |
|---|---|---|
| @@ -1,46 +1,2 @@ | ||
| export PROJECT_DIR="$(pwd)" | ||
|
|
||
| if [ -h "${PROJECT_DIR}/compile-env" ] || [ -d "${PROJECT_DIR}/compile-env" ]; then | ||
| export PATH="${PROJECT_DIR}/compile-env/bin:$PATH" | ||
| export LIBCLANG_PATH="${PROJECT_DIR}/compile-env/bin" | ||
| export COMPILE_ENV="${PROJECT_DIR}/compile-env" | ||
| else | ||
| >&2 echo "no compile environment found" | ||
| exit 0 | ||
| fi | ||
|
|
||
| export NEXTEST_EXPERIMENTAL_LIBTEST_JSON=1 | ||
|
|
||
| CRT="-C target-feature=-crt-static" | ||
| DEBUG="-C debuginfo=full -C split-debuginfo=off -C dwarf-version=5" | ||
| LINKER="-C linker=${COMPILE_ENV}/bin/clang -C link-arg=--ld-path=${COMPILE_ENV}/bin/ld.lld" | ||
| RELRO="-C relro-level=full" | ||
| TARGET_CPU="-C target-cpu=x86-64-v3" | ||
|
|
||
| RUSTFLAGS="${CRT} ${DEBUG} ${LINKER} ${RELRO} ${TARGET_CPU}" | ||
|
|
||
| OPTIMIZE="-C opt-level=3 -C linker-plugin-lto -C lto=thin -C embed-bitcode=yes -C codegen-units=1" | ||
|
|
||
| case ${PROFILE:-DEBUG} in | ||
| fuzz|FUZZ) | ||
| COVERAGE="-C instrument-coverage" | ||
| DEBUG_ASSERTIONS="-C debug-assertions=on" | ||
| OVERFLOW_CHECK="-C overflow-checks=on" | ||
| RUSTFLAGS="${RUSTFLAGS} ${COVERAGE} ${DEBUG_ASSERTIONS} ${OVERFLOW_CHECK}" | ||
| ;; | ||
| release|RELEASE) | ||
| RUSTFLAGS="${RUSTFLAGS} ${OPTIMIZE}" | ||
| ;; | ||
| debug|DEBUG) | ||
| DEBUG_ASSERTIONS="-C debug-assertions=on" | ||
| OPTIMIZE="-C opt-level=0" | ||
| OVERFLOW_CHECK="-C overflow-checks=on" | ||
| RUSTFLAGS="${RUSTFLAGS} ${OPTIMIZE} ${DEBUG_ASSERTIONS} ${OVERFLOW_CHECK}" | ||
| ;; | ||
| *) | ||
| >&2 echo "unknown profile" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| export RUSTFLAGS | ||
| export RUSTC_BOOTSTRAP=1 | ||
| export PATH=$(pwd)/devroot/bin:$PATH |
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,172 @@ | ||
| name: "scratch.yml" | ||
|
|
||
| on: | ||
| pull_request: {} | ||
| push: | ||
| branches: | ||
| - "main" | ||
| tags: | ||
| - "v*" | ||
| merge_group: | ||
| types: ["checks_requested"] | ||
| workflow_dispatch: | ||
| inputs: | ||
| debug_enabled: | ||
| type: "boolean" | ||
| description: "Run with tmate enabled" | ||
| required: false | ||
| default: false | ||
| debug_justfile: | ||
| type: "boolean" | ||
| description: "enable to see debug statements from just recipes" | ||
| required: false | ||
| default: false | ||
| skip_vlab_tests: | ||
| type: "boolean" | ||
| description: "Skip VLAB tests (they run by default)" | ||
| required: false | ||
| default: false | ||
| run_hlab_tests: | ||
| type: "boolean" | ||
| description: "Run hybrid HLAB tests" | ||
| required: false | ||
| default: false | ||
| enable_release_tests: | ||
| type: "boolean" | ||
| description: "Enable release tests for VLAB/HLAB tests" | ||
| required: false | ||
| default: false | ||
|
|
||
| concurrency: | ||
| group: "${{ github.workflow }}:${{ github.event.pull_request.number || github.event.after || github.event.merge_group && github.run_id }}" | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: "read" | ||
| packages: "write" | ||
| id-token: "write" | ||
|
|
||
| jobs: | ||
| check: | ||
| env: | ||
| CACHE_REGISTRY: "run.h.hhdev.io:30000" | ||
| UPSTREAM_REGISTRY: "ghcr.io" | ||
| USER: "runner" | ||
| permissions: | ||
| checks: "write" | ||
| pull-requests: "write" | ||
| contents: "read" | ||
| packages: "write" | ||
| id-token: "write" | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| profile: | ||
| - name: "debug" | ||
| cargo_name: "dev" | ||
| - name: "release" | ||
| cargo_name: "release" | ||
| debug_justfile: | ||
| - "${{ inputs.debug_justfile || false }}" | ||
| name: "${{matrix.profile.name}}" | ||
| runs-on: "lab" | ||
| timeout-minutes: 120 | ||
| steps: | ||
| - name: "install nix" | ||
| uses: "cachix/install-nix-action@v31" | ||
| with: | ||
| nix_path: nixpkgs=channel:nixpkgs-unstable | ||
|
|
||
| - name: "login to ghcr.io" | ||
| uses: "docker/login-action@v3" | ||
| with: | ||
| registry: "${{ env.UPSTREAM_REGISTRY }}" | ||
| username: "${{ github.actor }}" | ||
| password: "${{ secrets.GITHUB_TOKEN }}" | ||
|
|
||
| - name: "login to image cache" | ||
| uses: "docker/login-action@v3" | ||
| with: | ||
| registry: "${{ env.CACHE_REGISTRY }}" | ||
| username: "${{ secrets.LAB_REGISTRY_USERNAME }}" | ||
| password: "${{ secrets.LAB_REGISTRY_TOKEN }}" | ||
|
|
||
| - name: "Checkout" | ||
| uses: "actions/checkout@v6" | ||
| with: | ||
| persist-credentials: "false" | ||
| fetch-depth: "0" | ||
|
|
||
| - name: "log into cachix" | ||
| uses: cachix/cachix-action@v14 | ||
| with: | ||
| name: "${{ vars.CACHIX_CACHE_NAME }}" | ||
| authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | ||
| signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" | ||
| useDaemon: true | ||
|
|
||
| - name: "sysroot" | ||
| run: | | ||
| nix build \ | ||
| --log-format raw \ | ||
| --argstr profile ${{matrix.profile.name}} \ | ||
| --show-trace \ | ||
| --max-jobs 3 \ | ||
| --file default.nix \ | ||
| sysroot \ | ||
| --out-link sysroot | ||
|
|
||
| - name: "devroot" | ||
| run: | | ||
| nix build \ | ||
| --log-format raw \ | ||
| --argstr profile ${{matrix.profile.name}} \ | ||
| --show-trace \ | ||
| --max-jobs 3 \ | ||
| --file default.nix \ | ||
| devroot \ | ||
| --out-link devroot | ||
|
|
||
| - name: "bins" | ||
| run: | | ||
| for pkg in dataplane cli init; do | ||
| nix build --file default.nix \ | ||
| --log-format raw \ | ||
| --argstr profile ${{matrix.profile.name}} \ | ||
| --show-trace \ | ||
| --max-jobs 3 \ | ||
| packages.dataplane \ | ||
| --out-link "packages.${pkg}" | ||
| done | ||
|
|
||
| - name: "cargo nextest" | ||
| run: | | ||
| export PATH="$(pwd)/devroot/bin:$PATH" | ||
| nix shell --file default.nix devroot --command \ | ||
| cargo nextest archive --cargo-profile ${{matrix.profile.cargo_name}} --archive-file tests.tar.zst | ||
| # nix shell --file default.nix devroot --command \ | ||
| # cargo nextest run --archive-file tests.tar.zst | ||
|
|
||
| - name: "run doctests" | ||
| run: | | ||
| nix shell --file default.nix devroot --command \ | ||
| cargo test --profile=${{matrix.profile.cargo_name}} --doc | ||
|
|
||
| - id: "clippy" | ||
| name: "run clippy" | ||
| run: | | ||
| nix shell --file default.nix shell --command \ | ||
| cargo clippy --profile ${{matrix.profile.cargo_name}} --all-targets --all-features -- -D warnings | ||
|
|
||
| - id: "docs" | ||
| name: "run rustdoc" | ||
| run: | | ||
| nix shell --file default.nix devroot --command \ | ||
| sh -c 'RUSTDOCFLAGS="-D warnings" cargo doc --profile=${{matrix.profile_name}} --no-deps' | ||
|
|
||
| - name: "Setup tmate session for debug" | ||
| # if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | ||
| uses: "mxschmitt/action-tmate@v3" | ||
| timeout-minutes: 120 | ||
| with: | ||
| limit-access-to-actor: true |
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.
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 will be changed right?