Skip to content

Commit

Permalink
ci: 添加 Github Action
Browse files Browse the repository at this point in the history
  • Loading branch information
LokiSharp committed Oct 14, 2023
1 parent 6124122 commit dc554b8
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
28 changes: 28 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI

on:
push:
branches: ["master", "dev", "releases/**"]
pull_request:
branches: ["master"]

jobs:
build:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
node-version: [16.x, 18.x, 20.x, latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run lint
- run: npm run build
- run: npm run test
4 changes: 2 additions & 2 deletions common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx",
"test": "jest",
"coverage": "jest --coverage"
"test": "jest --forceExit",
"coverage": "jest --forceExit --coverage"
},
"devDependencies": {
"@types/jest": "^29.5.5",
Expand Down
4 changes: 2 additions & 2 deletions driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx",
"test": "jest",
"coverage": "jest --coverage"
"test": "jest --forceExit",
"coverage": "jest --forceExit --coverage"
},
"devDependencies": {
"@types/jest": "^29.5.5",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"test": "npm run test --workspaces",
"bulid": "npm run build --workspaces",
"build": "npm run build --workspaces",
"lint": "npm run lint --workspaces"
},
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx",
"test": "jest",
"coverage": "jest --coverage"
"test": "jest --forceExit",
"coverage": "jest --forceExit --coverage"
},
"_moduleAliases": {
"@": "src"
Expand Down
5 changes: 2 additions & 3 deletions storage/tests/DataBase.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ let db: DataBase;

beforeAll(() => {
process.env = { ...OLD_ENV }; // Make a copy
process.env.DB_PATH = "tmp/db.json";
fs.mkdir("tmp", { recursive: true });
process.env.DB_PATH = "db.json";
});

beforeEach(() => {
Expand All @@ -19,7 +18,7 @@ beforeEach(() => {

afterAll(() => {
process.env = OLD_ENV; // Restore old environment
fs.rm("tmp", { recursive: true, force: true });
fs.rm("db.json", { recursive: true, force: true });
});

test("DataBase", () => {
Expand Down

0 comments on commit dc554b8

Please sign in to comment.