Skip to content

Commit

Permalink
chore : Set up Tests locally & implement Continuous Integration
Browse files Browse the repository at this point in the history
  • Loading branch information
soleil00 committed Apr 16, 2024
1 parent 7b420af commit a4788c0
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 1 deletion.
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Eagle e-commerce CI/CD

on:
push:
branches:
- main
- dev

pull_request:
branches:
- main
- dev

workflow_dispatch:

jobs:
build:
name: Building code
runs-on: ubuntu-latest

steps:
- name: Checkout the code
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "20"

- name: Install dependencies
run: npm install

- name: Running test
env:
DB_CONNECTION: ${{ secrets.DB_CONNECTION }}
run: npm run test

- name: Build application
run: npm run build

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: soleil00/eagles-ec-be

- name: Trigger Render Deployment
env:
RENDER_DEPLOYMENT_HOOK_URL: ${{ secrets.RENDER_DEPLOYMENT_HOOK_URL }}
run: |
curl -X POST $RENDER_DEPLOYMENT_HOOK_URL
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
# eagles-ec-be

<div style="display: flex; justify-content: center;" align="center">
<img src="https://codecov.io/gh/soleil00/eagles-ec-be/branch/dev/graph/badge.svg?token=9c1e8e93-1062-4e49-a58d-b2777a75fb70" alt="Codecov" >
<img alt="GitHub Actions Workflow Status" src="https://img.shields.io/github/actions/workflow/status/soleil00/eagles-ec-be/test.yml" >

<a href="https://codeclimate.com/github/atlp-rwanda/eagles-ec-be/maintainability"><img src="https://api.codeclimate.com/v1/badges/dfe8454356fb9da65407/maintainability" /></a>

</div>

### Technology used

![Node.js](https://img.shields.io/badge/-Node.js-000000?style=flat&logo=node.js)
[![Passport.js](https://img.shields.io/badge/auth%20library-Passport.js-green)](http://www.passportjs.org/)
[![PostgreSQL](https://img.shields.io/badge/database-PostgreSQL-blue)](https://www.postgresql.org/)
[![Sequelize](https://img.shields.io/badge/ORM-Sequelize-orange)](https://sequelize.org/)
[![Jest](https://img.shields.io/badge/testing-Jest-red)](https://jestjs.io/)
[![ESLint](https://img.shields.io/badge/code%20style-ESLint-blueviolet)](https://eslint.org/)
11 changes: 11 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
testMatch: ["**/**/*.test.ts"],
verbose: true,
forceExit: true,
clearMocks: true,
resetMocks: true,
restoreMocks: true,
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"seed": "npx sequelize-cli db:seed:all",
"lint": "npx eslint .",
"lint:fix": "npx eslint --fix .",
"test": " npm run lint && jest --detectOpenHandles --coverage"
"test": "jest --detectOpenHandles --coverage"
},
"author": "atlp",
"license": "MIT",
Expand Down
18 changes: 18 additions & 0 deletions src/sequelize/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,31 @@ module.exports = {
development: {
url: process.env.DB_CONNECTION,
dialect: "postgres",
dialectOptions: {
ssl: {
require: true,
rejectUnauthorized: false,
},
},
},
test: {
url: process.env.DB_CONNECTION,
dialect: "postgres",
dialectOptions: {
ssl: {
require: true,
rejectUnauthorized: false,
},
},
},
production: {
url: process.env.DB_CONNECTION,
dialect: "postgres",
dialectOptions: {
ssl: {
require: true,
rejectUnauthorized: false,
},
},
},
};

0 comments on commit a4788c0

Please sign in to comment.