From 999713b31a7289b1c795af68fd1a83ca0970309d Mon Sep 17 00:00:00 2001 From: Mariana Sartorato Date: Fri, 21 Jun 2024 17:49:30 -0300 Subject: [PATCH] chore(#1): add workflow - run pnpm lint - run pnpm build closes #1 --- .github/workflows/ci.yaml | 101 ++++++++++++++++++++++++++++++++++++++ .nvmrc | 1 + dashboard/package.json | 2 +- 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yaml create mode 100644 .nvmrc diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..fc49092 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,101 @@ +name: CI for KernelCI Dashboard + +on: + push: + branches: [main] + pull_request: + types: + - opened + - synchronize + - reopened + - ready_for_review + +concurrency: + group: ci-check-${{ github.ref }} + cancel-in-progress: true + +env: + CI: true + +jobs: + setup-node: + if: github.event.pull_request.draft != true + runs-on: ubuntu-latest + timeout-minutes: 10 + outputs: + paths-node_modules: ${{ steps.paths-node_modules.outputs.paths }} + steps: + - uses: actions/checkout@v4 + + - name: Cache node_modules + uses: actions/cache@v4 + id: cache-node_modules + with: + key: node_modules-${{ runner.os }}-${{ hashFiles('./dashboard/pnpm-lock.yaml') }} + path: ./dashboard/node_modules + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 9 + + - name: Installing dependencies with pnpm + if: steps.cache-node_modules.outputs.cache-hit != 'true' + run: pnpm install --frozen-lockfile + working-directory: ./dashboard + + lint-js: + if: github.event.pull_request.draft != true + needs: setup-node + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v4 + + - name: Fetch node_modules + uses: actions/cache@v4 + id: fetch-node_modules + with: + key: node_modules-${{ runner.os }}-${{ hashFiles('./dashboard/pnpm-lock.yaml') }} + path: ./dashboard/node_modules + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 9 + + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + + - name: Run eslint + run: pnpm lint + working-directory: ./dashboard + + build-front: + if: github.event.pull_request.draft != true + needs: setup-node + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + + - name: Fetch node_modules + uses: actions/cache@v4 + id: fetch-node_modules + with: + key: node_modules-${{ runner.os }}-${{ hashFiles('./dashboard/pnpm-lock.yaml') }} + path: ./dashboard/node_modules + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 9 + + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + + - name: Run build + run: pnpm build + working-directory: ./dashboard \ No newline at end of file diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..25bf17f --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18 \ No newline at end of file diff --git a/dashboard/package.json b/dashboard/package.json index 199a5ed..828d903 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -6,7 +6,7 @@ "scripts": { "dev": "vite", "build": "tsc -b && vite build", - "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", + "lint": "eslint **/*.tsx **/*.ts --report-unused-disable-directives --max-warnings 0", "preview": "vite preview" }, "dependencies": {