diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index 3d8ff19a6..ee13d618b 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -61,40 +61,33 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - - name: Rust Cache - uses: Swatinem/rust-cache@v2 - with: - workspaces: "frontend/src-tauri -> target" - cache-on-failure: true - - - name: Cache Cargo registry + - name: Install sccache + run: | + SCCACHE_VERSION=0.8.2 + SCCACHE_URL="https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz" + curl -L "$SCCACHE_URL" | tar xz + sudo mv sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl/sccache /usr/local/bin/ + chmod +x /usr/local/bin/sccache + sccache --version + + - name: Cache sccache uses: actions/cache@v4 with: - path: | - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + path: ~/.cache/sccache + key: ${{ runner.os }}-sccache-android-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - ${{ runner.os }}-cargo-registry- + ${{ runner.os }}-sccache-android- + ${{ runner.os }}-sccache- - - name: Cache Cargo bin + - name: Cache Cargo bin (Tauri CLI) uses: actions/cache@v4 with: path: ~/.cargo/bin/ - key: ${{ runner.os }}-cargo-bin-tauri-cli + key: ${{ runner.os }}-cargo-bin-tauri-cli-2.9.2 restore-keys: | + ${{ runner.os }}-cargo-bin-tauri-cli- ${{ runner.os }}-cargo-bin- - - name: Cache APT packages - uses: actions/cache@v4 - with: - path: /var/cache/apt/archives - key: ${{ runner.os }}-apt-android-${{ hashFiles('.github/workflows/android-build.yml') }} - restore-keys: | - ${{ runner.os }}-apt-android- - ${{ runner.os }}-apt- - - name: Install Linux dependencies run: | sudo apt-get update @@ -142,6 +135,12 @@ jobs: echo "Generated tauri.properties with version $VERSION and versionCode $VERSION_CODE" + - name: Configure sccache + run: | + echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV + echo "SCCACHE_DIR=$HOME/.cache/sccache" >> $GITHUB_ENV + echo "SCCACHE_CACHE_SIZE=2G" >> $GITHUB_ENV + - name: Build Tauri Android App (Signed Release) working-directory: ./frontend run: | @@ -184,6 +183,9 @@ jobs: VITE_MAPLE_BILLING_API_URL: ${{ github.event_name == 'pull_request' && 'https://billing-dev.opensecret.cloud' || 'https://billing.opensecret.cloud' }} VITE_CLIENT_ID: ba5a14b5-d915-47b1-b7b1-afda52bc5fc6 + - name: Show sccache stats + run: sccache --show-stats + - name: Upload Android APK uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index 48799efd9..e5d1faaa8 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -70,28 +70,28 @@ jobs: with: targets: aarch64-apple-darwin,x86_64-apple-darwin,aarch64-apple-ios - - name: Rust Cache - uses: Swatinem/rust-cache@v2 - with: - workspaces: "frontend/src-tauri -> target" - cache-on-failure: true + - name: Install sccache + run: | + SCCACHE_VERSION=0.8.2 + SCCACHE_URL="https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz" + curl -L "$SCCACHE_URL" | tar xz + sudo mv sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl/sccache /usr/local/bin/ + chmod +x /usr/local/bin/sccache + sccache --version - - name: Cache APT packages + - name: Cache sccache uses: actions/cache@v4 with: - path: /var/cache/apt/archives - key: ${{ runner.os }}-apt-${{ hashFiles('.github/workflows/claude.yml') }} + path: ~/.cache/sccache + key: ${{ runner.os }}-sccache-claude-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - ${{ runner.os }}-apt- + ${{ runner.os }}-sccache-claude- + ${{ runner.os }}-sccache- - name: Install Linux dependencies run: | sudo apt-get update sudo apt-get install -y libwebkit2gtk-4.1-dev \ - build-essential \ - curl \ - wget \ - file \ libssl-dev \ libgtk-3-dev \ libayatana-appindicator3-dev \ @@ -101,25 +101,21 @@ jobs: working-directory: ./frontend run: bun install - - name: Cache Cargo registry - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-registry- - - - name: Cache Cargo bin + - name: Cache Cargo bin (Tauri CLI) uses: actions/cache@v4 with: path: ~/.cargo/bin/ - key: ${{ runner.os }}-cargo-bin-tauri-cli + key: ${{ runner.os }}-cargo-bin-tauri-cli-2.9.2 restore-keys: | + ${{ runner.os }}-cargo-bin-tauri-cli- ${{ runner.os }}-cargo-bin- + - name: Configure sccache + run: | + echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV + echo "SCCACHE_DIR=$HOME/.cache/sccache" >> $GITHUB_ENV + echo "SCCACHE_CACHE_SIZE=2G" >> $GITHUB_ENV + - name: Install Tauri CLI run: | if ! command -v cargo-tauri &> /dev/null; then diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index 83f28be19..d9cd1b6ce 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -25,20 +25,41 @@ jobs: with: targets: aarch64-apple-darwin,x86_64-apple-darwin - - name: Rust Cache - uses: Swatinem/rust-cache@v2 + - name: Cache Homebrew + uses: actions/cache@v4 with: - workspaces: "frontend/src-tauri -> target" - cache-on-failure: true - - - name: Install dependencies (macOS) + path: | + ~/Library/Caches/Homebrew + /opt/homebrew/Cellar/sccache + /opt/homebrew/Cellar/openssl@3 + key: ${{ runner.os }}-brew-${{ hashFiles('.github/workflows/desktop-build.yml') }} + restore-keys: | + ${{ runner.os }}-brew- + + - name: Install sccache run: | - brew install openssl@3 + brew install sccache + brew link --overwrite --force sccache + sccache --version + + - name: Cache sccache + uses: actions/cache@v4 + with: + path: ~/Library/Caches/Mozilla.sccache + key: ${{ runner.os }}-sccache-macos-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-sccache-macos- + ${{ runner.os }}-sccache- - name: Install frontend dependencies working-directory: ./frontend run: bun install + - name: Configure sccache + run: | + echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV + echo "SCCACHE_CACHE_SIZE=2G" >> $GITHUB_ENV + - name: Import Apple Developer Certificate env: APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} @@ -80,6 +101,9 @@ jobs: projectPath: './frontend' args: --target ${{ matrix.target }} + - name: Show sccache stats + run: sccache --show-stats + - name: Upload macOS Build uses: actions/upload-artifact@v4 with: @@ -102,20 +126,37 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable - - name: Rust Cache - uses: Swatinem/rust-cache@v2 + - name: Install sccache + run: | + SCCACHE_VERSION=0.8.2 + SCCACHE_URL="https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz" + curl -L "$SCCACHE_URL" | tar xz + sudo mv sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl/sccache /usr/local/bin/ + chmod +x /usr/local/bin/sccache + sccache --version + + - name: Cache sccache + uses: actions/cache@v4 + with: + path: ~/.cache/sccache + key: ${{ runner.os }}-sccache-linux-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-sccache-linux- + ${{ runner.os }}-sccache- + + - name: Cache Cargo bin (Tauri CLI) + uses: actions/cache@v4 with: - workspaces: "frontend/src-tauri -> target" - cache-on-failure: true + path: ~/.cargo/bin/ + key: ${{ runner.os }}-cargo-bin-tauri-cli-2.9.2 + restore-keys: | + ${{ runner.os }}-cargo-bin-tauri-cli- + ${{ runner.os }}-cargo-bin- - name: Install Linux dependencies run: | sudo apt-get update sudo apt-get install -y libwebkit2gtk-4.1-dev \ - build-essential \ - curl \ - wget \ - file \ libssl-dev \ libgtk-3-dev \ libayatana-appindicator3-dev \ @@ -126,10 +167,21 @@ jobs: run: bun install - name: Install Tauri CLI - run: cargo install tauri-cli --version "2.9.2" --locked + run: | + if ! command -v cargo-tauri &> /dev/null; then + cargo install tauri-cli --version "2.9.2" --locked + else + echo "Tauri CLI already installed" + fi env: CARGO_CFG_TARGET_OS: linux + - name: Configure sccache + run: | + echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV + echo "SCCACHE_DIR=$HOME/.cache/sccache" >> $GITHUB_ENV + echo "SCCACHE_CACHE_SIZE=2G" >> $GITHUB_ENV + - name: Build Tauri App (Linux) working-directory: ./frontend run: cargo tauri build @@ -140,6 +192,9 @@ jobs: VITE_MAPLE_BILLING_API_URL: ${{ github.event_name == 'pull_request' && 'https://billing-dev.opensecret.cloud' || 'https://billing.opensecret.cloud' }} VITE_CLIENT_ID: ba5a14b5-d915-47b1-b7b1-afda52bc5fc6 + - name: Show sccache stats + run: sccache --show-stats + - name: Upload Linux Builds uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/mobile-build.yml b/.github/workflows/mobile-build.yml index d35e69836..307c80914 100644 --- a/.github/workflows/mobile-build.yml +++ b/.github/workflows/mobile-build.yml @@ -22,15 +22,32 @@ jobs: with: targets: aarch64-apple-ios - - name: Rust Cache - uses: Swatinem/rust-cache@v2 + - name: Cache Homebrew + uses: actions/cache@v4 with: - workspaces: "frontend/src-tauri -> target" - cache-on-failure: true + path: | + ~/Library/Caches/Homebrew + /opt/homebrew/Cellar/openssl@3 + key: ${{ runner.os }}-brew-${{ hashFiles('.github/workflows/mobile-build.yml') }} + restore-keys: | + ${{ runner.os }}-brew- - - name: Install dependencies (macOS) - run: | - brew install openssl@3 + - name: Cache Xcode DerivedData and SourcePackages + uses: irgaly/xcode-cache@v1 + with: + key: xcode-cache-ios-${{ github.workflow }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + xcode-cache-ios-${{ github.workflow }}- + xcode-cache-ios- + + - name: Cache Cargo bin (Tauri CLI) + uses: actions/cache@v4 + with: + path: ~/.cargo/bin/ + key: ${{ runner.os }}-cargo-bin-tauri-cli-2.9.2 + restore-keys: | + ${{ runner.os }}-cargo-bin-tauri-cli- + ${{ runner.os }}-cargo-bin- - name: Install frontend dependencies working-directory: ./frontend @@ -42,7 +59,12 @@ jobs: xcode-version: '16.4' - name: Install Tauri CLI - run: cargo install tauri-cli --version "2.9.2" --locked + run: | + if ! command -v cargo-tauri &> /dev/null; then + cargo install tauri-cli --version "2.9.2" --locked + else + echo "Tauri CLI already installed" + fi env: # Workaround for getrandom v0.2.16 (https://github.com/rust-random/getrandom/issues/641) # cargo install builds for the host; on macOS runners target_os is "macos" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a9afdf1eb..af9817880 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,26 +49,49 @@ jobs: with: targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} - - name: Rust Cache - uses: Swatinem/rust-cache@v2 + - name: Cache Homebrew + if: matrix.platform == 'macos-latest' + uses: actions/cache@v4 with: - workspaces: "frontend/src-tauri -> target" - cache-on-failure: true + path: | + ~/Library/Caches/Homebrew + /opt/homebrew/Cellar/sccache + /opt/homebrew/Cellar/openssl@3 + key: ${{ runner.os }}-brew-${{ hashFiles('.github/workflows/release.yml') }} + restore-keys: | + ${{ runner.os }}-brew- - - name: Install dependencies (macOS) + - name: Install sccache (macOS) if: matrix.platform == 'macos-latest' run: | - brew install openssl@3 + brew install sccache + brew link --overwrite --force sccache + sccache --version + + - name: Install sccache (Linux) + if: matrix.platform == 'ubuntu-latest' + run: | + SCCACHE_VERSION=0.8.2 + SCCACHE_URL="https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz" + curl -L "$SCCACHE_URL" | tar xz + sudo mv sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl/sccache /usr/local/bin/ + chmod +x /usr/local/bin/sccache + sccache --version + + - name: Cache sccache + uses: actions/cache@v4 + with: + path: ${{ matrix.platform == 'macos-latest' && '~/Library/Caches/Mozilla.sccache' || '~/.cache/sccache' }} + key: ${{ runner.os }}-sccache-release-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-sccache-release- + ${{ runner.os }}-sccache- - name: Install dependencies (Linux) if: matrix.platform == 'ubuntu-latest' run: | sudo apt-get update sudo apt-get install -y libwebkit2gtk-4.1-dev \ - build-essential \ - curl \ - wget \ - file \ libssl-dev \ libgtk-3-dev \ libayatana-appindicator3-dev \ @@ -78,6 +101,11 @@ jobs: working-directory: ./frontend run: bun install + - name: Configure sccache + run: | + echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV + echo "SCCACHE_CACHE_SIZE=2G" >> $GITHUB_ENV + - name: Build Tauri App uses: tauri-apps/tauri-action@v0 env: @@ -157,40 +185,33 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - - name: Rust Cache - uses: Swatinem/rust-cache@v2 - with: - workspaces: "frontend/src-tauri -> target" - cache-on-failure: true - - - name: Cache Cargo registry + - name: Install sccache + run: | + SCCACHE_VERSION=0.8.2 + SCCACHE_URL="https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz" + curl -L "$SCCACHE_URL" | tar xz + sudo mv sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl/sccache /usr/local/bin/ + chmod +x /usr/local/bin/sccache + sccache --version + + - name: Cache sccache uses: actions/cache@v4 with: - path: | - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + path: ~/.cache/sccache + key: ${{ runner.os }}-sccache-android-release-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - ${{ runner.os }}-cargo-registry- + ${{ runner.os }}-sccache-android-release- + ${{ runner.os }}-sccache- - - name: Cache Cargo bin + - name: Cache Cargo bin (Tauri CLI) uses: actions/cache@v4 with: path: ~/.cargo/bin/ - key: ${{ runner.os }}-cargo-bin-tauri-cli + key: ${{ runner.os }}-cargo-bin-tauri-cli-2.9.2 restore-keys: | + ${{ runner.os }}-cargo-bin-tauri-cli- ${{ runner.os }}-cargo-bin- - - name: Cache APT packages - uses: actions/cache@v4 - with: - path: /var/cache/apt/archives - key: ${{ runner.os }}-apt-android-${{ hashFiles('.github/workflows/release.yml') }} - restore-keys: | - ${{ runner.os }}-apt-android- - ${{ runner.os }}-apt- - - name: Install Linux dependencies run: | sudo apt-get update @@ -238,6 +259,12 @@ jobs: echo "Generated tauri.properties with version $VERSION and versionCode $VERSION_CODE" + - name: Configure sccache + run: | + echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV + echo "SCCACHE_DIR=$HOME/.cache/sccache" >> $GITHUB_ENV + echo "SCCACHE_CACHE_SIZE=2G" >> $GITHUB_ENV + - name: Build Tauri Android App (Signed Release) working-directory: ./frontend run: | diff --git a/.github/workflows/testflight-on-comment.yml b/.github/workflows/testflight-on-comment.yml index 1678fce2d..9b46df1f1 100644 --- a/.github/workflows/testflight-on-comment.yml +++ b/.github/workflows/testflight-on-comment.yml @@ -80,15 +80,32 @@ jobs: with: targets: aarch64-apple-ios - - name: Rust Cache - uses: Swatinem/rust-cache@v2 + - name: Cache Homebrew + uses: actions/cache@v4 with: - workspaces: "frontend/src-tauri -> target" - cache-on-failure: true + path: | + ~/Library/Caches/Homebrew + /opt/homebrew/Cellar/openssl@3 + key: ${{ runner.os }}-brew-${{ hashFiles('.github/workflows/testflight-on-comment.yml') }} + restore-keys: | + ${{ runner.os }}-brew- - - name: Install dependencies (macOS) - run: | - brew install openssl@3 + - name: Cache Xcode DerivedData and SourcePackages + uses: irgaly/xcode-cache@v1 + with: + key: xcode-cache-testflight-${{ github.workflow }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + xcode-cache-testflight-${{ github.workflow }}- + xcode-cache-testflight- + + - name: Cache Cargo bin (Tauri CLI) + uses: actions/cache@v4 + with: + path: ~/.cargo/bin/ + key: ${{ runner.os }}-cargo-bin-tauri-cli-2.9.2 + restore-keys: | + ${{ runner.os }}-cargo-bin-tauri-cli- + ${{ runner.os }}-cargo-bin- - name: Install frontend dependencies working-directory: ./frontend @@ -100,7 +117,12 @@ jobs: xcode-version: '16.4' - name: Install Tauri CLI - run: cargo install tauri-cli --version "2.9.2" --locked + run: | + if ! command -v cargo-tauri &> /dev/null; then + cargo install tauri-cli --version "2.9.2" --locked + else + echo "Tauri CLI already installed" + fi env: # Workaround for getrandom v0.2.16 (https://github.com/rust-random/getrandom/issues/641) # cargo install builds for the host; on macOS runners target_os is "macos" diff --git a/frontend/src-tauri/gen/android/gradle.properties b/frontend/src-tauri/gen/android/gradle.properties index 2a7ec6959..da30958b8 100644 --- a/frontend/src-tauri/gen/android/gradle.properties +++ b/frontend/src-tauri/gen/android/gradle.properties @@ -10,7 +10,10 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true +org.gradle.parallel=true +org.gradle.daemon=true +org.gradle.caching=true +org.gradle.configureondemand=true # AndroidX package structure to make it clearer which packages are bundled with the # Android operating system, and which are packaged with your app"s APK # https://developer.android.com/topic/libraries/support-library/androidx-rn