From 38b39101ce5e56442eb00b75f637980f49401247 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sat, 6 Dec 2025 11:42:06 +0000 Subject: [PATCH] Improve dev env & CI setup --- .github/workflows/check.yml | 29 +++-------------------------- README.md | 6 +----- scripts/build-website.sh | 2 ++ scripts/bump-version.sh | 4 ++++ scripts/lint.sh | 3 +++ scripts/test.sh | 12 +++++++++++- 6 files changed, 24 insertions(+), 32 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 8ca6cf9..4561abc 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -37,20 +37,8 @@ jobs: restore-keys: | ${{ runner.os }}-cargo- - - name: Setup rust - run: | - which wasm-pack || cargo install wasm-pack - which cargo-machete || cargo install cargo-machete - - - name: Build wasm - run: | - wasm-pack build --target web --features wasm - - name: Lint - run: | - cargo clippy --all-targets --all-features - cargo fmt --all -- --check - cargo machete + run: scripts/lint.sh - name: Test run: scripts/test.sh @@ -117,19 +105,8 @@ jobs: restore-keys: | ${{ runner.os }}-npm- - - name: Setup rust - run: | - which wasm-pack || cargo install wasm-pack - - - name: Build wasm - run: | - wasm-pack build --target web --features wasm - - - name: Build reconcile-js - run: | - cd reconcile-js - npm ci - npm run build + - name: Build website + run: scripts/build-website.sh - name: Publish reconcile-js to NPM run: | diff --git a/README.md b/README.md index a5e5a46..7925ed5 100644 --- a/README.md +++ b/README.md @@ -125,14 +125,10 @@ Contributions are welcome! #### Rust toolchain -1. Install [rustup](https://rustup.rs): +Install [rustup](https://rustup.rs): ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` -2. Install additional tools: - ```bash - cargo install wasm-pack cargo-insta cargo-edit - ``` ### Scripts diff --git a/scripts/build-website.sh b/scripts/build-website.sh index c55f95f..4195a58 100755 --- a/scripts/build-website.sh +++ b/scripts/build-website.sh @@ -2,7 +2,9 @@ set -e +which wasm-pack || cargo install wasm-pack wasm-pack build --target web --features wasm + cd reconcile-js npm ci npm run build diff --git a/scripts/bump-version.sh b/scripts/bump-version.sh index 2803cbd..4163c85 100755 --- a/scripts/bump-version.sh +++ b/scripts/bump-version.sh @@ -25,8 +25,12 @@ else fi echo "Bumping versions" + +which cargo-set-version || cargo install cargo-edit cargo set-version --bump $1 +which wasm-pack || cargo install wasm-pack + wasm-pack build --target web --features wasm cd reconcile-js diff --git a/scripts/lint.sh b/scripts/lint.sh index 480d85d..d2c94a5 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -2,6 +2,9 @@ set -e +which cargo-machete || cargo install cargo-machete +cargo machete + cargo clippy --all-targets --all-features --fix --allow-dirty --allow-staged cargo fmt --all diff --git a/scripts/test.sh b/scripts/test.sh index fb25d3c..b7678ee 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -2,6 +2,15 @@ set -e +which cargo-insta || cargo install cargo-insta +which wasm-pack || cargo install wasm-pack + +node_version=$(node --version | cut -d'.' -f1 | tr -d 'v') +if [ "$node_version" != "22" ]; then + echo "Error: Node.js version 22 is required, but found version $node_version" + exit 1 +fi + wasm-pack build --target web --features wasm,console_error_panic_hook cargo test --verbose --features serde -- --include-ignored @@ -13,7 +22,8 @@ cargo test --features all wasm-pack test --node --features wasm,console_error_panic_hook cd reconcile-js -npm install +npm ci +npm run build npm run test cd -