From 5bb76e8653ff45b9974c379af25938fa616535f4 Mon Sep 17 00:00:00 2001 From: scarf Date: Sat, 7 Sep 2024 15:35:18 +0900 Subject: [PATCH 1/5] =?UTF-8?q?test:=20=ED=83=80=EC=9E=85=20=EA=B2=80?= =?UTF-8?q?=EC=82=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/package.json b/backend/package.json index 3623f70..c93dcd2 100644 --- a/backend/package.json +++ b/backend/package.json @@ -17,7 +17,8 @@ "test:watch": "jest --watch", "test:cov": "jest --coverage", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", - "test:e2e": "jest --config ./test/jest-e2e.json" + "test:e2e": "jest --config ./test/jest-e2e.json", + "typecheck": "tsc --noEmit" }, "dependencies": { "@nestjs/common": "^10.0.0", From 8c8012622db8f790d954471660acc1a313af747a Mon Sep 17 00:00:00 2001 From: scarf Date: Sat, 7 Sep 2024 15:45:37 +0900 Subject: [PATCH 2/5] =?UTF-8?q?ci:=20=EC=9E=90=EB=8F=99=20=ED=8F=AC?= =?UTF-8?q?=EB=A7=A4=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 참고: https://autofix.ci --- .github/workflows/autofix.yml | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/autofix.yml diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml new file mode 100644 index 0000000..ff3801b --- /dev/null +++ b/.github/workflows/autofix.yml @@ -0,0 +1,42 @@ +name: autofix.ci # needed to securely identify the workflow + +on: + pull_request: + push: + branches: ["main"] + +defaults: + run: + working-directory: backend + +permissions: + contents: read + +jobs: + autofix: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: pnpm 설치 + uses: pnpm/action-setup@v4 + with: + version: 9 + package_json_file: "backend/package.json" + + - name: Node.js 22 설치 + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: "pnpm" + cache-dependency-path: backend/pnpm-lock.yaml + + - name: 의존성 설치 + run: pnpm install + + - name: 포매팅 + run: | + pnpm format + pnpm lint + + - uses: autofix-ci/action@dd55f44df8f7cdb7a6bf74c78677eb8acd40cd0a From 7c03527b05dbdd0260a1946d67ac2d98d90e6262 Mon Sep 17 00:00:00 2001 From: scarf Date: Sat, 7 Sep 2024 15:46:03 +0900 Subject: [PATCH 3/5] =?UTF-8?q?test:=20`lint:ci`=20=EC=98=B5=EC=85=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI에서 eslint 오류 검사를 위해 `--fix`를 제거합니다. --- backend/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/package.json b/backend/package.json index c93dcd2..27b2019 100644 --- a/backend/package.json +++ b/backend/package.json @@ -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\"", "test": "jest", "test:watch": "jest --watch", "test:cov": "jest --coverage", From 926f10ab94adffa769f744e14c4edb873ebc6e77 Mon Sep 17 00:00:00 2001 From: scarf Date: Sat, 7 Sep 2024 15:46:35 +0900 Subject: [PATCH 4/5] =?UTF-8?q?ci:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 테스트를 실행하고 커버리지 결과를 codecov에 업로드합니다. 참고: https://about.codecov.io --- .github/workflows/ci.yml | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fe8a80a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +name: CI +on: + push: + branches: [main] + pull_request: + branches: [main] + +defaults: + run: + working-directory: backend + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20, 22] + steps: + - uses: actions/checkout@v4 + + - name: pnpm 설치 + uses: pnpm/action-setup@v4 + with: + version: 9 + package_json_file: "backend/package.json" + + - name: Node.js ${{ matrix.node-version }} 설치 + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "pnpm" + cache-dependency-path: backend/pnpm-lock.yaml + + - name: 의존성 설치 + run: pnpm install + + - name: 테스트 + run: | + pnpm lint:ci + pnpm typecheck + pnpm test:cov + + - name: Codecov에 커버리지 결과 배포 + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} From 632a950a8691b3a3bb1ef005231b08a6f39b1831 Mon Sep 17 00:00:00 2001 From: scarf Date: Sat, 7 Sep 2024 16:28:06 +0900 Subject: [PATCH 5/5] =?UTF-8?q?ci:=20--frozen-lockfile=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/autofix.yml | 2 +- .github/workflows/ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml index ff3801b..b3b072f 100644 --- a/.github/workflows/autofix.yml +++ b/.github/workflows/autofix.yml @@ -32,7 +32,7 @@ jobs: cache-dependency-path: backend/pnpm-lock.yaml - name: 의존성 설치 - run: pnpm install + run: pnpm install --frozen-lockfile - name: 포매팅 run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe8a80a..afaefe3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: cache-dependency-path: backend/pnpm-lock.yaml - name: 의존성 설치 - run: pnpm install + run: pnpm install --frozen-lockfile - name: 테스트 run: |