From 8ea58e066c0f72cc8b991c0ec994523f2268a3ff Mon Sep 17 00:00:00 2001 From: yosipy Date: Sun, 28 Jul 2024 02:16:57 +0900 Subject: [PATCH] Add test command and ci settings --- .github/workflows/ci.yml | 31 +++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 32 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f4cf3c2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,31 @@ +name: CI + +on: + push: + +jobs: + ts-test: + name: TS Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: "20" + - name: Cache node modules + uses: actions/cache@v4 + id: node_modules_cache_id + env: + cache-name: cache-node-modules + with: + path: ./node_modules + key: ${{ runner.os }}-npm-${{ env.cache-name }}-${{ hashFiles('./package-lock.json') }} + - name: npm ci + if: ${{ steps.node_modules_cache_id.outputs.cache-hit != 'true' }} + run: | + npm ci + - name: Run test + run: | + npm run test + - name: Run build + run: npm run build diff --git a/package.json b/package.json index cfe08c9..c093a82 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "build": "vite build && tsc -p tsconfig.package.json", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview", + "test": "vitest", "docs:dev": "vitepress dev docs --host 0.0.0.0", "docs:build": "vitepress build docs", "docs:preview": "vitepress preview docs"