Skip to content

Merge pull request #2156 from CapSoftware/codex/cursor-styles-and-fra… #8202

Merge pull request #2156 from CapSoftware/codex/cursor-styles-and-fra…

Merge pull request #2156 from CapSoftware/codex/cursor-styles-and-fra… #8202

Workflow file for this run

name: "CI"
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
changes:
name: Detect Changes
runs-on: ubuntu-latest
outputs:
desktop: ${{ steps.filter.outputs.desktop }}
rust: ${{ steps.filter.outputs.rust }}
tauri-plugins: ${{ steps.filter.outputs.tauri-plugins }}
branch: ${{ steps.branch.outputs.branch }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check for changes
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
desktop:
- '.github/actions/install-desktop-deps/**'
- '.github/workflows/ci.yml'
- 'apps/cli/**'
- 'apps/desktop/**'
- 'apps/desktop-gpui/**'
- 'crates/**'
- 'packages/database/**'
- 'packages/ui-solid/**'
- 'packages/utils/**'
- 'packages/web-api-contract/**'
- 'scripts/build-desktop-binaries*'
- 'scripts/build-gpui-binary.sh'
- 'scripts/prepare-gpui-dependency.sh'
- 'scripts/run-gpui-build*'
- 'scripts/sync-desktop-versions.mjs'
- 'scripts/verify-gpui-release-inputs.mjs'
- 'Cargo.toml'
- 'Cargo.lock'
- 'pnpm-lock.yaml'
rust:
- '.cargo/**'
- '.github/**'
- 'apps/cli/**'
- 'apps/desktop-gpui/**'
- 'crates/**'
- 'apps/desktop/src-tauri/**'
- 'Cargo.toml'
- 'Cargo.lock'
tauri-plugins:
- 'Cargo.lock'
- 'pnpm-lock.yaml'
- name: Output branch name
id: branch
run: |
echo "branch=${{ env.BRANCH_NAME }}" >> $GITHUB_OUTPUT
typecheck:
name: Typecheck
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ./.github/actions/setup-js
- run: pnpm web exec next typegen
- name: Typecheck
run: pnpm typecheck
mobile:
name: Mobile
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ./.github/actions/setup-js
- name: Check Expo dependencies
env:
EXPO_OFFLINE: "1"
run: pnpm --dir apps/mobile exec expo install --check
- name: Run Expo Doctor
env:
EXPO_OFFLINE: "1"
working-directory: apps/mobile
run: pnpm dlx expo-doctor@1.20.1
- name: Typecheck
run: pnpm --dir apps/mobile typecheck
- name: Test
run: pnpm --dir apps/mobile test
format-biome:
name: Format (Biome)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Biome
uses: biomejs/setup-biome@v2
with:
# Don't use `latest` as Biome throws an error when it doesn't match the
# schema version in the config file.
version: 2.2.0
- name: Run Biome
run: biome ci . --linter-enabled=false
format-rust:
name: Format (Cargo)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.88.0
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --check
clippy:
name: Clippy
needs: changes
if: needs.changes.outputs.rust == 'true'
strategy:
fail-fast: false
matrix:
settings:
- target: aarch64-apple-darwin
runner: macos-latest
- target: x86_64-pc-windows-msvc
runner: windows-2022
runs-on: ${{ matrix.settings.runner }}
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Rust setup
uses: dtolnay/rust-toolchain@1.88.0
with:
targets: ${{ matrix.settings.target }}
components: clippy
- uses: ./.github/actions/setup-rust-cache
with:
target: ${{ matrix.settings.target }}
- name: Create .env file in root
run: |
echo "VITE_ENVIRONMENT=production" >> .env
echo "CAP_DESKTOP_SENTRY_URL=https://6a3b6a09e6ae976c2ad6fff710e88748@o4506859771527168.ingest.us.sentry.io/4508330917101568" >> .env
echo "NEXT_PUBLIC_WEB_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}" >> .env
echo 'NEXTAUTH_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}' >> .env
echo 'VITE_OPENPANEL_CLIENT_ID=${{ secrets.VITE_OPENPANEL_CLIENT_ID }}' >> .env
echo 'VITE_OPENPANEL_API_URL=${{ secrets.VITE_OPENPANEL_API_URL }}' >> .env
echo 'VITE_SERVER_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}' >> .env
cat .env >> $GITHUB_ENV
- name: Run setup
shell: bash
run: node scripts/setup.js
- name: Test desktop installation and storage helpers
shell: bash
run: cargo test --locked -p cap-utils -p cap-cli-install --lib
- name: Build desktop binaries
shell: bash
run: ./scripts/build-desktop-binaries.sh ${{ matrix.settings.target }}
- name: Run Clippy
run: cargo clippy --workspace --all-features --locked -- -D warnings
lint-biome:
name: Lint (Biome)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Biome
uses: biomejs/setup-biome@v2
with:
version: latest
- name: Run Biome
run: biome ci . || true
build-desktop:
name: Build Desktop
needs: changes
if: needs.changes.outputs.desktop == 'true'
strategy:
fail-fast: false
matrix:
settings:
- target: aarch64-apple-darwin
runner: macos-latest
- target: x86_64-pc-windows-msvc
runner: windows-2022
- target: x86_64-unknown-linux-gnu
runner: ubuntu-24.04
runs-on: ${{ matrix.settings.runner }}
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Linux desktop dependencies
if: ${{ runner.os == 'Linux' }}
uses: ./.github/actions/install-desktop-deps
- name: Rust setup
uses: dtolnay/rust-toolchain@1.88.0
with:
targets: ${{ matrix.settings.target }}
- uses: ./.github/actions/setup-rust-cache
with:
target: ${{ matrix.settings.target }}
- uses: ./.github/actions/setup-js
- name: Create .env file in root
run: |
echo "VITE_ENVIRONMENT=production" >> .env
echo "CAP_DESKTOP_SENTRY_URL=https://6a3b6a09e6ae976c2ad6fff710e88748@o4506859771527168.ingest.us.sentry.io/4508330917101568" >> .env
echo "NEXT_PUBLIC_WEB_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}" >> .env
echo 'NEXTAUTH_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}' >> .env
echo 'VITE_OPENPANEL_CLIENT_ID=${{ secrets.VITE_OPENPANEL_CLIENT_ID }}' >> .env
echo 'VITE_OPENPANEL_API_URL=${{ secrets.VITE_OPENPANEL_API_URL }}' >> .env
echo 'VITE_SERVER_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}' >> .env
- name: Copy .env to apps/desktop
run: cp .env apps/desktop/.env
- name: Output .env file
run: cat apps/desktop/.env
- name: Run cap-setup
shell: bash
run: pnpm -w cap-setup
env:
RUST_TARGET_TRIPLE: ${{ matrix.settings.target }}
- name: Build desktop binaries
shell: bash
run: ./scripts/build-desktop-binaries.sh ${{ matrix.settings.target }}
- name: Test Linux desktop regressions
if: ${{ runner.os == 'Linux' }}
shell: bash
run: |
node --test scripts/linux-bundle-config.test.mjs scripts/finalize-linux-appimage.test.mjs
pnpm --dir apps/desktop exec vitest run scripts/prepare.test.js
cargo test --locked -p cap-utils -p cap-cli-install --lib
cargo test --locked -p cap --bin cap record::tests
cargo test --locked -p cap-recording --lib
cargo test --locked -p cap-enc-ffmpeg
env:
LD_LIBRARY_PATH: ${{ format('{0}/target/native-deps/lib:{0}/target/debug:{0}/target/{1}/debug', github.workspace, matrix.settings.target) }}
- name: Build GPUI desktop
shell: bash
run: ./scripts/build-gpui-binary.sh debug ${{ matrix.settings.target }}
- name: Test GPUI desktop
shell: bash
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
export PATH="$(cygpath "$GITHUB_WORKSPACE/target/debug"):$PATH"
elif [[ "$RUNNER_OS" == "macOS" ]]; then
frameworks="$GITHUB_WORKSPACE/apps/desktop-gpui/target/${{ matrix.settings.target }}/debug/Frameworks"
mkdir -p "$frameworks"
ln -sfn "$GITHUB_WORKSPACE/target/Frameworks/Spacedrive.framework" "$frameworks/Spacedrive.framework"
elif [[ "$RUNNER_OS" == "Linux" ]]; then
export LD_LIBRARY_PATH="$GITHUB_WORKSPACE/target/native-deps/lib:$GITHUB_WORKSPACE/target/debug:$GITHUB_WORKSPACE/target/${{ matrix.settings.target }}/debug${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
fi
if [[ "$RUNNER_OS" == "Linux" ]]; then
xvfb-run -a --server-args="-screen 0 1920x1080x24 -noreset" \
cargo +1.95.0 test --manifest-path apps/desktop-gpui/Cargo.toml --locked --target ${{ matrix.settings.target }} --bin cap-gpui
else
cargo +1.95.0 test --manifest-path apps/desktop-gpui/Cargo.toml --locked --target ${{ matrix.settings.target }} --bin cap-gpui
fi
- name: Build app
working-directory: apps/desktop
run: pnpm tauri build --debug --target ${{ matrix.settings.target }} --no-bundle
env:
LD_LIBRARY_PATH: ${{ runner.os == 'Linux' && format('{0}/target/native-deps/lib:{0}/target/debug:{0}/target/{1}/debug', github.workspace, matrix.settings.target) || '' }}
RUST_TARGET_TRIPLE: ${{ matrix.settings.target }}
tauri-plugins:
name: Verify Tauri plugin versions
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.tauri-plugins == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
- name: Run verify
shell: bash
run: node scripts/check-tauri-plugin-versions.js
rust-cache:
name: Rust cache
needs: changes
if: needs.changes.outputs.branch == 'main'
strategy:
fail-fast: false
matrix:
settings:
- target: x86_64-apple-darwin
runner: macos-latest
- target: aarch64-apple-darwin
runner: macos-latest
- target: x86_64-pc-windows-msvc
runner: windows-2022
runs-on: ${{ matrix.settings.runner }}
env:
RUST_TARGET_TRIPLE: ${{ matrix.settings.target }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Rust setup
uses: dtolnay/rust-toolchain@1.88.0
with:
targets: ${{ matrix.settings.target }}
- uses: ./.github/actions/setup-rust-cache
with:
target: ${{ matrix.settings.target }}
save-cache: true
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 24
- run: node scripts/setup.js
- name: Build desktop binaries
shell: bash
run: ./scripts/build-desktop-binaries.sh ${{ matrix.settings.target }}
- name: Build debug
run: cargo build --all --target ${{ matrix.settings.target }}
- name: Build release
run: cargo check --all --release --target ${{ matrix.settings.target }}
- name: Run Clippy
if: ${{ matrix.settings.target == 'aarch64-apple-darwin' || matrix.settings.target == 'x86_64-pc-windows-msvc' }}
run: cargo clippy --workspace --all-features --locked --target ${{ matrix.settings.target }} -- -D warnings