Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update dependencies, workflows and security lacks #58

Merged
merged 11 commits into from
Jan 25, 2024
56 changes: 44 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build
on:
push:
branches: [ dev, main, hotfix/*, feature/*, release/* ]
branches: [ dev, master, hotfix/*, feature/*, release/* ]
jobs:
build:
name: Build
Expand All @@ -11,17 +11,11 @@ jobs:
NODE_ENV: test
steps:
- name: Github checkout
uses: actions/checkout@v1
uses: actions/checkout@v4
- name: Setup node.js environment
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: '16.6.2'
- name: Setup MySQL server
uses: mirromutth/mysql-action@v1.1
with:
mysql version: '5.7'
mysql database: 'typeplate_test'
mysql root password: passw0rd
node-version: '18.19.0'
- name: Create directories
run: mkdir -p ./dist/env && cp ./src/env/template.env ./dist/env/test.env
- name: Setup .env file
Expand All @@ -35,14 +29,52 @@ jobs:
echo LINKEDIN_CONSUMER_ID = "${{ secrets.LINKEDIN_CONSUMER_ID }}" >> ./dist/env/test.env
echo LINKEDIN_CONSUMER_SECRET = "${{ secrets.LINKEDIN_CONSUMER_SECRET }}" >> ./dist/env/test.env
- name: Install global dependencies
run: npm i typescript -g && npm i typeorm -g
run: npm i typescript@5.3.3 -g && npm i typeorm@0.2.41 -g
- name: Install local dependencies
run: npm i
- name: Compile Typescript files
run: tsc
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: build-files
path: |
dist
retention-days: 3
test:
name: Test
runs-on: ubuntu-latest
needs: [ build ]
env:
RUNNER: github
NODE_ENV: test
steps:
- name: Github checkout
uses: actions/checkout@v4
- name: Setup node.js environment
uses: actions/setup-node@v4
with:
node-version: '18.19.0'
- name: Setup MySQL server
uses: mirromutth/mysql-action@v1.1
with:
mysql version: '5.7'
mysql database: 'typeplate_test'
mysql root password: passw0rd
- name: Install global dependencies
run: npm i typescript@5.3.3 -g && npm i typeorm@0.2.41 -g
- name: Install local dependencies
run: npm i
- name: Create dist directory
run: mkdir dist
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build-files
path: dist
- name: Synchronize database schema
run: typeorm schema:sync
- name: Execute tests sets
- name: Execute tests suites
run: npm run ci:test
- name: Publish to coveralls.io
uses: coverallsapp/github-action@v1.1.2
Expand Down
62 changes: 47 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,11 @@ jobs:
NODE_ENV: test
steps:
- name: Github checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup node.js environment
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: '16.6.2'
- name: Setup MySQL server
uses: mirromutth/mysql-action@v1.1
with:
mysql version: '5.7'
mysql database: 'typeplate_test'
mysql root password: passw0rd
node-version: '18.19.0'
- name: Create directories
run: mkdir -p ./dist/env && cp ./src/env/template.env ./dist/env/test.env
- name: Setup .env file
Expand All @@ -36,14 +30,52 @@ jobs:
echo LINKEDIN_CONSUMER_ID = "${{ secrets.LINKEDIN_CONSUMER_ID }}" >> ./dist/env/test.env
echo LINKEDIN_CONSUMER_SECRET = "${{ secrets.LINKEDIN_CONSUMER_SECRET }}" >> ./dist/env/test.env
- name: Install global dependencies
run: npm i typescript -g && npm i typeorm -g
run: npm i typescript@5.3.3 -g && npm i typeorm@0.2.41 -g
- name: Install local dependencies
run: npm i
- name: Compile Typescript files
run: tsc
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: build-files
path: |
dist
retention-days: 3
test:
name: Test
runs-on: ubuntu-latest
needs: [ build ]
env:
RUNNER: github
NODE_ENV: test
steps:
- name: Github checkout
uses: actions/checkout@v4
- name: Setup node.js environment
uses: actions/setup-node@v4
with:
node-version: '18.19.0'
- name: Setup MySQL server
uses: mirromutth/mysql-action@v1.1
with:
mysql version: '5.7'
mysql database: 'typeplate_test'
mysql root password: passw0rd
- name: Install global dependencies
run: npm i typescript@5.3.3 -g && npm i typeorm@0.2.41 -g
- name: Install local dependencies
run: npm i
- name: Create dist directory
run: mkdir dist
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build-files
path: dist
- name: Synchronize database schema
run: typeorm schema:sync
- name: Execute tests sets
- name: Execute tests suites
run: npm run ci:test
- name: Publish to coveralls.io
uses: coverallsapp/github-action@v1.1.2
Expand All @@ -53,21 +85,21 @@ jobs:
release:
name: Release on Github
runs-on: ubuntu-latest
needs: [ build ]
needs: [ build, test ]
steps:
- name: Cache dependencies
uses: actions/cache@v2
with:
path: '**/node_modules'
key: node-modules-${{ hashfiles('**/package-lock.json') }}
- name: Github checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup node.js environment
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: '16.6.2'
node-version: '16.19.0'
- name: Create release
uses: konfer-be/action-create-release-from-tag@v1.0.2
with:
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
![Typescript / Express / Typeorm REST API boilerplate](https://i.ibb.co/tbqXm9Q/header-ts-boilerplate-4.png)

[![Node](https://img.shields.io/badge/Node-16.6.2-informational?logo=node.js&color=43853D)](https://nodejs.org/docs/latest-v16.x/api/index.html)
[![TypeScript](https://img.shields.io/badge/Typescript-4.5.4-informational?logo=typescript&color=2F74C0)](https://www.typescriptlang.org/)
[![Express](https://img.shields.io/badge/Express-4.17.2-informational?logo=express&color=B1B1B1)](https://expressjs.com/)
[![Node](https://img.shields.io/badge/Node-18.19.0-informational?logo=node.js&color=43853D)](https://nodejs.org/docs/latest-v18.x/api/index.html)
[![TypeScript](https://img.shields.io/badge/Typescript-5.3.3-informational?logo=typescript&color=2F74C0)](https://www.typescriptlang.org/)
[![Express](https://img.shields.io/badge/Express-4.18.3-informational?logo=express&color=B1B1B1)](https://expressjs.com/)
[![Typeorm](https://img.shields.io/badge/Typeorm-0.2.41-informational?logo=typeorm&color=FFAB00)](https://typeorm.io/#/)
[![Mocha](https://img.shields.io/badge/Mocha-9.1.3-informational?logo=mocha&color=8A6343)](https://mochajs.org)

[![Build](https://github.com/konfer-be/typeplate/actions/workflows/release.yml/badge.svg)](https://github.com/konfer-be/typeplate/actions/workflows/release.yml)
[![Coverage Status](https://coveralls.io/repos/github/konfer-be/typeplate/badge.svg?branch=master)](https://coveralls.io/github/konfer-be/typeplate?branch=master)
![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/konfer-be/typeplate/master)
![Requires.io (branch)](https://img.shields.io/requires/github/konfer-be/typeplate/master)
![Snyk Vulnerabilities for GitHub Repo](https://img.shields.io/snyk/vulnerabilities/github/konfer-be/typeplate)
![Github action workflow status](https://github.com/steve-lebleu/typeplate/actions/workflows/build.yml/badge.svg?branch=main)
[![Coverage Status](https://coveralls.io/repos/github/steve-lebleu/typeplate/badge.svg?branch=master)](https://coveralls.io/github/steve-lebleu/typeplate?branch=master)
[![CodeFactor](https://www.codefactor.io/repository/github/steve-lebleu/typeplate/badge)](https://www.codefactor.io/repository/github/steve-lebleu/typeplate)
![GitHub Release](https://img.shields.io/github/v/release/steve-lebleu/typeplate?logo=Github)
![Known Vulnerabilities](https://snyk.io/test/github/steve-lebleu/typeplate/badge.svg)

[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)

Expand Down
Loading
Loading