ci: 新增 ci 流程配置

pull/41/head
zjx0905 2023-03-23 21:32:18 +08:00
parent d7474504e7
commit 0d9e93a117
4 changed files with 305 additions and 1362 deletions

39
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,39 @@
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7
- name: Set node
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: pnpm
- name: Install
run: pnpm i
- name: Lint
run: pnpm lint
- name: Build
run: pnpm build
- name: Test
run: pnpm test

View File

@ -32,6 +32,7 @@
"cz": "czg", "cz": "czg",
"build": "esno scripts/build.ts", "build": "esno scripts/build.ts",
"release": "esno scripts/release.ts", "release": "esno scripts/release.ts",
"test": "vitest run",
"lint": "eslint --cache .", "lint": "eslint --cache .",
"lint:fix": "pnpm lint --fix", "lint:fix": "pnpm lint --fix",
"postinstall": "simple-git-hooks" "postinstall": "simple-git-hooks"
@ -51,7 +52,6 @@
"enquirer": "^2.3.6", "enquirer": "^2.3.6",
"eslint": "^8.36.0", "eslint": "^8.36.0",
"esno": "^0.16.3", "esno": "^0.16.3",
"jest": "^29.5.0",
"lint-staged": "13.2.0", "lint-staged": "13.2.0",
"minimist": "^1.2.8", "minimist": "^1.2.8",
"prettier": "2.8.5", "prettier": "2.8.5",
@ -62,7 +62,8 @@
"semver": "^7.3.8", "semver": "^7.3.8",
"simple-git-hooks": "^2.8.1", "simple-git-hooks": "^2.8.1",
"typescript": "^5.0.2", "typescript": "^5.0.2",
"vitepress": "1.0.0-alpha.60" "vitepress": "1.0.0-alpha.60",
"vitest": "^0.29.7"
}, },
"simple-git-hooks": { "simple-git-hooks": {
"pre-commit": "pnpm lint-staged", "pre-commit": "pnpm lint-staged",

File diff suppressed because it is too large Load Diff

11
vitest.config.ts Normal file
View File

@ -0,0 +1,11 @@
import { resolve } from 'node:path';
import { defineConfig } from 'vitest/config';
import { __dirname } from './scripts/utils';
export default defineConfig({
test: {
root: resolve(__dirname),
globals: true,
include: ['./test/**/*.test.ts'],
},
});