Skip to content

Commit a7a0af4

Browse files
authored
Merge pull request #1 from ionic-team/sp/ci
chore(ci): unit test workflow
2 parents da1e2c6 + 82933fc commit a7a0af4

File tree

4 files changed

+38
-2
lines changed

4 files changed

+38
-2
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
packages: write
13+
14+
# Automatically cancel in-progress actions on the same branch
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
test:
21+
name: Unit Test
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v3
25+
- uses: pnpm/action-setup@v2
26+
- uses: actions/setup-node@v3
27+
with:
28+
node-version: 18
29+
cache: "pnpm"
30+
- if: ${{ steps.cache-node.outputs.cache-hit != 'true' }}
31+
run: pnpm install
32+
- run: pnpm run test

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"build": "turbo run build --no-daemon",
55
"dev": "turbo run dev --no-daemon",
66
"lint": "turbo run lint --no-daemon",
7-
"format": "prettier --write \"**/*.{ts,tsx,md}\""
7+
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
8+
"test": "turbo run test --filter='./packages/*' --no-daemon"
89
},
910
"devDependencies": {
1011
"eslint": "^8.48.0",

packages/cli/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"build": "tsup src/index.ts --format cjs,esm --dts",
1616
"watch": "pnpm run build --watch",
1717
"dev": "pnpm run build --watch",
18-
"test": "vitest"
18+
"test": "vitest run",
19+
"test:watch": "vitest",
20+
"coverage": "vitest run --coverage"
1921
},
2022
"devDependencies": {
2123
"eslint": "^8.0.0",

turbo.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"outputs": ["dist/**"]
88
},
99
"lint": {},
10+
"test": {},
1011
"dev": {
1112
"cache": false,
1213
"persistent": true

0 commit comments

Comments
 (0)