Replace npm build script with new cargo run tool (#3832)

* move nix flake to root

* cargo run tool

* use thiserror in third-party-licenses tool

* prefere panic over exit

* Add automatic dependency check to cargo run tool

* Skip dependecies that are not needed for the current task

* Fixup

* Fixup

* fix windows

* Fixup

* improve usage text

* Fix linux bundle

* add graphen-cli

* fix build profile

* fix

* release profile should not include debug infos

* Review

* remove profiling profile

was redundent with release

* rename to cargo-run tool

* improve consistency

* rename deps to requirements

* fix

* return success when showing usage
This commit is contained in:
Timon
2026-03-07 14:26:19 +01:00
committed by GitHub
parent 50ef6e15cb
commit 5d22292072
39 changed files with 664 additions and 404 deletions

View File

@@ -25,7 +25,7 @@ jobs:
run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache
- name: Build Nix Package
run: nix build .nix --no-link --print-out-paths
run: nix build --no-link --print-out-paths
- name: Push to Nix Cache
if: github.ref == 'refs/heads/master' || inputs.push_to_cache == true
@@ -33,10 +33,10 @@ jobs:
NIX_CACHE_AUTH_TOKEN: ${{ secrets.NIX_CACHE_AUTH_TOKEN }}
run: |
nix run nixpkgs#cachix -- authtoken $NIX_CACHE_AUTH_TOKEN
nix build .nix --no-link --print-out-paths | nix run nixpkgs#cachix -- push graphite
nix build --no-link --print-out-paths | nix run nixpkgs#cachix -- push graphite
- name: Build Linux Bundle
run: nix build .nix#graphite-bundle.tar.xz && cp ./result ./graphite-linux-bundle.tar.xz
run: nix build .#graphite-bundle.tar.xz && cp ./result ./graphite-linux-bundle.tar.xz
- name: Upload Linux Bundle
uses: actions/upload-artifact@v4
@@ -53,7 +53,7 @@ jobs:
- name: Build Flatpak
run: |
nix build .nix#graphite-flatpak-manifest
nix build .#graphite-flatpak-manifest
rm -rf .flatpak
mkdir -p .flatpak

View File

@@ -67,7 +67,7 @@ jobs:
- name: Build Mac Bundle
env:
CARGO_TERM_COLOR: always
run: npm run build-desktop
run: cargo run build desktop
- name: Stage Artifacts
shell: bash

View File

@@ -14,4 +14,4 @@ jobs:
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build Nix Package Dev
run: nix build .nix#graphite-dev --print-build-logs
run: nix build .#graphite-dev --print-build-logs

View File

@@ -52,9 +52,7 @@ jobs:
- name: 🌐 Build Graphite web code
env:
NODE_ENV: production
run: |
cd frontend
mold -run npm run build
run: mold -run cargo run build web
- name: 📤 Publish to Cloudflare Pages
id: cloudflare

View File

@@ -73,7 +73,7 @@ jobs:
shell: bash # `cargo-about` refuses to run in powershell
env:
CARGO_TERM_COLOR: always
run: npm run build-desktop
run: cargo run build desktop
- name: Stage Artifacts
shell: bash

View File

@@ -76,7 +76,7 @@ jobs:
if: steps.skip-check.outputs.skip-check != 'true'
uses: actions/setup-node@v4
with:
node-version: 'latest'
node-version: "latest"
- name: 🚧 Install build dependencies
if: steps.skip-check.outputs.skip-check != 'true'
@@ -98,9 +98,7 @@ jobs:
if: steps.skip-check.outputs.skip-check != 'true'
env:
NODE_ENV: production
run: |
cd frontend
mold -run npm run build
run: mold -run cargo run build web
- name: 📤 Publish to Cloudflare Pages
if: steps.skip-check.outputs.skip-check != 'true'

View File

@@ -1,7 +1,6 @@
# USAGE:
# After reviewing the code, core team members may comment on a PR with the exact text:
# - `!build-dev` to build with debug symbols and optimizations disabled
# - `!build-profiling` to build with debug symbols and optimizations enabled
# - `!build-debug` to build with debug symbols and optimizations disabled
# - `!build` to build without debug symbols and optimizations enabled
# The comment may not contain any other text, not even whitespace or newlines.
name: "!build PR Command"
@@ -21,7 +20,7 @@ jobs:
if: >
github.event.issue.pull_request &&
github.event.comment.author_association == 'MEMBER' &&
(github.event.comment.body == '!build-dev' || github.event.comment.body == '!build-profiling' || github.event.comment.body == '!build')
(github.event.comment.body == '!build-debug' || github.event.comment.body == '!build')
runs-on: self-hosted
permissions:
contents: read
@@ -82,14 +81,12 @@ jobs:
- name: ⌨ Set build command based on comment
id: build_command
run: |
if [[ "${{ github.event.comment.body }}" == "!build-dev" ]]; then
echo "command=build-dev" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.comment.body }}" == "!build-profiling" ]]; then
echo "command=build-profiling" >> $GITHUB_OUTPUT
if [[ "${{ github.event.comment.body }}" == "!build-debug" ]]; then
echo "command=build web debug" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.comment.body }}" == "!build" ]]; then
echo "command=build" >> $GITHUB_OUTPUT
echo "command=build web" >> $GITHUB_OUTPUT
else
echo "Failed to detect if the build command written in the comment should have been '!build-dev', '!build-profiling', or '!build'" >> $GITHUB_OUTPUT
echo "Failed to detect if the build command written in the comment should have been '!build-debug', or '!build'" >> $GITHUB_OUTPUT
fi
- name: 💬 Comment Actions run link
@@ -108,9 +105,7 @@ jobs:
env:
NODE_ENV: production
if: ${{ success() || failure()}}
run: |
cd frontend
mold -run npm run ${{ steps.build_command.outputs.command }}
run: mold -run cargo run ${{ steps.build_command.outputs.command }}
- name: ❗ Warn on build failure
if: ${{ failure() }}

View File

@@ -31,7 +31,7 @@ jobs:
- name: 🟢 Install the latest Node.js
uses: actions/setup-node@v4
with:
node-version: 'latest'
node-version: "latest"
- name: 🚧 Install build dependencies
run: |
@@ -49,9 +49,7 @@ jobs:
- name: 🌐 Build Graphite web code
env:
NODE_ENV: production
run: |
cd frontend
mold -run npm run build
run: mold -run cargo run build web
- name: 📤 Publish to Cloudflare Pages
id: cloudflare

View File

@@ -17,7 +17,7 @@ jobs:
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build graphene raster nodes shaders
run: nix build .nix#graphite-raster-nodes-shaders && cp result raster_nodes_shaders_entrypoint.wgsl
run: nix build .#graphite-raster-nodes-shaders && cp result raster_nodes_shaders_entrypoint.wgsl
- name: Upload graphene raster nodes shaders to artifacts repository
run: |