diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0dadad2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,32 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + +permissions: + contents: write + pull-requests: write + packages: write + +# Automatically cancel in-progress actions on the same branch +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Unit Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: "pnpm" + - if: ${{ steps.cache-node.outputs.cache-hit != 'true' }} + run: pnpm install + - run: pnpm run test diff --git a/package.json b/package.json index a93da60..91b2bec 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "build": "turbo run build --no-daemon", "dev": "turbo run dev --no-daemon", "lint": "turbo run lint --no-daemon", - "format": "prettier --write \"**/*.{ts,tsx,md}\"" + "format": "prettier --write \"**/*.{ts,tsx,md}\"", + "test": "turbo run test --filter='./packages/*' --no-daemon" }, "devDependencies": { "eslint": "^8.48.0", diff --git a/packages/cli/package.json b/packages/cli/package.json index b7b7e13..5f04e4e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -15,7 +15,9 @@ "build": "tsup src/index.ts --format cjs,esm --dts", "watch": "pnpm run build --watch", "dev": "pnpm run build --watch", - "test": "vitest" + "test": "vitest run", + "test:watch": "vitest", + "coverage": "vitest run --coverage" }, "devDependencies": { "eslint": "^8.0.0", diff --git a/turbo.json b/turbo.json index 7a9e702..1fda460 100644 --- a/turbo.json +++ b/turbo.json @@ -7,6 +7,7 @@ "outputs": ["dist/**"] }, "lint": {}, + "test": {}, "dev": { "cache": false, "persistent": true