Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GH action for tests #81

Merged
merged 1 commit into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/vitest-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Run vitest tests

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

env:
NODE_ENV: development
JWT_SECRET_KEY: GITHUB_ACTIONS_DUMMY_SECRET_KEY
DEV_PG_NAME: postgres

jobs:
build:
runs-on: ubuntu-latest

services:
postgres:
image: postgres

env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: postgres

options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: yarn install
- run: yarn build
- run: yarn ci
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"react-dom": "^16.8",
"react-icons": "^5.0.1",
"react-router-dom": "^6.21.1",
"start-server-and-test": "^2.0.1",
"typescript": "^5.3.3",
"ws": "^8.16.0"
},
Expand All @@ -30,27 +29,30 @@
"build:server": "cd ./server && npx tsc",
"build:client": "cd ./client && yarn && npx vite build",
"start": "node server/dist/server/src/server.js",
"ci": "start-server-and-test start http://localhost:3000 ci:test ",
"regen": "rm -rf ./client/node_modules && cd ./client && yarn && npx vite",
"dev:client": "npx vite",
"dev:server": "NODE_ENV=development TEST_PASSWORD=test nodemon --exec ts-node ./server/src/server.ts",
"test": "TEST_PASSWORD=test DEV_PG_NAME=dominion_pg_test vitest run"
"ci:test": "TEST_PASSWORD=test DEV_PG_NAME=postgres vitest --fileParallelism=false run",
"test": "TEST_PASSWORD=test DEV_PG_NAME=dominion_pg_test vitest --fileParallelism=false run"
},
"author": "duckRabbitPy",
"license": "ISC",
"devDependencies": {
"@effect/schema": "^0.64",
"@types/express": "^4.17.20",
"@types/node": "^20.10.6",
"@types/pg": "^8.10.2",
"@types/websocket": "^1.0.10",
"@typescript-eslint/eslint-plugin": "^6.18.0",
"@wll8/express-ws": "^1.0.5",
"@total-typescript/ts-reset": "^0.5.1",
"@types/bcrypt": "^5.0.2",
"@types/cors": "^2.8.17",
"@types/express": "^4.17.20",
"@types/jsonwebtoken": "^9.0.5",
"@types/node": "^20.10.6",
"@types/nodemailer": "^6.4.14",
"@types/pg": "^8.10.2",
"@types/websocket": "^1.0.10",
"@types/ws": "^8.5.10",
"@typescript-eslint/eslint-plugin": "^6.18.0",
"@wll8/express-ws": "^1.0.5",
"start-server-and-test": "^2.0.3",
"ts-node": "^10.9.2",
"typescript": "^5.3.3",
"vitest": "^1.1.3"
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2979,7 +2979,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/stackback/-/stackback-0.0.2.tgz#1ac8a0d9483848d1695e418b6d031a3c3ce68e3b"
integrity sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==

start-server-and-test@^2.0.1:
start-server-and-test@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/start-server-and-test/-/start-server-and-test-2.0.3.tgz#15c53c85e23cba7698b498b8a2598cab95f3f802"
integrity sha512-QsVObjfjFZKJE6CS6bSKNwWZCKBG6975/jKRPPGFfFh+yOQglSeGXiNWjzgQNXdphcBI9nXbyso9tPfX4YAUhg==
Expand Down
Loading