feat(api): Tool Invoke API + Naga Scoped Token 鉴权系统 (#49) #208
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI Code Quality | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| quality-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Install dependencies | |
| run: uv sync --group ci -p 3.12 | |
| - name: Cache Ruff | |
| uses: actions/cache@v4 | |
| with: | |
| path: .ruff_cache | |
| key: ${{ runner.os }}-ruff-${{ hashFiles('**/uv.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-ruff- | |
| - name: Run Ruff | |
| run: | | |
| uv run ruff check . | |
| uv run ruff format --check . | |
| - name: Cache Mypy | |
| uses: actions/cache@v4 | |
| with: | |
| path: .mypy_cache | |
| key: ${{ runner.os }}-mypy-${{ hashFiles('**/uv.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-mypy- | |
| - name: Run Mypy | |
| run: uv run mypy . | |
| - name: Run Tests | |
| run: uv run pytest tests/ | |
| - name: Build wheel | |
| run: uv build --wheel | |
| - name: Verify wheel contains resources | |
| run: | | |
| uv run python -c "import glob, zipfile; whl=glob.glob('dist/*.whl')[0]; z=zipfile.ZipFile(whl); names=set(z.namelist()); required={'config.toml.example','res/prompts/undefined.xml','img/xlwy.jpg'}; missing=sorted([p for p in required if p not in names]); assert not missing, f'missing in wheel: {missing}'" | |
| console-quality-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Cache npm and node_modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-undefined-console-npm-${{ hashFiles('apps/undefined-console/package-lock.json', 'apps/undefined-console/package.json', 'apps/undefined-console/biome.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-undefined-console-npm- | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo registry and target | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: | | |
| apps/undefined-console/src-tauri -> target | |
| - name: Install Linux system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libwebkit2gtk-4.1-dev \ | |
| libgtk-3-dev \ | |
| libayatana-appindicator3-dev \ | |
| librsvg2-dev \ | |
| patchelf | |
| - name: Install app dependencies | |
| working-directory: apps/undefined-console | |
| run: npm ci | |
| - name: Run console checks | |
| working-directory: apps/undefined-console | |
| run: npm run check |