Skip to content

Commit bcc66ab

Browse files
authored
Add github workflows (#8)
- Add lint and type-check github workflows - Fix files with issues
1 parent 5770cd8 commit bcc66ab

File tree

23 files changed

+595
-537
lines changed

23 files changed

+595
-537
lines changed

.github/workflows/main.yaml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- staging
8+
pull_request:
9+
types: [opened, synchronize]
10+
11+
jobs:
12+
install:
13+
name: Install Dependencies
14+
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
working-directory: ./project
18+
steps:
19+
- name: Checkout Repository
20+
uses: actions/checkout@v4
21+
22+
# We un-hoist packages to ensure that each package has the necessary
23+
# dependencies and do not rely implicitly on dependencies from other packages.
24+
- name: Un-hoist packages
25+
run: |
26+
sed -i 's/node-linker=hoisted/node-linker=isolated/g' .npmrc
27+
28+
- name: Install pnpm
29+
uses: pnpm/action-setup@v4
30+
with:
31+
version: 8
32+
run_install: false
33+
34+
- name: Get pnpm store directory
35+
shell: bash
36+
run: |
37+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
38+
39+
- name: Cache turbo build setup
40+
uses: actions/cache@v4
41+
with:
42+
path: .turbo
43+
key: ${{ runner.os }}-turbo-${{ github.sha }}
44+
restore-keys: |
45+
${{ runner.os }}-turbo-
46+
47+
- name: Setup Node.js environment
48+
uses: actions/setup-node@v4
49+
with:
50+
node-version: 18
51+
52+
- name: Install Dependencies
53+
run: pnpm install --frozen-lockfile
54+
55+
lint:
56+
name: Type Check & Lint
57+
needs:
58+
- install
59+
runs-on: ubuntu-latest
60+
defaults:
61+
run:
62+
working-directory: ./project
63+
steps:
64+
- name: Checkout Repository
65+
uses: actions/checkout@v4
66+
67+
- name: Un-hoist packages
68+
run: |
69+
sed -i 's/node-linker=hoisted/node-linker=isolated/g' .npmrc
70+
71+
- name: Install pnpm
72+
uses: pnpm/action-setup@v4
73+
with:
74+
version: 8
75+
run_install: false
76+
77+
- name: Get pnpm store directory
78+
shell: bash
79+
run: |
80+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
81+
82+
- name: Cache turbo build setup
83+
uses: actions/cache@v4
84+
with:
85+
path: .turbo
86+
key: ${{ runner.os }}-turbo-${{ github.sha }}
87+
restore-keys: |
88+
${{ runner.os }}-turbo-
89+
90+
- name: Setup Node.js environment
91+
uses: actions/setup-node@v4
92+
with:
93+
node-version: 18
94+
95+
- name: Install Dependencies
96+
run: pnpm install --frozen-lockfile
97+
98+
- name: Run type checking
99+
run: pnpm type-check
100+
101+
- name: Run linting
102+
run: pnpm lint
Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,9 @@
1+
/** @type {import("eslint").Linter.Config} */
12
module.exports = {
3+
root: true,
4+
extends: ['@repo/eslint-config/nest.js'],
25
parser: '@typescript-eslint/parser',
36
parserOptions: {
4-
project: 'tsconfig.json',
5-
tsconfigRootDir: __dirname,
6-
sourceType: 'module',
7-
},
8-
plugins: ['@typescript-eslint/eslint-plugin'],
9-
extends: [
10-
'plugin:@typescript-eslint/recommended',
11-
'plugin:prettier/recommended',
12-
],
13-
root: true,
14-
env: {
15-
node: true,
16-
jest: true,
17-
},
18-
ignorePatterns: ['.eslintrc.js'],
19-
rules: {
20-
'@typescript-eslint/interface-name-prefix': 'off',
21-
'@typescript-eslint/explicit-function-return-type': 'off',
22-
'@typescript-eslint/explicit-module-boundary-types': 'off',
23-
'@typescript-eslint/no-explicit-any': 'off',
7+
project: true,
248
},
259
};

project/apps/api-gateway/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"start:debug": "nest start --debug --watch",
1414
"start:prod": "node dist/main",
1515
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
16+
"type-check": "tsc",
1617
"test": "jest",
1718
"test:watch": "jest --watch",
1819
"test:cov": "jest --coverage",
@@ -22,6 +23,7 @@
2223
"dependencies": {
2324
"@repo/pipes": "workspace:*",
2425
"@repo/dtos": "workspace:*",
26+
"@repo/eslint-config": "workspace:*",
2527
"@nestjs/common": "^10.0.0",
2628
"@nestjs/core": "^10.0.0",
2729
"@nestjs/microservices": "^10.4.3",

project/apps/api-gateway/test/app.e2e-spec.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

project/apps/api-gateway/test/jest-e2e.json

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,9 @@
1+
/** @type {import("eslint").Linter.Config} */
12
module.exports = {
3+
root: true,
4+
extends: ['@repo/eslint-config/nest.js'],
25
parser: '@typescript-eslint/parser',
36
parserOptions: {
4-
project: 'tsconfig.json',
5-
tsconfigRootDir: __dirname,
6-
sourceType: 'module',
7-
},
8-
plugins: ['@typescript-eslint/eslint-plugin'],
9-
extends: [
10-
'plugin:@typescript-eslint/recommended',
11-
'plugin:prettier/recommended',
12-
],
13-
root: true,
14-
env: {
15-
node: true,
16-
jest: true,
17-
},
18-
ignorePatterns: ['.eslintrc.js'],
19-
rules: {
20-
'@typescript-eslint/interface-name-prefix': 'off',
21-
'@typescript-eslint/explicit-function-return-type': 'off',
22-
'@typescript-eslint/explicit-module-boundary-types': 'off',
23-
'@typescript-eslint/no-explicit-any': 'off',
7+
project: true,
248
},
259
};

project/apps/questions-service/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"start:debug": "nest start --debug --watch",
1414
"start:prod": "node dist/main",
1515
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
16+
"type-check": "tsc",
1617
"test": "jest",
1718
"test:watch": "jest --watch",
1819
"test:cov": "jest --coverage",
@@ -22,6 +23,7 @@
2223
"dependencies": {
2324
"@repo/pipes": "workspace:*",
2425
"@repo/dtos": "workspace:*",
26+
"@repo/eslint-config": "workspace:*",
2527
"@nestjs/common": "^10.0.0",
2628
"@nestjs/core": "^10.0.0",
2729
"@nestjs/microservices": "^10.4.3",

project/apps/questions-service/test/app.e2e-spec.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

project/apps/questions-service/test/jest-e2e.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

project/apps/web/app/layout.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
import type { Metadata } from "next";
21
import "./globals.css";
32

4-
export const metadata: Metadata = {
5-
title: "Create Next App",
6-
description: "Generated by create next app",
7-
};
8-
93
export default function RootLayout({
104
children,
115
}: Readonly<{

0 commit comments

Comments
 (0)