From aaf67301d0f73cc3fd9506a5c06845c68a6252c6 Mon Sep 17 00:00:00 2001 From: David DiMaria Date: Mon, 6 Oct 2025 08:09:13 -0600 Subject: [PATCH 1/2] Implement caching in CI --- .github/DEPLOY.md | 51 +++++++++++++++++++++ .github/workflows/build-and-deploy.yml | 61 ++++++++++---------------- arrow-db-wasm/Cargo.toml | 12 +++++ 3 files changed, 87 insertions(+), 37 deletions(-) create mode 100644 .github/DEPLOY.md diff --git a/.github/DEPLOY.md b/.github/DEPLOY.md new file mode 100644 index 0000000..d926d4d --- /dev/null +++ b/.github/DEPLOY.md @@ -0,0 +1,51 @@ +# Deployment Guide + +This repository is configured with GitHub Actions to automatically build and deploy to GitHub Pages. + +## GitHub Pages Setup + +To enable GitHub Pages deployment: + +1. Go to your repository on GitHub +2. Navigate to **Settings** → **Pages** +3. Under "Build and deployment", set: + - **Source**: GitHub Actions +4. Save the changes + +## Workflow Overview + +The workflow (`.github/workflows/build-and-deploy.yml`) performs the following steps: + +### On Pull Requests +- ✅ Lints Rust code (`cargo fmt`, `cargo clippy`) +- ✅ Tests Rust code (`cargo test`) +- ✅ Builds WASM in release mode +- ✅ Builds Vite static assets (without deploying) + +### On Push to main/master +- ✅ Lints Rust code +- ✅ Tests Rust code +- ✅ Builds WASM in release mode +- ✅ Builds Vite static assets +- 🚀 Deploys to GitHub Pages + +## Manual Deployment + +You can also trigger a deployment manually: + +1. Go to **Actions** tab in your repository +2. Select the "Build and Deploy" workflow +3. Click "Run workflow" +4. Select the branch and click "Run workflow" + +## Base URL + +The workflow automatically sets the base URL to `//` for proper asset loading on GitHub Pages. If you're deploying to a custom domain, you may want to adjust the `BASE_URL` environment variable in the workflow file. + +## Viewing Your Site + +After successful deployment, your site will be available at: +- `https://.github.io//` (for repository pages) +- `https://.github.io/` (for user/organization pages with custom settings) + +Check the **Actions** tab to monitor deployment progress and the **Environments** section to see deployment history. 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 From af6e3bf3218d48b0facfb33be2644121b9b3deb6 Mon Sep 17 00:00:00 2001 From: David DiMaria Date: Mon, 6 Oct 2025 08:10:11 -0600 Subject: [PATCH 2/2] Remove deploy markdown --- .github/DEPLOY.md | 51 ----------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 .github/DEPLOY.md diff --git a/.github/DEPLOY.md b/.github/DEPLOY.md deleted file mode 100644 index d926d4d..0000000 --- a/.github/DEPLOY.md +++ /dev/null @@ -1,51 +0,0 @@ -# Deployment Guide - -This repository is configured with GitHub Actions to automatically build and deploy to GitHub Pages. - -## GitHub Pages Setup - -To enable GitHub Pages deployment: - -1. Go to your repository on GitHub -2. Navigate to **Settings** → **Pages** -3. Under "Build and deployment", set: - - **Source**: GitHub Actions -4. Save the changes - -## Workflow Overview - -The workflow (`.github/workflows/build-and-deploy.yml`) performs the following steps: - -### On Pull Requests -- ✅ Lints Rust code (`cargo fmt`, `cargo clippy`) -- ✅ Tests Rust code (`cargo test`) -- ✅ Builds WASM in release mode -- ✅ Builds Vite static assets (without deploying) - -### On Push to main/master -- ✅ Lints Rust code -- ✅ Tests Rust code -- ✅ Builds WASM in release mode -- ✅ Builds Vite static assets -- 🚀 Deploys to GitHub Pages - -## Manual Deployment - -You can also trigger a deployment manually: - -1. Go to **Actions** tab in your repository -2. Select the "Build and Deploy" workflow -3. Click "Run workflow" -4. Select the branch and click "Run workflow" - -## Base URL - -The workflow automatically sets the base URL to `//` for proper asset loading on GitHub Pages. If you're deploying to a custom domain, you may want to adjust the `BASE_URL` environment variable in the workflow file. - -## Viewing Your Site - -After successful deployment, your site will be available at: -- `https://.github.io//` (for repository pages) -- `https://.github.io/` (for user/organization pages with custom settings) - -Check the **Actions** tab to monitor deployment progress and the **Environments** section to see deployment history.