From 3061ab95b1a5c2fdf49b0095d25e9c2d35452b46 Mon Sep 17 00:00:00 2001 From: ayuvlasenko <77232221+ayuvlasenko@users.noreply.github.com> Date: Tue, 22 Oct 2024 11:32:48 +0400 Subject: [PATCH] Add GitHub Actions for CI/CD with linting and testing --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/ayuvlasenko/expense-assistant?shareId=XXXX-XXXX-XXXX-XXXX). --- .github/workflows/ci.yml | 44 ++++++++++++++++++++++++++++++++++++++++ package.json | 4 +++- 2 files changed, 47 insertions(+), 1 deletion(-) 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..9ecbbfd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,44 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '20' + + - name: Install dependencies + run: npm install + + - name: Run ESLint + run: npm run ci:lint + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '20' + + - name: Install dependencies + run: npm install + + - name: Run tests + run: npm run ci:test diff --git a/package.json b/package.json index 4847388..c466358 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,9 @@ "test": "jest", "test:watch": "jest --watch", "test:coverage": "jest --coverage", - "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand" + "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", + "ci:lint": "npm run lint", + "ci:test": "npm run test" }, "dependencies": { "@nestjs/common": "10.3.0",