diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 7928f1e..6379d08 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -33,18 +33,11 @@ jobs: with: components: rustfmt, clippy - - name: Cache Cargo dependencies - uses: actions/cache@v4 + - name: Cache Rust dependencies + uses: Swatinem/rust-cache@v2 with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo- + shared-key: rust-build + cache-on-failure: true - name: Check Rust formatting run: cargo fmt --all -- --check @@ -70,22 +63,19 @@ jobs: with: targets: wasm32-unknown-unknown - - name: Cache Cargo dependencies - uses: actions/cache@v4 + - name: Cache Rust dependencies + uses: Swatinem/rust-cache@v2 with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-wasm-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-wasm- - ${{ runner.os }}-cargo- + workspaces: | + . -> target + arrow-db-wasm -> target + shared-key: wasm-build + cache-on-failure: true - name: Install wasm-pack - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + uses: jetli/wasm-pack-action@v0.4.0 + with: + version: "latest" - name: Build WASM (release mode) run: wasm-pack build ./arrow-db-wasm --target web --out-dir ../arrow-db-browser/arrow-db-wasm @@ -142,22 +132,19 @@ jobs: with: targets: wasm32-unknown-unknown - - name: Cache Cargo dependencies - uses: actions/cache@v4 + - name: Cache Rust dependencies + uses: Swatinem/rust-cache@v2 with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-wasm-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-wasm- - ${{ runner.os }}-cargo- + workspaces: | + . -> target + arrow-db-wasm -> target + shared-key: wasm-build + cache-on-failure: true - name: Install wasm-pack - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + uses: jetli/wasm-pack-action@v0.4.0 + with: + version: "latest" - name: Build WASM (release mode) run: wasm-pack build ./arrow-db-wasm --target web --out-dir ../arrow-db-browser/arrow-db-wasm diff --git a/arrow-db-wasm/Cargo.toml b/arrow-db-wasm/Cargo.toml index 3a5229c..8b915e8 100644 --- a/arrow-db-wasm/Cargo.toml +++ b/arrow-db-wasm/Cargo.toml @@ -34,3 +34,15 @@ wasm-bindgen-test = "0.3.43" debug-js-glue = true demangle-name-section = true dwarf-debug-info = false + +[profile.release] +# Optimize for speed of compilation rather than runtime performance in CI +# This significantly reduces build times +opt-level = 2 # Use O2 instead of O3 (faster compilation) +lto = "thin" # Use thin LTO instead of full LTO (much faster) +codegen-units = 16 # More codegen units = faster parallel compilation + +[profile.release.package."*"] +# For dependencies, optimize for speed (they don't change often and are cached) +opt-level = 3 +codegen-units = 1