mirror of
https://github.com/storytold/craft-anything.git
synced 2026-11-05 20:47:45 +01:00
f64ae3bf3c
A native, pure-Rust app that shows anyone how a piece of software works, with evidence-backed answers, then helps them rebuild it. It ships a desktop app, a CLI and an MCP server, all driven by one engine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
100 lines
3.5 KiB
YAML
100 lines
3.5 KiB
YAML
# CI for pull requests and main: format, clippy, tests, dependency layering, the tool list and
|
|
# the wasm32 check (the same gates as `cargo xtask ci`). Linux only: macOS is built and tested only
|
|
# by release.yml (the org's macOS runners are kept for releases; craftrules release/playbook.md),
|
|
# and Windows/FreeBSD packaging have their own workflows.
|
|
name: CI
|
|
|
|
# Every pull request and every push to main, once the repository is public (GitHub-hosted runners
|
|
# are free for public repositories; while it's private, the jobs below are skipped unless started by
|
|
# hand, so they cost nothing).
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
CARGO_INCREMENTAL: 0
|
|
RUST_BACKTRACE: 1
|
|
# Debug and test builds keep line tables (file:line in panic backtraces) but drop the rest of the
|
|
# debug info: faster codegen and links, and a smaller target dir.
|
|
CARGO_PROFILE_DEV_DEBUG: line-tables-only
|
|
|
|
# A newer push to a PR branch cancels its older run. Runs on main are never cancelled, so every
|
|
# main state that gets a run is checked to the end.
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
jobs:
|
|
test:
|
|
name: test (ubuntu-latest)
|
|
if: github.event_name == 'workflow_dispatch' || !github.event.repository.private
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Linux system dependencies (egui/winit/rfd)
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends \
|
|
libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev \
|
|
libgl1-mesa-dev libgtk-3-dev
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: clippy, rustfmt
|
|
|
|
# Only main saves caches; PRs restore main's, so PR caches don't evict main's.
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
|
cache-on-failure: true
|
|
|
|
- name: Format
|
|
run: cargo fmt --all -- --check
|
|
|
|
- name: Clippy
|
|
run: cargo clippy --workspace --all-targets --locked -- -D warnings
|
|
|
|
# Every crate's tests run even when one fails, so one failure can't hide another.
|
|
- name: Test
|
|
run: cargo test --workspace --locked --no-fail-fast
|
|
|
|
- name: Dependency layering
|
|
run: cargo run --locked -q -p xtask -- layers
|
|
|
|
- name: Tool list
|
|
run: cargo run --locked -q -p xtask -- tools --check
|
|
|
|
- name: Generated schemas
|
|
run: cargo run --locked -q -p xtask -- schemas --check
|
|
|
|
# No keys, tokens, private keys or local paths in what would be committed.
|
|
- name: Secret scan
|
|
run: cargo run --locked -q -p xtask -- secrets
|
|
|
|
wasm:
|
|
name: wasm32 check
|
|
if: github.event_name == 'workflow_dispatch' || !github.event.repository.private
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: wasm32-unknown-unknown
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
key: wasm32
|
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
|
cache-on-failure: true
|
|
# The L0-L2 analysis crates and apps/craft-anything-web must keep compiling for the browser.
|
|
- name: Check wasm-safe crates
|
|
run: cargo run --locked -q -p xtask -- wasm
|
|
- name: Check the web app
|
|
run: cargo check --locked --target wasm32-unknown-unknown -p craft-anything-web
|