From d71edf00e24b3bae6e9c5c55bb89ad319e58d138 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Fri, 13 Feb 2026 12:48:33 +0100 Subject: [PATCH 01/15] Split ci job into multiple jobs running on github runners --- .github/actions/nix-setup/action.yml | 11 ++ .github/workflows/build-dev-and-ci.yml | 187 ------------------------- .github/workflows/ci.yml | 91 ++++++++++++ .github/workflows/deploy-master.yml | 102 ++++++++++++++ 4 files changed, 204 insertions(+), 187 deletions(-) create mode 100644 .github/actions/nix-setup/action.yml delete mode 100644 .github/workflows/build-dev-and-ci.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/deploy-master.yml diff --git a/.github/actions/nix-setup/action.yml b/.github/actions/nix-setup/action.yml new file mode 100644 index 0000000000..50d3830207 --- /dev/null +++ b/.github/actions/nix-setup/action.yml @@ -0,0 +1,11 @@ +name: 'Nix Setup' +description: 'Sets up Nix with the magic cache for CI' + +runs: + using: "composite" + steps: + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + + - name: Setup Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main diff --git a/.github/workflows/build-dev-and-ci.yml b/.github/workflows/build-dev-and-ci.yml deleted file mode 100644 index c903568c0b..0000000000 --- a/.github/workflows/build-dev-and-ci.yml +++ /dev/null @@ -1,187 +0,0 @@ -name: "Editor: Dev & CI" - -on: - push: - branches: - - master - pull_request: {} - merge_group: {} -env: - CARGO_TERM_COLOR: always - INDEX_HTML_HEAD_REPLACEMENT: - -jobs: - build: - runs-on: self-hosted - permissions: - contents: write - deployments: write - pull-requests: write - actions: write - env: - RUSTC_WRAPPER: /usr/bin/sccache - CARGO_INCREMENTAL: 0 - SCCACHE_DIR: /var/lib/github-actions/.cache - - steps: - - name: ๐Ÿ“ฅ Clone and checkout repository - uses: actions/checkout@v3 - - - name: ๐Ÿ—‘ Clear wasm-bindgen cache - run: rm -r ~/.cache/.wasm-pack || true - - - name: ๐ŸŸข Install the latest Node.js - uses: actions/setup-node@v4 - with: - node-version: "latest" - - - name: ๐Ÿšง Install build dependencies - run: | - cd frontend - npm run setup - - - name: ๐Ÿฆ€ Install the latest Rust - run: | - echo "Initial system version:" - rustc --version - rustup update stable - echo "Latest updated version:" - rustc --version - - - name: ๐Ÿฆ€ Fetch Rust dependencies - run: | - echo "If it fails here, the committed Cargo.lock may be out of date" - cargo fetch --locked - - - name: โœ‚ Replace template in of index.html - run: | - # Remove the INDEX_HTML_HEAD_REPLACEMENT environment variable for build links (not master deploys) - git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_REPLACEMENT="" - sed -i "s||$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html - - - name: ๐ŸŒ Build Graphite web code - env: - NODE_ENV: production - run: | - cd frontend - mold -run npm run build - - - name: ๐Ÿ“ค Publish to Cloudflare Pages - id: cloudflare - uses: cloudflare/pages-action@1 - continue-on-error: true - with: - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - gitHubToken: ${{ secrets.GITHUB_TOKEN }} - projectName: graphite-dev - directory: frontend/dist - - - name: ๐Ÿ’ฌ Comment build link URL to commit hash page on GitHub - if: github.ref == 'refs/heads/master' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh api \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - /repos/${{ github.repository }}/commits/$(git rev-parse HEAD)/comments \ - -f body="| ๐Ÿ“ฆ **Build Complete for** $(git rev-parse HEAD) | - |-| - | ${{ steps.cloudflare.outputs.url }} |" - - - name: ๐Ÿ‘• Lint Graphite web formatting - env: - NODE_ENV: production - run: | - cd frontend - npm run lint - - - name: ๐Ÿ”ฌ Check Rust formatting - run: | - mold -run cargo fmt --all -- --check - - - name: ๐Ÿฆ€ Build Rust code - env: - RUSTFLAGS: -Dwarnings - run: | - mold -run cargo build --all-features - - - name: ๐Ÿงช Run Rust tests - run: | - mold -run cargo test --all-features - - - name: ๐Ÿ“ƒ Generate code documentation info for website - if: github.ref == 'refs/heads/master' - run: | - cd tools/editor-message-tree - cargo run - cd ../.. - mkdir -p artifacts-generated - mv website/generated/hierarchical_message_system_tree.txt artifacts-generated/hierarchical_message_system_tree.txt - - - name: ๐Ÿ’ฟ Obtain cache of auto-generated code docs artifacts, to check if they've changed - if: github.ref == 'refs/heads/master' - id: cache-website-code-docs - uses: actions/cache/restore@v3 - with: - path: artifacts - key: website-code-docs - - - name: ๐Ÿ” Check if auto-generated code docs artifacts changed - if: github.ref == 'refs/heads/master' - id: website-code-docs-changed - run: | - if ! diff --brief --recursive artifacts-generated artifacts; then - echo "Auto-generated code docs artifacts have changed." - rm -rf artifacts - mv artifacts-generated artifacts - echo "changed=true" >> $GITHUB_OUTPUT - else - echo "Auto-generated code docs artifacts have not changed." - rm -rf artifacts - rm -rf artifacts-generated - fi - - - name: ๐Ÿ’พ Save cache of auto-generated code docs artifacts - if: steps.website-code-docs-changed.outputs.changed == 'true' - uses: actions/cache/save@v3 - with: - path: artifacts - key: ${{ steps.cache-website-code-docs.outputs.cache-primary-key }} - - - name: โ™ป๏ธ Trigger website rebuild if the auto-generated code docs artifacts have changed - if: steps.website-code-docs-changed.outputs.changed == 'true' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - rm -rf artifacts - gh workflow run website.yml --ref master - - # miri: - # runs-on: self-hosted - - # steps: - # - uses: actions/checkout@v3 - - # - name: ๐Ÿงช Run Rust miri - # run: | - # mold -run cargo +nightly miri nextest run -j32 --all-features - - cargo-deny: - runs-on: ubuntu-latest - - steps: - - name: ๐Ÿ“ฅ Clone and checkout repository - uses: actions/checkout@v3 - - - name: ๐Ÿ“œ Check crate license compatibility for root workspace - uses: EmbarkStudios/cargo-deny-action@v2 - with: - command: check bans licenses sources - - - name: ๐Ÿ“œ Check crate license compatibility for /libraries/rawkit - uses: EmbarkStudios/cargo-deny-action@v2 - with: - command: check bans licenses sources - manifest-path: libraries/rawkit/Cargo.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..d3fd63b4b2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,91 @@ +name: "CI" + +on: + pull_request: {} + merge_group: {} + +env: + CARGO_TERM_COLOR: always + +jobs: + # Check if CI can be skipped (for merge queue optimization) + skip-check: + runs-on: ubuntu-latest + outputs: + skip: ${{ steps.skip-check.outputs.skip-check }} + steps: + - uses: actions/checkout@v4 + - name: Check if CI can be skipped + id: skip-check + uses: cariad-tech/merge-queue-ci-skipper@main + + web-lint: + needs: skip-check + if: needs.skip-check.outputs.skip != 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/nix-setup + - name: Lint Graphite web formatting + run: nix develop .nix --command bash -c "cd frontend && npm ci && npm run lint" + + rust-fmt: + needs: skip-check + if: needs.skip-check.outputs.skip != 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/nix-setup + - name: Check Rust formatting + run: nix develop .nix --command cargo fmt --all -- --check + + rust-build-test: + needs: skip-check + if: needs.skip-check.outputs.skip != 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/nix-setup + - name: Build Rust code + run: nix develop .nix --command cargo build --all-features + - name: Run Rust tests + run: nix develop .nix --command cargo test --all-features + + web-build: + needs: skip-check + if: needs.skip-check.outputs.skip != 'true' + runs-on: ubuntu-latest + permissions: + deployments: write + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/nix-setup + - name: Build Graphite web code + env: + NODE_ENV: production + run: nix develop .nix --command bash -c "cd frontend && npm ci && npm run build" + - name: Publish to Cloudflare Pages + uses: cloudflare/pages-action@1 + continue-on-error: true + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + gitHubToken: ${{ secrets.GITHUB_TOKEN }} + projectName: graphite-dev + directory: frontend/dist + + cargo-deny: + needs: skip-check + if: needs.skip-check.outputs.skip != 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check crate license compatibility for root workspace + uses: EmbarkStudios/cargo-deny-action@v2 + with: + command: check bans licenses sources + - name: Check crate license compatibility for /libraries/rawkit + uses: EmbarkStudios/cargo-deny-action@v2 + with: + command: check bans licenses sources + manifest-path: libraries/rawkit/Cargo.toml diff --git a/.github/workflows/deploy-master.yml b/.github/workflows/deploy-master.yml new file mode 100644 index 0000000000..4194fa33e5 --- /dev/null +++ b/.github/workflows/deploy-master.yml @@ -0,0 +1,102 @@ +name: "Deploy Master" + +on: + push: + branches: + - master + +env: + CARGO_TERM_COLOR: always + INDEX_HTML_HEAD_REPLACEMENT: + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + contents: write + deployments: write + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/nix-setup + + - name: Replace template in of index.html + run: | + sed -i "s||$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html + + - name: Build Graphite web code + env: + NODE_ENV: production + run: nix develop .nix --command bash -c "cd frontend && npm ci && npm run build" + + - name: Publish to Cloudflare Pages + id: cloudflare + uses: cloudflare/pages-action@1 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + gitHubToken: ${{ secrets.GITHUB_TOKEN }} + projectName: graphite-dev + directory: frontend/dist + + - name: Comment build link URL to commit hash page on GitHub + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh api \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + /repos/${{ github.repository }}/commits/$(git rev-parse HEAD)/comments \ + -f body="| **Build Complete for** $(git rev-parse HEAD) | + |-| + | ${{ steps.cloudflare.outputs.url }} |" + + generate-docs: + runs-on: ubuntu-latest + permissions: + contents: write + actions: write + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/nix-setup + + - name: Generate code documentation info for website + run: | + nix develop .nix --command bash -c "cd tools/editor-message-tree && cargo run" + mkdir -p artifacts-generated + mv website/generated/hierarchical_message_system_tree.txt artifacts-generated/hierarchical_message_system_tree.txt + + - name: Obtain cache of auto-generated code docs artifacts + id: cache-website-code-docs + uses: actions/cache/restore@v3 + with: + path: artifacts + key: website-code-docs + + - name: Check if auto-generated code docs artifacts changed + id: website-code-docs-changed + run: | + if ! diff --brief --recursive artifacts-generated artifacts; then + echo "Auto-generated code docs artifacts have changed." + rm -rf artifacts + mv artifacts-generated artifacts + echo "changed=true" >> $GITHUB_OUTPUT + else + echo "Auto-generated code docs artifacts have not changed." + rm -rf artifacts + rm -rf artifacts-generated + fi + + - name: Save cache of auto-generated code docs artifacts + if: steps.website-code-docs-changed.outputs.changed == 'true' + uses: actions/cache/save@v3 + with: + path: artifacts + key: ${{ steps.cache-website-code-docs.outputs.cache-primary-key }} + + - name: Trigger website rebuild if the auto-generated code docs artifacts have changed + if: steps.website-code-docs-changed.outputs.changed == 'true' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + rm -rf artifacts + gh workflow run website.yml --ref master From acf18303242af567287c5f92a77c3a6a271fc5e7 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Fri, 13 Feb 2026 17:04:57 +0100 Subject: [PATCH 02/15] Add permission to build steps --- .github/workflows/ci.yml | 11 +++++++++++ .github/workflows/deploy-master.yml | 2 ++ 2 files changed, 13 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3fd63b4b2..a1d46708e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,9 @@ jobs: needs: skip-check if: needs.skip-check.outputs.skip != 'true' runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@v4 - uses: ./.github/actions/nix-setup @@ -33,6 +36,9 @@ jobs: needs: skip-check if: needs.skip-check.outputs.skip != 'true' runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@v4 - uses: ./.github/actions/nix-setup @@ -43,6 +49,9 @@ jobs: needs: skip-check if: needs.skip-check.outputs.skip != 'true' runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@v4 - uses: ./.github/actions/nix-setup @@ -56,6 +65,8 @@ jobs: if: needs.skip-check.outputs.skip != 'true' runs-on: ubuntu-latest permissions: + contents: read + id-token: write deployments: write steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/deploy-master.yml b/.github/workflows/deploy-master.yml index 4194fa33e5..05f8b0e1bc 100644 --- a/.github/workflows/deploy-master.yml +++ b/.github/workflows/deploy-master.yml @@ -15,6 +15,7 @@ jobs: permissions: contents: write deployments: write + id-token: write steps: - uses: actions/checkout@v4 - uses: ./.github/actions/nix-setup @@ -55,6 +56,7 @@ jobs: permissions: contents: write actions: write + id-token: write steps: - uses: actions/checkout@v4 - uses: ./.github/actions/nix-setup From 2dc0cbf5cd1785f6dd4965d8c1f1cbeeb5819d94 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Fri, 13 Feb 2026 17:48:11 +0100 Subject: [PATCH 03/15] Try running rust build on selfhosted runner --- .github/actions/nix-setup/action.yml | 2 ++ .github/workflows/ci.yml | 6 ++++-- frontend/eslint.config.js | 7 +++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/actions/nix-setup/action.yml b/.github/actions/nix-setup/action.yml index 50d3830207..c4dcb344e3 100644 --- a/.github/actions/nix-setup/action.yml +++ b/.github/actions/nix-setup/action.yml @@ -6,6 +6,8 @@ runs: steps: - name: Install Nix uses: DeterminateSystems/nix-installer-action@main + with: + determinate: false - name: Setup Nix cache uses: DeterminateSystems/magic-nix-cache-action@main diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1d46708e8..24ec99c662 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: rust-build-test: needs: skip-check if: needs.skip-check.outputs.skip != 'true' - runs-on: ubuntu-latest + runs-on: self-hosted permissions: contents: read id-token: write @@ -71,10 +71,12 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ./.github/actions/nix-setup + - name: Clean npm cache + run: rm -rf frontend/node_modules - name: Build Graphite web code env: NODE_ENV: production - run: nix develop .nix --command bash -c "cd frontend && npm ci && npm run build" + run: nix develop .nix --command bash -c "cd frontend && npm run build" - name: Publish to Cloudflare Pages uses: cloudflare/pages-action@1 continue-on-error: true diff --git a/frontend/eslint.config.js b/frontend/eslint.config.js index c0f87d25f1..340e277c8e 100644 --- a/frontend/eslint.config.js +++ b/frontend/eslint.config.js @@ -87,7 +87,7 @@ export default defineConfig([ "svelte/require-each-key": "off", // TODO: Remove this rule and fix the places where it's violated // Import plugin config (for intelligently validating module import statements) - "import/no-unresolved": "error", + "import/no-unresolved": ["error", { ignore: ["@graphite/../wasm/pkg/graphite_wasm"] }], // `no-duplicates` disabled due to . Reenable if that issue gets fixed. "import/no-duplicates": "off", "import/prefer-default-export": "off", @@ -97,7 +97,10 @@ export default defineConfig([ "error", { alphabetize: { order: "asc", caseInsensitive: true }, - pathGroups: [{ pattern: "**/*.svelte", group: "unknown", position: "after" }], + pathGroups: [ + { pattern: "@graphite/../wasm/pkg/graphite_wasm", group: "external", position: "before" }, + { pattern: "**/*.svelte", group: "unknown", position: "after" }, + ], "newlines-between": "always-and-inside-groups", warnOnUnassignedImports: true, }, From 527ad5ec1bc4f1cd767c80632fae02ef99d77f7c Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Fri, 13 Feb 2026 17:53:09 +0100 Subject: [PATCH 04/15] Disable nix setup for self hosted runner --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24ec99c662..366371a5cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: id-token: write steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/nix-setup + # - uses: ./.github/actions/nix-setup - name: Build Rust code run: nix develop .nix --command cargo build --all-features - name: Run Rust tests From b2f7f458ee455966acb41b7ac73ff12dc2e8655b Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Sat, 14 Feb 2026 08:34:00 +0100 Subject: [PATCH 05/15] Revert build and only run lint + web build + rust fmt on gh runners --- .github/actions/nix-setup/action.yml | 13 -- .github/workflows/ci.yml | 202 ++++++++++++------ .github/workflows/deploy-master.yml | 67 +++--- frontend/eslint.config.js | 5 +- .../widgets/inputs/NumberInput.svelte | 3 +- frontend/src/editor.ts | 1 + frontend/src/messages.ts | 3 +- frontend/src/subscription-router.ts | 3 +- 8 files changed, 190 insertions(+), 107 deletions(-) delete mode 100644 .github/actions/nix-setup/action.yml diff --git a/.github/actions/nix-setup/action.yml b/.github/actions/nix-setup/action.yml deleted file mode 100644 index c4dcb344e3..0000000000 --- a/.github/actions/nix-setup/action.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: 'Nix Setup' -description: 'Sets up Nix with the magic cache for CI' - -runs: - using: "composite" - steps: - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main - with: - determinate: false - - - name: Setup Nix cache - uses: DeterminateSystems/magic-nix-cache-action@main diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 366371a5cb..cdf6957964 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,76 +8,126 @@ env: CARGO_TERM_COLOR: always jobs: - # Check if CI can be skipped (for merge queue optimization) - skip-check: + # Fast linting job on GitHub runner + web-lint: runs-on: ubuntu-latest - outputs: - skip: ${{ steps.skip-check.outputs.skip-check }} steps: - - uses: actions/checkout@v4 - - name: Check if CI can be skipped + - name: ๐Ÿ“ฅ Clone and checkout repository + uses: actions/checkout@v3 + + - name: ๐Ÿšฆ Check if CI can be skipped id: skip-check uses: cariad-tech/merge-queue-ci-skipper@main - web-lint: - needs: skip-check - if: needs.skip-check.outputs.skip != 'true' - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/nix-setup - - name: Lint Graphite web formatting - run: nix develop .nix --command bash -c "cd frontend && npm ci && npm run lint" + - name: ๐ŸŸข Install the latest Node.js + if: steps.skip-check.outputs.skip-check != 'true' + uses: actions/setup-node@v4 + with: + node-version: 'latest' + + - name: ๐Ÿšง Install dependencies + if: steps.skip-check.outputs.skip-check != 'true' + run: | + cd frontend + npm ci + - name: ๐Ÿ‘• Lint Graphite web formatting + if: steps.skip-check.outputs.skip-check != 'true' + env: + NODE_ENV: production + run: | + cd frontend + npm run lint + + # Rust format check on GitHub runner rust-fmt: - needs: skip-check - if: needs.skip-check.outputs.skip != 'true' runs-on: ubuntu-latest - permissions: - contents: read - id-token: write steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/nix-setup - - name: Check Rust formatting - run: nix develop .nix --command cargo fmt --all -- --check - - rust-build-test: - needs: skip-check - if: needs.skip-check.outputs.skip != 'true' - runs-on: self-hosted - permissions: - contents: read - id-token: write + - name: ๐Ÿ“ฅ Clone and checkout repository + uses: actions/checkout@v3 + + - name: ๐Ÿšฆ Check if CI can be skipped + id: skip-check + uses: cariad-tech/merge-queue-ci-skipper@main + + - name: ๐Ÿฆ€ Install the latest Rust + if: steps.skip-check.outputs.skip-check != 'true' + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + + - name: ๐Ÿ”ฌ Check Rust formatting + if: steps.skip-check.outputs.skip-check != 'true' + run: cargo fmt --all -- --check + + # License compatibility check on GitHub runner + cargo-deny: + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - # - uses: ./.github/actions/nix-setup - - name: Build Rust code - run: nix develop .nix --command cargo build --all-features - - name: Run Rust tests - run: nix develop .nix --command cargo test --all-features + - name: ๐Ÿ“ฅ Clone and checkout repository + uses: actions/checkout@v3 + + - name: ๐Ÿ“œ Check crate license compatibility for root workspace + uses: EmbarkStudios/cargo-deny-action@v2 + with: + command: check bans licenses sources + + - name: ๐Ÿ“œ Check crate license compatibility for /libraries/rawkit + uses: EmbarkStudios/cargo-deny-action@v2 + with: + command: check bans licenses sources + manifest-path: libraries/rawkit/Cargo.toml + # Web build on GitHub runner (only compiles WASM crate) web-build: - needs: skip-check - if: needs.skip-check.outputs.skip != 'true' runs-on: ubuntu-latest permissions: contents: read - id-token: write deployments: write steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/nix-setup - - name: Clean npm cache - run: rm -rf frontend/node_modules - - name: Build Graphite web code + - name: ๐Ÿ“ฅ Clone and checkout repository + uses: actions/checkout@v3 + + - name: ๐Ÿšฆ Check if CI can be skipped + id: skip-check + uses: cariad-tech/merge-queue-ci-skipper@main + + - name: ๐ŸŸข Install the latest Node.js + if: steps.skip-check.outputs.skip-check != 'true' + uses: actions/setup-node@v4 + with: + node-version: 'latest' + + - name: ๐Ÿฆ€ Install the latest Rust + if: steps.skip-check.outputs.skip-check != 'true' + uses: dtolnay/rust-toolchain@stable + with: + targets: wasm32-unknown-unknown + + - name: ๐Ÿ“ฆ Install wasm-pack + if: steps.skip-check.outputs.skip-check != 'true' + run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + + - name: ๐Ÿ“ฆ Install cargo-about + if: steps.skip-check.outputs.skip-check != 'true' + run: cargo install cargo-about + + - name: ๐Ÿšง Install build dependencies + if: steps.skip-check.outputs.skip-check != 'true' + run: | + cd frontend + npm run setup + + - name: ๐ŸŒ Build Graphite web code + if: steps.skip-check.outputs.skip-check != 'true' env: NODE_ENV: production - run: nix develop .nix --command bash -c "cd frontend && npm run build" - - name: Publish to Cloudflare Pages + run: | + cd frontend + npm run build + + - name: ๐Ÿ“ค Publish to Cloudflare Pages + if: steps.skip-check.outputs.skip-check != 'true' uses: cloudflare/pages-action@1 continue-on-error: true with: @@ -87,18 +137,40 @@ jobs: projectName: graphite-dev directory: frontend/dist - cargo-deny: - needs: skip-check - if: needs.skip-check.outputs.skip != 'true' - runs-on: ubuntu-latest + # Full Rust build and tests on self-hosted runner + rust-build-and-test: + runs-on: self-hosted + env: + RUSTC_WRAPPER: /usr/bin/sccache + CARGO_INCREMENTAL: 0 + SCCACHE_DIR: /var/lib/github-actions/.cache + steps: - - uses: actions/checkout@v4 - - name: Check crate license compatibility for root workspace - uses: EmbarkStudios/cargo-deny-action@v2 - with: - command: check bans licenses sources - - name: Check crate license compatibility for /libraries/rawkit - uses: EmbarkStudios/cargo-deny-action@v2 - with: - command: check bans licenses sources - manifest-path: libraries/rawkit/Cargo.toml + - name: ๐Ÿ“ฅ Clone and checkout repository + uses: actions/checkout@v3 + + - name: ๐Ÿšฆ Check if CI can be skipped + id: skip-check + uses: cariad-tech/merge-queue-ci-skipper@main + + - name: ๐Ÿฆ€ Install the latest Rust + if: steps.skip-check.outputs.skip-check != 'true' + run: | + rustup update stable + + - name: ๐Ÿฆ€ Fetch Rust dependencies + if: steps.skip-check.outputs.skip-check != 'true' + run: | + cargo fetch --locked + + - name: ๐Ÿฆ€ Build Rust code + if: steps.skip-check.outputs.skip-check != 'true' + env: + RUSTFLAGS: -Dwarnings + run: | + mold -run cargo build --all-features + + - name: ๐Ÿงช Run Rust tests + if: steps.skip-check.outputs.skip-check != 'true' + run: | + mold -run cargo test --all-features diff --git a/.github/workflows/deploy-master.yml b/.github/workflows/deploy-master.yml index 05f8b0e1bc..c56bfa6f53 100644 --- a/.github/workflows/deploy-master.yml +++ b/.github/workflows/deploy-master.yml @@ -15,23 +15,48 @@ jobs: permissions: contents: write deployments: write - id-token: write + actions: write + steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/nix-setup + - name: ๐Ÿ“ฅ Clone and checkout repository + uses: actions/checkout@v3 - - name: Replace template in of index.html + - name: ๐ŸŸข Install the latest Node.js + uses: actions/setup-node@v4 + with: + node-version: 'latest' + + - name: ๐Ÿฆ€ Install the latest Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: wasm32-unknown-unknown + + - name: ๐Ÿ“ฆ Install wasm-pack + run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + + - name: ๐Ÿ“ฆ Install cargo-about + run: cargo install cargo-about + + - name: ๐Ÿšง Install build dependencies + run: | + cd frontend + npm run setup + + - name: โœ‚ Replace template in of index.html run: | sed -i "s||$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html - - name: Build Graphite web code + - name: ๐ŸŒ Build Graphite web code env: NODE_ENV: production - run: nix develop .nix --command bash -c "cd frontend && npm ci && npm run build" + run: | + cd frontend + npm run build - - name: Publish to Cloudflare Pages + - name: ๐Ÿ“ค Publish to Cloudflare Pages id: cloudflare uses: cloudflare/pages-action@1 + continue-on-error: true with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} @@ -39,7 +64,7 @@ jobs: projectName: graphite-dev directory: frontend/dist - - name: Comment build link URL to commit hash page on GitHub + - name: ๐Ÿ’ฌ Comment build link URL to commit hash page on GitHub env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | @@ -47,34 +72,26 @@ jobs: -X POST \ -H "Accept: application/vnd.github+json" \ /repos/${{ github.repository }}/commits/$(git rev-parse HEAD)/comments \ - -f body="| **Build Complete for** $(git rev-parse HEAD) | + -f body="| ๐Ÿ“ฆ **Build Complete for** $(git rev-parse HEAD) | |-| | ${{ steps.cloudflare.outputs.url }} |" - generate-docs: - runs-on: ubuntu-latest - permissions: - contents: write - actions: write - id-token: write - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/nix-setup - - - name: Generate code documentation info for website + - name: ๐Ÿ“ƒ Generate code documentation info for website run: | - nix develop .nix --command bash -c "cd tools/editor-message-tree && cargo run" + cd tools/editor-message-tree + cargo run + cd ../.. mkdir -p artifacts-generated mv website/generated/hierarchical_message_system_tree.txt artifacts-generated/hierarchical_message_system_tree.txt - - name: Obtain cache of auto-generated code docs artifacts + - name: ๐Ÿ’ฟ Obtain cache of auto-generated code docs artifacts, to check if they've changed id: cache-website-code-docs uses: actions/cache/restore@v3 with: path: artifacts key: website-code-docs - - name: Check if auto-generated code docs artifacts changed + - name: ๐Ÿ” Check if auto-generated code docs artifacts changed id: website-code-docs-changed run: | if ! diff --brief --recursive artifacts-generated artifacts; then @@ -88,14 +105,14 @@ jobs: rm -rf artifacts-generated fi - - name: Save cache of auto-generated code docs artifacts + - name: ๐Ÿ’พ Save cache of auto-generated code docs artifacts if: steps.website-code-docs-changed.outputs.changed == 'true' uses: actions/cache/save@v3 with: path: artifacts key: ${{ steps.cache-website-code-docs.outputs.cache-primary-key }} - - name: Trigger website rebuild if the auto-generated code docs artifacts have changed + - name: โ™ป๏ธ Trigger website rebuild if the auto-generated code docs artifacts have changed if: steps.website-code-docs-changed.outputs.changed == 'true' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/frontend/eslint.config.js b/frontend/eslint.config.js index 340e277c8e..211774219c 100644 --- a/frontend/eslint.config.js +++ b/frontend/eslint.config.js @@ -87,6 +87,7 @@ export default defineConfig([ "svelte/require-each-key": "off", // TODO: Remove this rule and fix the places where it's violated // Import plugin config (for intelligently validating module import statements) + // Ignore WASM package path since it's generated at build time "import/no-unresolved": ["error", { ignore: ["@graphite/../wasm/pkg/graphite_wasm"] }], // `no-duplicates` disabled due to . Reenable if that issue gets fixed. "import/no-duplicates": "off", @@ -98,9 +99,11 @@ export default defineConfig([ { alphabetize: { order: "asc", caseInsensitive: true }, pathGroups: [ - { pattern: "@graphite/../wasm/pkg/graphite_wasm", group: "external", position: "before" }, + // WASM package is generated at build time, treat as external + { pattern: "@graphite/../wasm/pkg/*", group: "external", position: "before" }, { pattern: "**/*.svelte", group: "unknown", position: "after" }, ], + pathGroupsExcludedImportTypes: [], "newlines-between": "always-and-inside-groups", warnOnUnassignedImports: true, }, diff --git a/frontend/src/components/widgets/inputs/NumberInput.svelte b/frontend/src/components/widgets/inputs/NumberInput.svelte index 51152a2025..e7694f66c7 100644 --- a/frontend/src/components/widgets/inputs/NumberInput.svelte +++ b/frontend/src/components/widgets/inputs/NumberInput.svelte @@ -1,7 +1,8 @@