Skip to content

Commit

Permalink
#17 Create the workflow CI. (#21)
Browse files Browse the repository at this point in the history
* ft(CI):create workflow file
-we are creating workflow file
-we are runing test,linting and build for the workflow
-right now we are not run deployment.

story id: #17

* bug(CI):change super linter version
-i changed the version of github super linter to latest version

#17

* bug(ci):add if statement on run test line

-the script run test is not present in packege.json
-if not present pass it with no error

#17

* bg(ci):add git token
_super linter new git token to report the status
#17

* bug(ci): change the run lint line
- am nolonger using super linter

#17

* bug(ci):chnage run test
- i have changed npm  test to
-npm runtest

#17

* fix(backend):upload coverage to coverolls

-we are adding the script to help upload the coverage

 #17

* fix:check if the coverage works

* fix:allow coverage empty

* fix: now test coverage with the lint

* fix: come back to coomit with no confict

fix: lint

* fix: fix all bugs
- the env file was created
-env file contain all need valiables
#17

* fix: change the env valiable

#17

* fix: change the linking

* fix: linting
  • Loading branch information
niyibi250 authored Apr 30, 2024
1 parent 1b153ee commit 5a92978
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 4 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/workflow_for_ecomm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI for ecomm-project for Dynamite

on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]

jobs:
build:
#git hub offer virtual machines to run workflows so we will be using ubuntu lastest version its standand one
#we using ubuntu because we want to use lunex terminal
runs-on: ubuntu-latest

strategy:
matrix:
#each version we specify we be tested on
#we are only limited to 3 versions
node-version: [16.x, 18.x, 20.x]


steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }} #this will help use know which version we are testing on.
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm' #this we help speed up the workflow by reusing dependencies from previous runs
- run: npm ci #run dependencies installing we using ci in place of 'npm install' becouse ci(clearn install) is smooth and faster
- run: npm run test --if-present #this line will run test script
- run: npm run lint --if-present # run tle
- run: npm run build --if-present # we using if statement because initial the code have no build script in packege.json
- run: npm run test:ci --if-present # this will run test with coverage flag

- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
allow-empty: true
4 changes: 2 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ app.get('/', (req: Request, res: Response) => {
});

// Middleware to handle all endpoint routes
app.use(process.env.ALL as string, route);
app.use('/api/v1', route);

// Endpoint for serving Swagger documentation
app.use(
process.env.DOCS as string,
'/api-docs',
swaggerUi.serve,
swaggerUi.setup(swaggerSpec)
);
Expand Down
8 changes: 7 additions & 1 deletion src/controller/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ import {User} from '../database/models';

const userRepository = dbConnection.getRepository(User)

export const createUser = async(data:any) => {
interface UserData {
firstName: string;
lastName: string;
age: number;
}

export const createUser = async(data: UserData) => {
const user = new User()
user.firstName = data.firstName
user.lastName = data.lastName
Expand Down
2 changes: 1 addition & 1 deletion src/database/models/user.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm"
import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm'

@Entity()
export class User {
Expand Down

0 comments on commit 5a92978

Please sign in to comment.