From dc7bd782e83b44d23eca72fc5d29fd5737266833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Jos=C3=A9=20Garc=C3=ADa=20Garc=C3=ADa?= Date: Tue, 29 Mar 2022 19:24:13 +0200 Subject: [PATCH 1/3] ci: add coverage --- .github/workflows/build.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3327cd4..0e5a46f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,7 +31,13 @@ jobs: # Runs a set of commands using the runners shell - name: Test - run: npm run test-jenkins + uses: mattallty/jest-github-action@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # this is just an example, this could be any command that will trigger jest + test-command: "npm run coverage-jenkins" + # Upload test results - uses: actions/upload-artifact@v2 From a97f906d6a166f8b4ac4e4da35a5ec8211c8acb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Jos=C3=A9=20Garc=C3=ADa=20Garc=C3=ADa?= Date: Tue, 29 Mar 2022 19:31:07 +0200 Subject: [PATCH 2/3] ci: only coverage dir --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0e5a46f..e7c5734 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,4 +44,5 @@ jobs: if: success() || failure() # run this step even if previous step failed with: name: test-results - path: ./coverage/test.results.xml \ No newline at end of file + path: | + ./coverage/ \ No newline at end of file From 9901f0e4cf095103b8c919c883a21b1e6d52d37e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Jos=C3=A9=20Garc=C3=ADa=20Garc=C3=ADa?= Date: Tue, 29 Mar 2022 19:38:46 +0200 Subject: [PATCH 3/3] ci: add lint --- .github/workflows/build.yml | 10 ++++++++++ package.json | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e7c5734..229b9b7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,6 +38,16 @@ jobs: # this is just an example, this could be any command that will trigger jest test-command: "npm run coverage-jenkins" + - name: Save Code Linting Report JSON + run: npm run lint:json + # Continue to the next step even if this fails + continue-on-error: true + + - name: Annotate Code Linting Results + uses: ataylorme/eslint-annotate-action@1.2.0 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + report-json: "./coverage/eslint-result.json" # Upload test results - uses: actions/upload-artifact@v2 diff --git a/package.json b/package.json index 96e93bc..2c419cb 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "test": "jest", "test-jenkins": "jest --reporters=default --reporters=jest-junit", "coverage-jenkins": "jest --reporters=default --reporters=jest-junit --coverage --coverageReporters=text --coverageReporters=html --coverageDirectory=./coverage/", - "lint": "eslint src/**/*.js -f checkstyle -o coverage/eslint-result.xml" + "lint": "eslint src/**/*.js -f checkstyle -o coverage/eslint-result.xml", + "lint:json": "eslint src/**/*.js --format json -o coverage/eslint-result.json" }, "jest-junit": { "outputDirectory": "./coverage/",