Commit f77967e5 authored by William Naslund's avatar William Naslund

Added CI build and test coverage jobs

parent d2f3ae91
......@@ -5,6 +5,8 @@
# Node.js
/node_modules/
yarn-error.log
/.nyc_output/
/coverage/
# TypeScript
/dist/
......
stages:
- build
- test
# NPM Dependencies
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
before_script:
- npm install
# Build
Build Module:
stage: build
image: node:11
script:
- tsc
artifacts:
paths:
- dist/module
expire_in: 1 day
Build Tests:
stage: build
image: node:11
script:
- tsc -p tests/
artifacts:
paths:
- dist/module
expire_in: 1 day
# Test
Test All:
stage: test
image: node:11
variables:
POSTGRES_PASSWORD: swirl
POSTGRES_USER: swirl
POSTGRES_DB: swirl
PG_SERVER: postgres
services:
- name: postgres:11-alpine
alias: postgres
script:
- npm run test:coverage
artifacts:
paths:
- coverage
expire_in: 3 months
This diff is collapsed.
......@@ -7,6 +7,7 @@
"prepublish": "rm -rf dist && tsc && rm -rf dist/tests",
"test": "mocha --require module-alias/register --recursive dist/tests",
"test:one": "mocha --require module-alias/register $1",
"test:coverage": "nyc --reporter=html --reporter=text-summary mocha --require module-alias/register --recursive dist/tests",
"watch:module": "tsc -w --preserveWatchOutput",
"watch:tests": "tsc -p tests/ -w --preserveWatchOutput"
},
......@@ -25,6 +26,7 @@
"concurrently": "^4.1.0",
"mocha": "^5.2.0",
"module-alias": "^2.1.0",
"nyc": "^13.2.0",
"typescript": "^3.2.4"
}
}
......@@ -2,7 +2,7 @@ import { PGAdapter } from "@swirl/db";
export function getTestAdapter() {
return new PGAdapter({
host: 'localhost',
host: process.env['PG_SERVER'] || 'localhost',
user: 'swirl',
password: 'swirl',
database: 'swirl'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment