mirror of
https://github.com/Momoko-Ayase/Senbei.git
synced 2026-11-24 02:52:47 +08:00
Add folder scanning, Android library and package recovery, and the localized desktop-style workbench. Keep browser-refused outputs in a fallback ZIP and include logs with folder and ZIP exports. Align the desktop and web modal transitions and polish the desktop About and legal dialogs.
125 lines
4.5 KiB
YAML
125 lines
4.5 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
fmt:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: cargo fmt --all -- --check
|
|
|
|
clippy:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: cargo clippy --workspace --all-targets -- -D warnings
|
|
|
|
test:
|
|
# The test suite exercises Windows path semantics, so it runs on Windows.
|
|
# The golden corpus (samples/) is user-managed and absent on CI; the
|
|
# samples test is a no-op pass there by design.
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: cargo test --release --workspace
|
|
|
|
fuzz-smoke:
|
|
# The libFuzzer targets need nightly and are exercised locally (fuzz/run.sh).
|
|
# This gate only proves the standalone fuzz crate still builds on stable and
|
|
# that the deterministic bounded smoke corpus completes without a panic.
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: cargo check --manifest-path fuzz/Cargo.toml
|
|
- run: cargo run --release --manifest-path fuzz/Cargo.toml --bin smoke
|
|
|
|
check-portable:
|
|
# Build-only portability gate: non-Windows host and the wasm target the
|
|
# web build uses. Clippy runs here too, not just on Windows: the platform
|
|
# `cfg` branches (the POSIX `localtime_r` path, the non-Windows stubs) are
|
|
# invisible to the Windows clippy job, so without this they are never
|
|
# linted at all.
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: cargo clippy --workspace --all-targets -- -D warnings
|
|
- run: cargo check --workspace --target wasm32-unknown-unknown
|
|
|
|
cli:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: windows-latest
|
|
target: x86_64-pc-windows-msvc
|
|
bin: senbei.exe
|
|
gui_bin: senbei-gui.exe
|
|
- os: ubuntu-latest
|
|
target: x86_64-unknown-linux-gnu
|
|
bin: senbei
|
|
gui_bin: senbei-gui
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: cargo build --release --locked -p senbei-cli -p senbei-gui
|
|
- name: Package senbei-<version>-<target>
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
version=$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2)
|
|
name="senbei-$version-${{ matrix.target }}"
|
|
mkdir -p "stage/$name"
|
|
cp "target/release/${{ matrix.bin }}" "stage/$name/"
|
|
cp "target/release/${{ matrix.gui_bin }}" "stage/$name/"
|
|
cp LICENSE README.md "stage/$name/"
|
|
cp senbei-gui/assets/fonts/OFL.txt "stage/$name/ASUL-OFL.txt"
|
|
awk '/^## Legal notice and intended use/{f=1} f && /^## / && !/Legal notice/{exit} f' \
|
|
README.md > "stage/$name/LEGAL-NOTICE.md"
|
|
echo "package=$name" >> "$GITHUB_ENV"
|
|
# upload-artifact always wraps the upload in its own zip, so the staged
|
|
# directory is uploaded loose — pre-compressing here would nest archives.
|
|
# The download is already <package>.zip with the folder inside.
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.package }}
|
|
path: stage/
|
|
if-no-files-found: error
|
|
retention-days: 14
|
|
|
|
web:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '24'
|
|
- run: npm test --prefix web
|
|
- run: cargo install wasm-pack --locked
|
|
# `-- --locked` forwards to cargo: senbei-wasm/Cargo.lock is committed on
|
|
# purpose, so the wasm build must be pinned by it rather than silently
|
|
# re-resolving (which is how it drifted out of sync with the manifest).
|
|
# --out-dir emits the JS/wasm package into the static frontend's web/pkg/.
|
|
- run: wasm-pack build --target web --release --out-dir ../web/pkg -- --locked
|
|
working-directory: senbei-wasm
|
|
- name: Build Node bindings for native/WASM parity
|
|
run: wasm-pack build --target nodejs --release --out-dir ../target/wasm-parity/pkg -- --locked
|
|
working-directory: senbei-wasm
|
|
- name: Compare synthetic native and WASM transforms
|
|
run: cargo test --release -p senbei-cli --test wasm_parity
|
|
env:
|
|
SENBEI_WASM_PARITY: '1'
|
|
- name: Stage static site
|
|
run: node web/tools/stage.mjs dist
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: senbei-web
|
|
path: dist/
|
|
if-no-files-found: error
|
|
retention-days: 14
|