diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..dc13e4c --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,66 @@ +name: CI + +on: [push] + +jobs: + api: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: npm Cache + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 16 + + - run: npm ci + - run: npm run build + - run: npm run lint:api + - run: npm run test:cov + + - name: Archive code coverage results + uses: actions/upload-artifact@v2 + with: + name: code-coverage-report + path: coverage + + frontend: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: npm Cache + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 16 + + - run: npm ci + + - run: npm ci + working-directory: frontend + + - run: npm run lint:frontend + + - name: Archive code coverage results + uses: actions/upload-artifact@v2 + with: + name: code-coverage-report + path: coverage diff --git a/package.json b/package.json index 2e31485..f7b2028 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,8 @@ "start:debug": "nest start --debug --watch", "start:prod": "node dist/main", "lint": "eslint --ext .js,.jsx,.ts,.tsx src/ frontend/src/", + "lint:api": "eslint --ext .js,.ts src/ test/", + "lint:frontend": "eslint --ext .js,.jsx,.ts,.tsx frontend/src/", "test": "jest", "test:watch": "jest --watch", "test:cov": "jest --coverage",