-
Notifications
You must be signed in to change notification settings - Fork 0
ci: add GitHub Actions workflow with split lint/type/build/test jobs #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
349537b
7948ba4
7293995
351b1fc
74e2eff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,238 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: [main] | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: ci-${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||
|
|
||
| env: | ||
| NODE_VERSION: "20" | ||
| PYTHON_VERSION: "3.12" | ||
| RUST_TOOLCHAIN: "stable" | ||
|
|
||
| jobs: | ||
| # ---------- Lint ---------- | ||
| lint-ts: | ||
| name: Lint (TypeScript) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: npm | ||
| - run: npm ci | ||
| - run: npm run lint | ||
| - run: npx prettier --check "src/**/*.{ts,tsx,css,json}" | ||
|
|
||
| lint-rust: | ||
| name: Lint (Rust) | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: src-tauri | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: rustfmt, clippy | ||
| - uses: Swatinem/rust-cache@v2 | ||
| with: | ||
| workspaces: src-tauri | ||
| - name: Install Tauri system deps | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y \ | ||
| libwebkit2gtk-4.1-dev \ | ||
| libappindicator3-dev \ | ||
| librsvg2-dev \ | ||
| patchelf \ | ||
| libgtk-3-dev \ | ||
| libsoup-3.0-dev \ | ||
| libjavascriptcoregtk-4.1-dev | ||
| - run: cargo fmt --all -- --check | ||
| - run: cargo clippy --all-targets -- -D warnings | ||
|
|
||
| lint-python: | ||
| name: Lint (Python) | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: python | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: astral-sh/setup-uv@v3 | ||
| with: | ||
| enable-cache: true | ||
| cache-dependency-glob: python/uv.lock | ||
| - run: uv sync --extra dev | ||
| - run: uv run ruff check . | ||
| - run: uv run black --check . | ||
|
|
||
| # ---------- Type check ---------- | ||
| typecheck-ts: | ||
| name: Typecheck (TypeScript) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: npm | ||
| - run: npm ci | ||
| - run: npx tsc -b | ||
|
|
||
| typecheck-python: | ||
| name: Typecheck (Python) | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: python | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: astral-sh/setup-uv@v3 | ||
| with: | ||
| enable-cache: true | ||
| cache-dependency-glob: python/uv.lock | ||
| - run: uv sync --extra dev | ||
| # mortal は torch 依存のため CI では除外 | ||
| - run: uv run mypy recognition common | ||
|
|
||
| # ---------- Build ---------- | ||
| build-web: | ||
| name: Build (Web) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: npm | ||
| - run: npm ci | ||
| - run: npm run build | ||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: web-dist | ||
| path: dist | ||
| retention-days: 7 | ||
|
|
||
| build-rust-check: | ||
| name: Build (Rust check) | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: src-tauri | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| - uses: Swatinem/rust-cache@v2 | ||
| with: | ||
| workspaces: src-tauri | ||
| - name: Install Tauri system deps | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y \ | ||
| libwebkit2gtk-4.1-dev \ | ||
| libappindicator3-dev \ | ||
| librsvg2-dev \ | ||
| patchelf \ | ||
| libgtk-3-dev \ | ||
| libsoup-3.0-dev \ | ||
| libjavascriptcoregtk-4.1-dev | ||
| - run: cargo check --all-targets | ||
|
|
||
| build-tauri: | ||
| name: Build (Tauri ${{ matrix.platform.name }}) | ||
| # PR では実行しない (cargo check で代替)。main push か手動のみ。 | ||
| if: github.event_name != 'pull_request' | ||
| needs: [build-web, build-rust-check] | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| platform: | ||
| - { name: linux, os: ubuntu-latest } | ||
| - { name: macos, os: macos-latest } | ||
| - { name: windows, os: windows-latest } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
| runs-on: ${{ matrix.platform.os }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: npm | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| - uses: Swatinem/rust-cache@v2 | ||
| with: | ||
| workspaces: src-tauri | ||
| - name: Install Tauri system deps (Linux) | ||
| if: matrix.platform.name == 'linux' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y \ | ||
| libwebkit2gtk-4.1-dev \ | ||
| libappindicator3-dev \ | ||
| librsvg2-dev \ | ||
| patchelf \ | ||
| libgtk-3-dev \ | ||
| libsoup-3.0-dev \ | ||
| libjavascriptcoregtk-4.1-dev | ||
| - run: npm ci | ||
| - run: npm run tauri:build | ||
|
|
||
| # ---------- Test ---------- | ||
| test-ts: | ||
| name: Test (TypeScript / Vitest) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: npm | ||
| - run: npm ci | ||
| - run: npm test | ||
|
|
||
| test-rust: | ||
| name: Test (Rust / cargo test) | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: src-tauri | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| - uses: Swatinem/rust-cache@v2 | ||
| with: | ||
| workspaces: src-tauri | ||
| - name: Install Tauri system deps | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y \ | ||
| libwebkit2gtk-4.1-dev \ | ||
| libappindicator3-dev \ | ||
| librsvg2-dev \ | ||
| patchelf \ | ||
| libgtk-3-dev \ | ||
| libsoup-3.0-dev \ | ||
| libjavascriptcoregtk-4.1-dev | ||
| - run: cargo test --all-targets | ||
|
|
||
| test-python: | ||
| name: Test (Python / pytest) | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: python | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: astral-sh/setup-uv@v3 | ||
| with: | ||
|
Comment on lines
+24
to
+217
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# 目的: SHA pin されていない uses を一覧化して確認
# 期待: 未pin の行が出力される(修正後は 0 件)
rg -nP '^\s*-\s*uses:\s*[^@\s]+@(?!(?:[a-f0-9]{40})\b)[^\s]+' .github/workflows/ci.ymlRepository: otomatty/jantama-ai Length of output: 1191
21 個の 修正例- - uses: actions/checkout@v4
+ - uses: actions/checkout@eef61447b9ff4aafe5dcd72e0e56e3c9bc5e221a
- - uses: dtolnay/rust-toolchain@stable
+ - uses: dtolnay/rust-toolchain@1482605bfc5719ff41411a05e6243f3e87da7365a🧰 Tools🪛 YAMLlint (1.38.0)[error] 158-158: too many spaces inside braces (braces) [error] 158-158: too many spaces inside braces (braces) [error] 159-159: too many spaces inside braces (braces) [error] 159-159: too many spaces inside braces (braces) [error] 160-160: too many spaces inside braces (braces) [error] 160-160: too many spaces inside braces (braces) 🤖 Prompt for AI Agents |
||
| enable-cache: true | ||
| cache-dependency-glob: python/uv.lock | ||
| - run: uv sync --extra dev | ||
| - run: uv run pytest -q | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ dist-ssr/ | |
| .parcel-cache/ | ||
| .turbo/ | ||
| *.local | ||
| *.tsbuildinfo | ||
|
|
||
| # Testing | ||
| coverage/ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import js from "@eslint/js"; | ||
| import globals from "globals"; | ||
| import tseslint from "typescript-eslint"; | ||
| import reactHooks from "eslint-plugin-react-hooks"; | ||
| import reactRefresh from "eslint-plugin-react-refresh"; | ||
|
|
||
| export default tseslint.config( | ||
| { | ||
| ignores: [ | ||
| "dist", | ||
| "src-tauri/target", | ||
| "node_modules", | ||
| "vite.config.ts", | ||
| "eslint.config.js", | ||
| "scripts", | ||
| ], | ||
| }, | ||
| js.configs.recommended, | ||
| ...tseslint.configs.recommended, | ||
| { | ||
| files: ["src/**/*.{ts,tsx}"], | ||
| languageOptions: { | ||
| ecmaVersion: 2022, | ||
| sourceType: "module", | ||
| globals: { | ||
| ...globals.browser, | ||
| ...globals.node, | ||
| }, | ||
| parserOptions: { | ||
| project: "./tsconfig.json", | ||
| tsconfigRootDir: import.meta.dirname, | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| }, | ||
| }, | ||
| plugins: { | ||
| "react-hooks": reactHooks, | ||
| "react-refresh": reactRefresh, | ||
| }, | ||
| rules: { | ||
| ...reactHooks.configs.recommended.rules, | ||
| "react-refresh/only-export-components": [ | ||
| "warn", | ||
| { allowConstantExport: true }, | ||
| ], | ||
| "@typescript-eslint/no-unused-vars": [ | ||
| "warn", | ||
| { argsIgnorePattern: "^_" }, | ||
| ], | ||
| }, | ||
| }, | ||
| ); | ||
Uh oh!
There was an error while loading. Please reload this page.