From 9d3666189ce059708a71a19e57d4d2f2b0b68704 Mon Sep 17 00:00:00 2001 From: Matej Kubinec Date: Wed, 17 Apr 2024 14:09:52 +0200 Subject: [PATCH] PMM-7 Run unit tests for QAN & add ci for setup page --- .github/workflows/build.yml | 31 ++++++++++++++++++++++++++++--- .github/workflows/setup-page.yml | 29 +++++++++++++++++++++++++++++ pmm-app/package.json | 1 + setup-page/.gitignore | 1 + 4 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/setup-page.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ee9c470718..8567f7b461 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,9 @@ name: Test pipeline -on: pull_request +on: + pull_request: + paths: + - pmm-app/** jobs: build: @@ -29,6 +32,28 @@ jobs: path: pmm-app/dist/ if-no-files-found: error + unit_tests: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run with Node 16 + uses: actions/setup-node@v4 + with: + node-version: "16" + cache: "yarn" + cache-dependency-path: pmm-app/yarn.lock + + - name: Install deps + run: make prepare_release + + - name: Run lint + run: cd pmm-app && yarn lint:check + + - name: Run unit tests + run: cd pmm-app && yarn test + code_coverage: needs: build runs-on: ubuntu-latest @@ -57,7 +82,7 @@ jobs: run: make generate_coverage workflow_success: - needs: [code_coverage, build] + needs: [unit_tests, code_coverage, build] name: Slack Notification success runs-on: ubuntu-latest env: @@ -77,7 +102,7 @@ jobs: workflow_failure: if: ${{ failure() }} - needs: [code_coverage, build] + needs: [unit_tests, code_coverage, build] name: Slack Notification failure runs-on: ubuntu-latest env: diff --git a/.github/workflows/setup-page.yml b/.github/workflows/setup-page.yml new file mode 100644 index 0000000000..aab76a27d5 --- /dev/null +++ b/.github/workflows/setup-page.yml @@ -0,0 +1,29 @@ +name: Setup Page pipeline + +on: + pull_request: + paths: + - setup-page/** + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run with Node 18 + uses: actions/setup-node@v4 + with: + node-version: "18" + cache: "npm" + cache-dependency-path: setup-page/package-lock.json + + - name: Install deps + run: cd setup-page && npm ci + + - name: Run lint + run: cd setup-page && npm run lint + + - name: Run build + run: cd setup-page && npm run build diff --git a/pmm-app/package.json b/pmm-app/package.json index 6000ef0cda..aa00e15d6a 100644 --- a/pmm-app/package.json +++ b/pmm-app/package.json @@ -18,6 +18,7 @@ "dev": "npm run monkey-patch && grafana-toolkit plugin:dev", "watch": "npm run monkey-patch && grafana-toolkit plugin:dev --watch", "lint": "npm run lint:dev", + "lint:check": "eslint --ext .tsx,.ts src/", "lint:dev": "eslint --ext .tsx,.ts --fix src/", "jest": "jest", "codecov": "codecov" diff --git a/setup-page/.gitignore b/setup-page/.gitignore index b9e0dbb228..8357ce1b88 100644 --- a/setup-page/.gitignore +++ b/setup-page/.gitignore @@ -23,3 +23,4 @@ yarn-error.log* yarn.lock .parcel-cache dist +build