Skip to content

Commit

Permalink
feat: add DELETE function
Browse files Browse the repository at this point in the history
- remove babel and dependencies
- remove yarn package manager dependencies (moved to npm)
- update .prettierrc
- update CI/CD with integration test capability
- includes semantic-release CD
  • Loading branch information
sydrawat01 committed Jan 9, 2024
1 parent 66ce4bb commit 19bd9d4
Show file tree
Hide file tree
Showing 20 changed files with 11,039 additions and 4,677 deletions.
8 changes: 0 additions & 8 deletions .babelrc

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Release
on:
workflow_dispatch:

jobs:
release:
permissions:
contents: write
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v2
with:
node-version: 20
- run: npm ci
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
45 changes: 32 additions & 13 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,52 @@ env:
ENVIRONMENT: test

on:
workflow_dispatch:
pull_request:
branches: [master]

jobs:
build:
unittest:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x]

environment: ${{ vars.ENVIRONMENT }}
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:latest
ports:
- 5432:5432
env:
POSTGRES_DB: ${{ vars.DATABASE }}
POSTGRES_USER: ${{ vars.DBUSER }}
POSTGRES_PASSWORD: ${{ secrets.DBPASSWORD }}
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
name: Run unit tests
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: "Create .env file"
run: |
touch .env
echo ENVIRONMENT=${{ env.ENVIRONMENT }} >> .env
echo HOSTNAME=${{ secrets.HOSTNAME}} >> .env
echo PORT=${{ secrets.PORT }} >> .env
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn
echo DATABASE=${{ vars.DATABASE }} >> .env
echo DBUSER=${{ vars.DBUSER }} >> .env
echo DBPASSWORD=${{ secrets.DBPASSWORD }} >> .env
- name: Clean Install Dependencies
run: npm ci
- name: Run test scripts
run: yarn test
run: npm run test
# Github token to run public workflows
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"semi": false,
"trailingComma": "es5",
"singleQuote": true,
"jsxSingleQuote": false,
"printWidth": 80,
"tabWidth": 2,
"endOfLine": "auto"
}
9 changes: 0 additions & 9 deletions .prettierrc.js

This file was deleted.

10 changes: 5 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import 'dotenv/config'
import express from 'express'
import bodyParser from 'body-parser'
import cors from 'cors'
import appConfig from './src/configs/app.config'
import { healthRoute, userRoute } from './src/routes/index.routes'
import logger from './src/configs/logger.config'
import db from './src/models/index.model'
import { errorHandler } from './src/middlewares/errorHandler'
import appConfig from './src/configs/app.config.js'
import { healthRoute, userRoute } from './src/routes/index.routes.js'
import logger from './src/configs/logger.config.js'
import db from './src/models/index.model.js'
import { errorHandler } from './src/middlewares/errorHandler.js'

const app = express()
const { HOSTNAME, PORT, ENVIRONMENT } = appConfig
Expand Down
Loading

0 comments on commit 19bd9d4

Please sign in to comment.