From c9634f58b1dcc78a4e1dc1cf05c451515b3b1b7a Mon Sep 17 00:00:00 2001 From: Sean Perkins Date: Fri, 22 Sep 2023 13:35:50 -0400 Subject: [PATCH 1/2] chore(ci): unit test workflow --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++++++++++ package.json | 3 ++- packages/cli/package.json | 4 +++- turbo.json | 1 + 4 files changed, 38 insertions(+), 2 deletions(-) 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..a9d3e5a --- /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 From 82933fc09fb34c7c077a7427f49b5a667d7dc61e Mon Sep 17 00:00:00 2001 From: Sean Perkins Date: Fri, 22 Sep 2023 13:36:37 -0400 Subject: [PATCH 2/2] chore: yml formatting --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9d3e5a..0dadad2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ on: push: branches: - main - pull_request: + pull_request: permissions: contents: write