Skip to content

Feature/windows portable #4

Feature/windows portable

Feature/windows portable #4

Workflow file for this run

name: CI Rust
on:
push:
branches: [main]
paths:
- '.github/workflows/rust-ci.yml'
- '.github/actions/install-tauri-deps/**'
- 'src-tauri/**'
pull_request:
branches: [main]
paths:
- '.github/workflows/rust-ci.yml'
- '.github/actions/install-tauri-deps/**'
- 'src-tauri/**'
jobs:
lint:
name: 'Lint'
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
TAURI_SKIP_UPDATE_CHECK: 1
CARGO_TARGET_DIR: src-tauri/target
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js for isolation build
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Build isolation frontend
run: |
npm ci
npm run build:isolation
- name: Install system dependencies for Tauri
uses: ./.github/actions/install-tauri-deps
- name: Cache Rust registry
if: ${{ github.event_name == 'push' }}
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('src-tauri/Cargo.toml') }}
- name: Cache Rust build artifacts
if: ${{ github.event_name == 'push' }}
uses: actions/cache@v4
with:
path: src-tauri/target
key: ${{ runner.os }}-cargo-target-${{ hashFiles('src-tauri/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-target-
- name: Set up Rust toolchain (nightly + Clippy)
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy,rustfmt
- name: Run clippy
run: cargo clippy --manifest-path=src-tauri/Cargo.toml --all-features --all-targets -- -D warnings
- name: Run cargo fmt
run: cargo fmt --manifest-path=src-tauri/Cargo.toml --all -- --check
unit-tests:
name: 'Unit Tests'
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
TAURI_SKIP_UPDATE_CHECK: 1
CARGO_TARGET_DIR: src-tauri/target
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js for isolation build
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Build isolation frontend
run: |
npm ci
npm run build:isolation
- name: Install system dependencies for Tauri
uses: ./.github/actions/install-tauri-deps
- name: Cache Rust registry
if: ${{ github.event_name == 'push' }}
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('src-tauri/Cargo.toml') }}
- name: Cache Rust build artifacts
if: ${{ github.event_name == 'push' }}
uses: actions/cache@v4
with:
path: src-tauri/target
key: ${{ runner.os }}-cargo-target-${{ hashFiles('src-tauri/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-target-
- name: Set up Rust toolchain (nightly + LLVM tools)
uses: dtolnay/rust-toolchain@nightly
with:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov --locked
- name: Generate Rust coverage
run: |
mkdir -p coverage/rust
cargo llvm-cov --manifest-path=src-tauri/Cargo.toml --lcov --output-path=coverage/rust/lcov.info --remap-path-prefix --all-features --all-targets
- name: Upload Rust coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: coverage/rust/lcov.info
flags: rust-units
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true