Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

perf(ci): speed up release and ci builds with parallel codegen, sccache, and in-job cli packaging

IGECT6b96a3973b52
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index fa70d38b..acb03a3d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -104,11 +104,12 @@ jobs:
steps:
- uses: actions/checkout@v4
+ - uses: pnpm/action-setup@v4
+
- uses: actions/setup-node@v4
with:
node-version: lts/*
-
- - uses: pnpm/action-setup@v4
+ cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
@@ -144,11 +145,12 @@ jobs:
steps:
- uses: actions/checkout@v4
+ - uses: pnpm/action-setup@v4
+
- uses: actions/setup-node@v4
with:
node-version: lts/*
-
- - uses: pnpm/action-setup@v4
+ cache: 'pnpm'
- uses: dtolnay/rust-toolchain@stable
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 13dece04..6a367364 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -9,13 +9,16 @@ jobs:
publish-tauri:
permissions:
contents: write
+ actions: write
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest'
+ cli_target: 'aarch64-apple-darwin'
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest'
+ cli_target: 'x86_64-apple-darwin'
args: '--target x86_64-apple-darwin'
# Ubuntu 22.04 keeps the x86_64 build on glibc 2.35, which is what
# lets the AppImage run on older distros. Its PipeWire headers
@@ -26,10 +29,13 @@ jobs:
# feature (`linux-capture`) is dropped; `rnnoise` stays because the
# dependency declaration asks for it by name.
- platform: 'ubuntu-22.04'
+ cli_target: 'x86_64-unknown-linux-gnu'
args: '-- --no-default-features'
- platform: 'ubuntu-24.04-arm'
+ cli_target: ''
args: ''
- platform: 'windows-latest'
+ cli_target: 'x86_64-pc-windows-msvc'
args: ''
runs-on: ${{ matrix.platform }}
@@ -43,15 +49,16 @@ jobs:
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev libasound2-dev libpipewire-0.3-dev clang libclang-dev patchelf xdg-utils
+ - uses: pnpm/action-setup@v5
+
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: lts/*
-
- - uses: pnpm/action-setup@v5
+ cache: 'pnpm'
- name: Install frontend dependencies
- run: pnpm install
+ run: pnpm install --frozen-lockfile
# Pinned via rust-toolchain.toml: the plugin ABI depends on the exact
# rustc version, so this must match what the plugin repos build with.
@@ -61,6 +68,15 @@ jobs:
toolchain: 1.97.0
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
+ - name: Setup sccache
+ uses: mozilla-actions/[email protected]
+
+ - name: Configure sccache
+ shell: bash
+ run: |
+ echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
+ echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
+
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
@@ -150,80 +166,40 @@ jobs:
}
shell: pwsh
- build-cli:
- # O omniget-cli existe no workspace desde sempre mas nunca saiu numa
- # release, entao a unica forma de usar era compilar da fonte (issue #202).
- #
- # `needs: publish-tauri` porque o upload precisa da release existir — quem a
- # cria e o publish-tauri. A *compilacao* e independente (o CLI nao precisa de
- # webkit/gtk: a arvore nao tem openssl-sys), e foi essa independencia que me
- # fez omitir o needs na #221. O resultado foi `release not found` na v0.8.0,
- # com o binario compilado e jogado fora.
- needs: publish-tauri
- strategy:
- fail-fast: false
- matrix:
- include:
- - os: ubuntu-22.04
- target: x86_64-unknown-linux-gnu
- - os: macos-latest
- target: aarch64-apple-darwin
- - os: macos-latest
- target: x86_64-apple-darwin
- - os: windows-latest
- target: x86_64-pc-windows-msvc
- runs-on: ${{ matrix.os }}
- permissions:
- contents: write
- steps:
- - uses: actions/checkout@v6
-
- # `@master` com a versao fixada, e nao `@stable`: o rust-toolchain.toml da
- # raiz forca 1.97.0, entao instalar o alvo no `stable` deixa a build usando
- # um toolchain que nao tem o alvo — `can't find crate for core` na primeira
- # release. O publish-tauri ja fazia assim; este job nao seguiu o padrao.
- - uses: dtolnay/rust-toolchain@master
- with:
- toolchain: 1.97.0
- targets: ${{ matrix.target }}
-
- - uses: Swatinem/rust-cache@v2
- with:
- workspaces: src-tauri
-
- - name: Build CLI
- working-directory: src-tauri
- run: cargo build -p omniget-cli --release --target ${{ matrix.target }}
-
- - name: Package and upload (unix)
- if: matrix.os != 'windows-latest'
+ - name: Package and upload CLI (Unix)
+ if: matrix.platform != 'windows-latest' && matrix.cli_target != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
TAG="${GITHUB_REF#refs/tags/}"
VERSION="${TAG#v}"
- BIN="src-tauri/target/${{ matrix.target }}/release/omniget-cli"
- # Falha alto se o binario nao existe: subir uma release sem o
- # artefato e pior do que o job ficar vermelho.
+ if [ "${{ matrix.platform }}" = "macos-latest" ]; then
+ cargo build -p omniget-cli --release --target ${{ matrix.cli_target }} --manifest-path src-tauri/Cargo.toml
+ BIN="src-tauri/target/${{ matrix.cli_target }}/release/omniget-cli"
+ else
+ cargo build -p omniget-cli --release --manifest-path src-tauri/Cargo.toml
+ BIN="src-tauri/target/release/omniget-cli"
+ fi
test -x "$BIN"
"$BIN" --version
- OUT="omniget-cli-${VERSION}-${{ matrix.target }}.tar.gz"
+ OUT="omniget-cli-${VERSION}-${{ matrix.cli_target }}.tar.gz"
tar -czf "$OUT" -C "$(dirname "$BIN")" omniget-cli
gh release upload "$TAG" "$OUT" --repo "${{ github.repository }}" --clobber
- - name: Package and upload (windows)
- if: matrix.os == 'windows-latest'
+ - name: Package and upload CLI (Windows)
+ if: matrix.platform == 'windows-latest' && matrix.cli_target != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$ErrorActionPreference = "Stop"
$TAG = "${{ github.ref_name }}"
$VERSION = $TAG -replace '^v', ''
- $BIN = "src-tauri/target/${{ matrix.target }}/release/omniget-cli.exe"
- if (-not (Test-Path $BIN)) { throw "binario nao encontrado: $BIN" }
+ cargo build -p omniget-cli --release --manifest-path src-tauri/Cargo.toml
+ $BIN = "src-tauri/target/release/omniget-cli.exe"
+ if (-not (Test-Path $BIN)) { throw "Binary not found: $BIN" }
& $BIN --version
- $OUT = "omniget-cli-${VERSION}-${{ matrix.target }}.zip"
+ $OUT = "omniget-cli-${VERSION}-${{ matrix.cli_target }}.zip"
Compress-Archive -Path $BIN -DestinationPath $OUT -Force
gh release upload $TAG $OUT --repo ${{ github.repository }} --clobber
shell: pwsh
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 7e79799d..ac7a1e7d 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -140,7 +140,7 @@ opt-level = 1
[profile.release]
lto = "thin"
-codegen-units = 1
+codegen-units = 16
strip = true
[patch.crates-io]
diff --git a/src-tauri/omniget-cli/Cargo.toml b/src-tauri/omniget-cli/Cargo.toml
index eafcaa60..f731e997 100644
--- a/src-tauri/omniget-cli/Cargo.toml
+++ b/src-tauri/omniget-cli/Cargo.toml
@@ -17,7 +17,3 @@ tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
directories = "6"
-[profile.release]
-lto = "thin"
-codegen-units = 1
-strip = true