Skip to content

Instantly share code, notes, and snippets.

View ekpangmichael's full-sized avatar

Ekpang Michael ekpangmichael

View GitHub Profile
const { createLogger, format, transports } = require('winston');
const { combine, timestamp, printf} = format;
const { Worker, isMainThread } = require('worker_threads');
const logFormat = printf(({ level, message, timestamp }) => {
return `{ "Date": "${timestamp}", "level": "${level.toUpperCase()}", "message": "${message}" }`;
});
class Logger {
log(message, logType=null) {
# Set a base docker image, using node alpine because it is lightweight
image: node:10.16.0-alpine
# This folder is cached between builds and will speed up subsequent build
cache:
paths:
- node_modules/
# Function to deploy to Heroku
.deploy_script: &deploy_script
# Job to deploy master branch to production environment
Deploy to production:
stage: deploy_production
<<: *deploy_script
only:
- master
# Function to deploy to Heroku
.deploy_script: &deploy_script
script:
- apk update && apk add git && apk add curl
- git remote add heroku https://heroku:$HEROKU__KEY@git.heroku.com/$APP.git
- git push heroku HEAD:master -f
# Set a base docker image, using node alpine because it is lightweight
image: node:10.16.0-alpine
# This folder is cached between builds and will speed up subsequent build
cache:
paths:
- node_modules/
# Setup all the stages
stages:
@ekpangmichael
ekpangmichael / ci.yml
Last active September 25, 2019 18:44
name: CI
on:
push:
branches:
- master
jobs:
build:
- name: Add remote origin
run: |
git remote add heroku https://heroku:${{ secrets.HEROKU_API_KEY }}@git.heroku.com/${{ secrets.HEROKU_APP_NAME }}.git
- name: Deploy to Heroku
run: |
git push heroku HEAD:master -f
@ekpangmichael
ekpangmichael / ci.yml
Last active September 25, 2019 18:45
name: CI
on:
push:
branches:
- master
jobs:
build:
- name: yarn install
run: |
yarn install
- name: yarn test
run: |
yarn test
env:
CI: true
- name: yarn build
@ekpangmichael
ekpangmichael / ci.yml
Last active September 25, 2019 18:16
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}