diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..f680579 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -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/codecov-action@v4.0.1 + 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 diff --git a/README.md b/README.md index 205a536..21b6478 100644 --- a/README.md +++ b/README.md @@ -1 +1,18 @@ # eagles-ec-be + +
+ +### Technology used + + +[](http://www.passportjs.org/) +[](https://www.postgresql.org/) +[](https://sequelize.org/) +[](https://jestjs.io/) +[](https://eslint.org/) diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 0000000..36e4760 --- /dev/null +++ b/jest.config.js @@ -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, +}; diff --git a/package.json b/package.json index b459380..f6b4824 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/sequelize/config/config.js b/src/sequelize/config/config.js index cb08438..bded937 100644 --- a/src/sequelize/config/config.js +++ b/src/sequelize/config/config.js @@ -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, + }, + }, }, };