GitComet/.github/workflows/rust.yml
2026-03-17 17:01:25 +02:00

225 lines
8.7 KiB
YAML

name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: "0 4 * * 1"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: rust-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
# Build gitcomet in headless mode (no GPUI system deps required).
# The UI-only code paths are behind #[cfg(feature = "ui-gpui")] guards.
APP_FEATURES: "--no-default-features --features gix"
jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all --check
audit:
name: Dependency audit (cargo-audit)
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Install cargo-audit
run: cargo install cargo-audit --locked
- name: Run cargo-audit
run: |
cargo audit --deny warnings \
--ignore RUSTSEC-2025-0052 \
--ignore RUSTSEC-2024-0384 \
--ignore RUSTSEC-2024-0436 \
--ignore RUSTSEC-2025-0134
clippy:
name: Clippy
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Clippy (core + state + git backends)
run: cargo clippy -p gitcomet-core -p gitcomet-state -p gitcomet-git -p gitcomet-git-gix -- -D warnings
- name: Clippy (shared UI crate)
run: cargo clippy -p gitcomet-ui -- -D warnings
- name: Clippy (GPUI UI crate -- intentionally skipped on headless CI)
run: |
echo "Skipping cargo clippy -p gitcomet-ui-gpui in this job."
echo "Reason: GPUI requires native windowing/system dependencies that are not available in headless CI."
- name: Clippy (app — headless)
run: cargo clippy -p gitcomet $APP_FEATURES -- -D warnings
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Build (core + state + backend)
run: cargo build -p gitcomet-core -p gitcomet-state -p gitcomet-git-gix --verbose
- name: Build (app — headless)
run: cargo build -p gitcomet $APP_FEATURES --verbose
# Core merge algorithm correctness — Phase 1A/1B/1C portability tests
merge-algorithm:
name: Merge algorithm parity (t6403/t6427)
runs-on: ubuntu-latest
timeout-minutes: 60
needs: build
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: t6403/t6427 merge algorithm portability
run: cargo test -p gitcomet-core --test merge_algorithm --verbose
- name: Conflict label formatting (Phase 1C)
run: cargo test -p gitcomet-core --test conflict_label_formatting --verbose
- name: Meld algorithm parity (Phase 5)
run: cargo test -p gitcomet-core --lib meld_tests --verbose
- name: Core library unit tests
run: cargo test -p gitcomet-core --lib --verbose
- name: State management (conflict session, reducers, effects)
run: cargo test -p gitcomet-state --verbose
# Fixture harness and corpus — Phase 2/3A regression gates
merge-regression:
name: Merge regression suite (fixtures + corpus)
runs-on: ubuntu-latest
timeout-minutes: 60
needs: build
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: KDiff3-style fixture harness (Phase 2)
run: cargo test -p gitcomet-core --test merge_fixture_harness --verbose
- name: Permutation corpus (Phase 3A — 243 sampled cases)
run: cargo test -p gitcomet-core --test merge_permutation_corpus --verbose
- name: Real-world merge extraction (Phase 3C)
run: cargo test -p gitcomet-core --test merge_git_extraction --verbose
# E2E integration with git mergetool/difftool — Phase 4A/4B
tool-integration:
name: Git mergetool/difftool E2E parity
runs-on: ubuntu-latest
timeout-minutes: 60
needs: build
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Build gitcomet binary (headless)
run: cargo build -p gitcomet $APP_FEATURES
- name: Git mergetool E2E (Phase 4A — t7610 parity)
run: cargo test -p gitcomet $APP_FEATURES --test mergetool_git_integration --verbose
- name: Git difftool E2E (Phase 4B — t7800 parity)
run: cargo test -p gitcomet $APP_FEATURES --test difftool_git_integration --verbose
- name: Standalone tool-mode E2E (exit codes + validation)
run: cargo test -p gitcomet $APP_FEATURES --test standalone_tool_mode_integration --verbose
- name: Mergetool/difftool runtime unit tests (bin target)
run: cargo test -p gitcomet $APP_FEATURES --bin gitcomet --verbose
# Backend integration — mergetool launcher, status, conflict checkout
backend-integration:
name: Git backend integration
runs-on: ubuntu-latest
timeout-minutes: 60
needs: build
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Git CLI migration scoreboard
run: cargo test -p gitcomet-git-gix --test git_cli_scoreboard -- --nocapture
- name: Status and mergetool backend integration
run: cargo test -p gitcomet-git-gix --verbose
performance-budgets:
name: Conflict performance budgets (alert-only)
runs-on: ubuntu-latest
# Shared runners are noisy for performance numbers; treat this as signal/alerting only.
continue-on-error: true
timeout-minutes: 60
needs: build
steps:
- uses: actions/checkout@v6
- name: Install Linux UI native dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
pkg-config \
libxcb1-dev \
libxkbcommon-dev \
libxkbcommon-x11-dev
- name: Preflight Linux UI link dependencies
run: |
missing=0
for dep in xcb xkbcommon xkbcommon-x11; do
if ! pkg-config --exists "$dep"; then
echo "::error title=Missing Linux UI dependency::pkg-config could not find '$dep'. Install libxcb1-dev, libxkbcommon-dev, and libxkbcommon-x11-dev."
missing=1
fi
done
if [ "$missing" -ne 0 ]; then
echo "performance-budgets job is missing required native UI link dependencies."
exit 1
fi
pkg-config --modversion xcb xkbcommon xkbcommon-x11
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Benchmark conflict and markdown preview hot paths
run: |
cargo bench -p gitcomet-ui-gpui --features benchmarks --bench performance -- conflict_three_way_scroll/style_window
cargo bench -p gitcomet-ui-gpui --features benchmarks --bench performance -- conflict_two_way_split_scroll/window_200
cargo bench -p gitcomet-ui-gpui --features benchmarks --bench performance -- conflict_search_query_update/window/200
cargo bench -p gitcomet-ui-gpui --features benchmarks --bench performance -- conflict_split_resize_step/window/200
cargo bench -p gitcomet-ui-gpui --features benchmarks --bench performance -- markdown_preview_parse_build/single_document/medium
cargo bench -p gitcomet-ui-gpui --features benchmarks --bench performance -- markdown_preview_parse_build/two_sided_diff/medium
cargo bench -p gitcomet-ui-gpui --features benchmarks --bench performance -- markdown_preview_render_single/window_rows/200
cargo bench -p gitcomet-ui-gpui --features benchmarks --bench performance -- markdown_preview_render_diff/window_rows/200
- name: Emit budget report (alerting mode)
run: cargo run -p gitcomet-ui-gpui --bin perf_budget_report -- --criterion-root target/criterion