From 2df80a7637d8cec5bc9fadc30c72089c6facf51d Mon Sep 17 00:00:00 2001 From: ghoon99 Date: Wed, 9 Oct 2024 21:59:53 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20pr=20ci=20checker=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/PULL_REQUEST_TEMPLATE.md | 7 ++ .github/workflows/cache-modules.yml | 39 ++++++++++++ .github/workflows/ci-check.yml | 99 +++++++++++++++++++++++++++++ package.json | 7 +- src/App.tsx | 2 +- tsconfig.app.json | 2 - 6 files changed, 152 insertions(+), 4 deletions(-) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/cache-modules.yml create mode 100644 .github/workflows/ci-check.yml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..60db2b6 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,7 @@ +## 작업 내용 요약 + +- 작성 + +### 참고자료 + +- 작성 diff --git a/.github/workflows/cache-modules.yml b/.github/workflows/cache-modules.yml new file mode 100644 index 0000000..4bf9817 --- /dev/null +++ b/.github/workflows/cache-modules.yml @@ -0,0 +1,39 @@ +name: cache-modules +run-name: node_modules update + +on: + push: + branches: + - main + - develop + +jobs: + update-cache: + timeout-minutes: 10 + name: update-cache + runs-on: ubuntu-latest + + steps: + - name: 체크아웃 + uses: actions/checkout@v4 + + - name: node 세팅 + uses: actions/setup-node@v4 + with: + node-version: '20.15.1' + npm: '10.8.1' + + - name: 의존성 캐싱 + uses: actions/cache@v3 + id: npm-cache + with: + path: | + **/node_modules + + key: ${{ runner.os }}-nodekey-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-nodekey- + + - name: 의존성 설치 + if: steps.npm-cache.outputs.cache-hit != 'true' + run: npm install diff --git a/.github/workflows/ci-check.yml b/.github/workflows/ci-check.yml new file mode 100644 index 0000000..5646cbb --- /dev/null +++ b/.github/workflows/ci-check.yml @@ -0,0 +1,99 @@ +name: CI-check +run-name: CI by @${{ github.actor }} + +on: + pull_request: + branches: + - main + - develop + types: + - opened + - synchronize + - reopened + - ready_for_review +permissions: + pull-requests: write + contents: read + +jobs: + setup: + name: CI 작업 세팅 + timeout-minutes: 10 + runs-on: ubuntu-latest + steps: + - name: 체크아웃 + uses: actions/checkout@v4 + + - name: node 세팅 + uses: actions/setup-node@v4 + with: + node-version: '20.15.1' + npm: '10.8.1' + + - name: 의존성 캐싱 + uses: actions/cache@v3 + id: npm-cache + with: + path: | + **/node_modules + key: ${{ runner.os }}-nodekey-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-nodekey- + - if: ${{ steps.npm-cache.outputs.cache-hit != 'true' }} + run: npm install + + lint: + name: lint 체크 + timeout-minutes: 10 + runs-on: ubuntu-latest + needs: setup + steps: + - name: 체크아웃 + uses: actions/checkout@v4 + + - name: node 세팅 + uses: actions/setup-node@v4 + with: + node-version: '20.15.1' + npm: '10.8.1' + + - name: 의존성 캐싱 + uses: actions/cache@v3 + id: npm-cache + with: + path: | + **/node_modules + key: ${{ runner.os }}-nodekey-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-nodekey- + + - name: ESLint 실행 + run: npm run lint + + type-check: + name: 타입 체킹 + timeout-minutes: 10 + runs-on: ubuntu-latest + needs: setup + steps: + - name: 체크아웃 + uses: actions/checkout@v4 + + - name: node 세팅 + uses: actions/setup-node@v4 + with: + node-version: '20.15.1' + npm: '10.8.1' + + - name: 의존성 캐싱 + uses: actions/cache@v3 + id: npm-cache + with: + path: | + **/node_modules + key: ${{ runner.os }}-nodekey-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-nodekey- + + - name: 타입 체크 + run: npm run type-check diff --git a/package.json b/package.json index a241f25..5d2b3de 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "lint": "eslint .", "lint-staged": "lint-staged", "preview": "vite preview", - "prepare": "husky" + "prepare": "husky", + "type-check": "tsc -p tsconfig.app.json --noEmit" }, "prepare": "husky install", "lint-staged": { @@ -18,6 +19,10 @@ "prettier --write" ] }, + "engines": { + "node": ">=20", + "npm": ">=10" + }, "dependencies": { "@reduxjs/toolkit": "^2.2.8", "axios": "^1.7.7", diff --git a/src/App.tsx b/src/App.tsx index 9bebbfb..e6a8a8b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,5 +5,5 @@ function App() { ); } - +const a: number = '@'; export default App; diff --git a/tsconfig.app.json b/tsconfig.app.json index fe5e469..6e476af 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -20,8 +20,6 @@ /* Linting */ "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, "baseUrl": "./src", "paths": {