Skip to content

Commit 5d22292

Browse files
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
1 parent 50ef6e1 commit 5d22292

39 files changed

Lines changed: 664 additions & 404 deletions

.envrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
use flake .nix
1+
use flake

.github/workflows/build-linux-bundle.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ jobs:
2525
run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache
2626

2727
- name: Build Nix Package
28-
run: nix build .nix --no-link --print-out-paths
28+
run: nix build --no-link --print-out-paths
2929

3030
- name: Push to Nix Cache
3131
if: github.ref == 'refs/heads/master' || inputs.push_to_cache == true
3232
env:
3333
NIX_CACHE_AUTH_TOKEN: ${{ secrets.NIX_CACHE_AUTH_TOKEN }}
3434
run: |
3535
nix run nixpkgs#cachix -- authtoken $NIX_CACHE_AUTH_TOKEN
36-
nix build .nix --no-link --print-out-paths | nix run nixpkgs#cachix -- push graphite
36+
nix build --no-link --print-out-paths | nix run nixpkgs#cachix -- push graphite
3737
3838
- name: Build Linux Bundle
39-
run: nix build .nix#graphite-bundle.tar.xz && cp ./result ./graphite-linux-bundle.tar.xz
39+
run: nix build .#graphite-bundle.tar.xz && cp ./result ./graphite-linux-bundle.tar.xz
4040

4141
- name: Upload Linux Bundle
4242
uses: actions/upload-artifact@v4
@@ -53,7 +53,7 @@ jobs:
5353
5454
- name: Build Flatpak
5555
run: |
56-
nix build .nix#graphite-flatpak-manifest
56+
nix build .#graphite-flatpak-manifest
5757
5858
rm -rf .flatpak
5959
mkdir -p .flatpak

.github/workflows/build-mac-bundle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
- name: Build Mac Bundle
6868
env:
6969
CARGO_TERM_COLOR: always
70-
run: npm run build-desktop
70+
run: cargo run build desktop
7171

7272
- name: Stage Artifacts
7373
shell: bash

.github/workflows/build-nix-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ jobs:
1414
- uses: DeterminateSystems/magic-nix-cache-action@main
1515

1616
- name: Build Nix Package Dev
17-
run: nix build .nix#graphite-dev --print-build-logs
17+
run: nix build .#graphite-dev --print-build-logs

.github/workflows/build-production.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ jobs:
5252
- name: 🌐 Build Graphite web code
5353
env:
5454
NODE_ENV: production
55-
run: |
56-
cd frontend
57-
mold -run npm run build
55+
run: mold -run cargo run build web
5856

5957
- name: 📤 Publish to Cloudflare Pages
6058
id: cloudflare

.github/workflows/build-win-bundle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
shell: bash # `cargo-about` refuses to run in powershell
7474
env:
7575
CARGO_TERM_COLOR: always
76-
run: npm run build-desktop
76+
run: cargo run build desktop
7777

7878
- name: Stage Artifacts
7979
shell: bash

.github/workflows/ci.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
if: steps.skip-check.outputs.skip-check != 'true'
7777
uses: actions/setup-node@v4
7878
with:
79-
node-version: 'latest'
79+
node-version: "latest"
8080

8181
- name: 🚧 Install build dependencies
8282
if: steps.skip-check.outputs.skip-check != 'true'
@@ -98,9 +98,7 @@ jobs:
9898
if: steps.skip-check.outputs.skip-check != 'true'
9999
env:
100100
NODE_ENV: production
101-
run: |
102-
cd frontend
103-
mold -run npm run build
101+
run: mold -run cargo run build web
104102

105103
- name: 📤 Publish to Cloudflare Pages
106104
if: steps.skip-check.outputs.skip-check != 'true'

.github/workflows/comment-!build-commands.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# USAGE:
22
# After reviewing the code, core team members may comment on a PR with the exact text:
3-
# - `!build-dev` to build with debug symbols and optimizations disabled
4-
# - `!build-profiling` to build with debug symbols and optimizations enabled
3+
# - `!build-debug` to build with debug symbols and optimizations disabled
54
# - `!build` to build without debug symbols and optimizations enabled
65
# The comment may not contain any other text, not even whitespace or newlines.
76
name: "!build PR Command"
@@ -21,7 +20,7 @@ jobs:
2120
if: >
2221
github.event.issue.pull_request &&
2322
github.event.comment.author_association == 'MEMBER' &&
24-
(github.event.comment.body == '!build-dev' || github.event.comment.body == '!build-profiling' || github.event.comment.body == '!build')
23+
(github.event.comment.body == '!build-debug' || github.event.comment.body == '!build')
2524
runs-on: self-hosted
2625
permissions:
2726
contents: read
@@ -82,14 +81,12 @@ jobs:
8281
- name: ⌨ Set build command based on comment
8382
id: build_command
8483
run: |
85-
if [[ "${{ github.event.comment.body }}" == "!build-dev" ]]; then
86-
echo "command=build-dev" >> $GITHUB_OUTPUT
87-
elif [[ "${{ github.event.comment.body }}" == "!build-profiling" ]]; then
88-
echo "command=build-profiling" >> $GITHUB_OUTPUT
84+
if [[ "${{ github.event.comment.body }}" == "!build-debug" ]]; then
85+
echo "command=build web debug" >> $GITHUB_OUTPUT
8986
elif [[ "${{ github.event.comment.body }}" == "!build" ]]; then
90-
echo "command=build" >> $GITHUB_OUTPUT
87+
echo "command=build web" >> $GITHUB_OUTPUT
9188
else
92-
echo "Failed to detect if the build command written in the comment should have been '!build-dev', '!build-profiling', or '!build'" >> $GITHUB_OUTPUT
89+
echo "Failed to detect if the build command written in the comment should have been '!build-debug', or '!build'" >> $GITHUB_OUTPUT
9390
fi
9491
9592
- name: 💬 Comment Actions run link
@@ -108,9 +105,7 @@ jobs:
108105
env:
109106
NODE_ENV: production
110107
if: ${{ success() || failure()}}
111-
run: |
112-
cd frontend
113-
mold -run npm run ${{ steps.build_command.outputs.command }}
108+
run: mold -run cargo run ${{ steps.build_command.outputs.command }}
114109

115110
- name: ❗ Warn on build failure
116111
if: ${{ failure() }}

.github/workflows/deploy-master.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: 🟢 Install the latest Node.js
3232
uses: actions/setup-node@v4
3333
with:
34-
node-version: 'latest'
34+
node-version: "latest"
3535

3636
- name: 🚧 Install build dependencies
3737
run: |
@@ -49,9 +49,7 @@ jobs:
4949
- name: 🌐 Build Graphite web code
5050
env:
5151
NODE_ENV: production
52-
run: |
53-
cd frontend
54-
mold -run npm run build
52+
run: mold -run cargo run build web
5553

5654
- name: 📤 Publish to Cloudflare Pages
5755
id: cloudflare

.github/workflows/provide-shaders.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- uses: DeterminateSystems/magic-nix-cache-action@main
1818

1919
- name: Build graphene raster nodes shaders
20-
run: nix build .nix#graphite-raster-nodes-shaders && cp result raster_nodes_shaders_entrypoint.wgsl
20+
run: nix build .#graphite-raster-nodes-shaders && cp result raster_nodes_shaders_entrypoint.wgsl
2121

2222
- name: Upload graphene raster nodes shaders to artifacts repository
2323
run: |

0 commit comments

Comments
 (0)