diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..623fa1c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,57 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + checks: write # Vitest のレポーターが Checks にコメントする場合のみ + +defaults: + run: + working-directory: frontend # 以降は ./frontend がカレント + +concurrency: + group: ci-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + test-build: + runs-on: ubuntu-latest + + strategy: + matrix: + node: [20] # 将来 22 に切り替えたい場合はここを増やす + + steps: + - uses: actions/checkout@v4 + + # ---------- Node ---------- + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + cache: npm + cache-dependency-path: frontend/package-lock.json + + # ---------- Rust (Tauri) ---------- + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + - name: Cache cargo registry + uses: Swatinem/rust-cache@v2 + with: + workspaces: | + src-tauri -> target + + # ---------- Install / Lint / Test ---------- + - run: npm ci + - run: npm run lint # ESlint + - run: npm run typecheck # tsc --noEmit + - run: npm run test # Vitest + - run: npm run test:e2e --if-present # Playwright(オプション) + + # ---------- Build ---------- + - run: npm run build # Vite + Tailwind + # Rust 側のビルド(バイナリを生成するだけで署名/パッケージはしない) + - run: npm run tauri build -- --ci --bundles none diff --git a/frontend/package.json b/frontend/package.json index 48d9cad..e74a1f6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -7,6 +7,7 @@ "dev": "vite", "build": "tsc -b && vite build", "lint": "eslint .", + "typecheck": "tsc --noEmit", "preview": "vite preview", "test": "vitest run", "test:watch": "vitest",