Files
2026-02-04 10:33:30 +01:00

154 lines
4.2 KiB
YAML
Vendored

name: Quality & Testing
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
workflow_dispatch:
env:
NODE_VERSION: "22"
PNPM_VERSION: "10.26.2"
permissions:
actions: write
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
auto-format:
name: Auto-fix Formatting
runs-on: ubuntu-latest
if: github.event_name == 'push'
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Development Environment
uses: ./.github/actions/setup-env
with:
mode: node
- name: Auto-fix Prettier formatting
run: npx prettier --write . --ignore-unknown --cache
- name: Auto-fix Rust formatting
run: cargo fmt --all --manifest-path src-tauri/Cargo.toml
- name: Commit formatting fixes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
if ! git diff --staged --quiet; then
git commit -m "Auto-fix formatting issues"
git push
else
echo "No formatting changes to commit"
fi
rust-quality:
name: Rust Code Quality
runs-on: ubuntu-latest
strategy:
fail-fast: false
defaults:
run:
shell: bash
working-directory: src-tauri
steps:
- uses: actions/checkout@v6
- name: Setup Rust Environment
uses: ./.github/actions/setup-env
with:
mode: build
- name: Install Rust components
shell: bash
run: rustup component add rustfmt clippy
- uses: rui314/setup-mold@v1
- name: Cache cargo-hack
uses: actions/cache@v5
id: cargo-hack-cache
with:
path: ~/.cargo/bin/cargo-hack
key: ${{ runner.os }}-cargo-hack-${{ hashFiles('~/.cargo/bin/cargo-hack') }}
restore-keys: |
${{ runner.os }}-cargo-hack-
- name: Install cargo-hack
if: steps.cargo-hack-cache.outputs.cache-hit != 'true'
run: cargo install cargo-hack --force
- name: Check Rust formatting
run: cargo fmt --all -- --color=always --check
- name: Run Clippy lints
run: cargo hack --feature-powerset --exclude-features cli-build --no-dev-deps clippy # cspell:disable-line
validation:
name: CLI & Build Validation (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Build Environment
uses: ./.github/actions/setup-env
with:
mode: build
- name: Build CLI
run: pnpm run cli:build
- name: Run CI Test Suite
run: pnpm test
timeout-minutes: 30
env:
CI: true
NODE_ENV: test
- name: Test CLI Integration
shell: bash
run: |
echo "Testing CLI integration..."
if [[ "$RUNNER_OS" == "Windows" ]]; then
timeout 60s PAKE_CREATE_APP=1 node dist/cli.js https://weekly.tw93.fun --name "CITest" --debug --iterative-build || true
else
timeout 30s PAKE_CREATE_APP=1 node dist/cli.js https://weekly.tw93.fun --name "CITest" --debug --iterative-build || true
fi
summary:
name: Quality Summary
runs-on: ubuntu-latest
needs: [auto-format, rust-quality, validation]
if: always()
steps:
- name: Generate Summary
run: |
{
echo "# Quality & Testing Summary"
echo ""
echo "| Check | Status |"
echo "|-------|--------|"
echo "| Auto Formatting | ${{ needs.auto-format.result == 'success' && 'PASSED' || needs.auto-format.result == 'skipped' && 'SKIPPED' || 'FAILED' }} |"
echo "| Rust Quality | ${{ needs.rust-quality.result == 'success' && 'PASSED' || 'FAILED' }} |"
echo "| CLI & Build Validation | ${{ needs.validation.result == 'success' && 'PASSED' || 'FAILED' }} |"
} >> $GITHUB_STEP_SUMMARY