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

Add formatting and linting checks to CI #48

Merged
merged 9 commits into from
May 11, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on:
pull_request:
branches:
- master
- develop

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Cache node modules
id: cache-npm
uses: actions/cache@v3

env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list

- name: NPM install
run: npm install

- name: Build
run: npm run build

- name: Lint & Format
run: npm run lint
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"lint:ci": "eslint \"{src,apps,libs,test}/**/*.ts\" --format=stylish",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
4 changes: 3 additions & 1 deletion src/shelter-managers/shelter-managers.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -9,7 +9,9 @@ describe('ShelterManagersController', () => {
controllers: [ShelterManagersController],
}).compile();

controller = module.get<ShelterManagersController>(ShelterManagersController);
controller = module.get<ShelterManagersController>(
ShelterManagersController,
);
});

it('should be defined', () => {
4 changes: 1 addition & 3 deletions src/shelter/shelter.service.ts
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@ import {
import { SeachQueryProps } from '@/decorators/search-query/types';
import { SupplyPriority } from 'src/supply/types';


@Injectable()
export class ShelterService {
constructor(private readonly prismaService: PrismaService) {}
@@ -74,8 +73,7 @@ export class ShelterService {
verified: true,
shelterSupplies: {
where: {
priority: {
},
priority: {},
},
select: {
priority: true,
4 changes: 3 additions & 1 deletion src/supply-categories/supply-categories.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -9,7 +9,9 @@ describe('SupplyCategoriesController', () => {
controllers: [SupplyCategoriesController],
}).compile();

controller = module.get<SupplyCategoriesController>(SupplyCategoriesController);
controller = module.get<SupplyCategoriesController>(
SupplyCategoriesController,
);
});

it('should be defined', () => {