From cab82a7f98e6deb0c8a64780ff8449f18a6ab75e Mon Sep 17 00:00:00 2001 From: Thahsan Mohomed Date: Tue, 17 Dec 2024 21:34:40 +0530 Subject: [PATCH] ci: fix PR check worflow - Added jest-junit reporting - Fixed test job - Removed unnecessary reports from lint and typecheck jobs --- .github/workflows/pr-check.yml | 40 +++++----------------------------- .gitignore | 3 +++ package.json | 9 ++++++++ yarn.lock | 20 +++++++++++++++++ 4 files changed, 37 insertions(+), 35 deletions(-) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index e336149..3bcdca8 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -44,15 +44,6 @@ jobs: include-hidden-files: true if-no-files-found: error - # - name: Upload yarn cache - # id: cache-deps - # uses: actions/cache@v3 - # with: - # path: | - # ~/.cache/yarn - # node_modules - # key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - run-lint: name: Lint runs-on: ubuntu-latest @@ -84,17 +75,6 @@ jobs: - name: Run lint run: yarn lint - - name: Lint Report - uses: dorny/test-reporter@v1 - if: success() - with: - name: Lint - - - name: Lint Summary - uses: test-summary/action@v2 - with: - paths: 'reports/lint.xml' - run-tests: name: Test runs-on: ubuntu-latest @@ -128,16 +108,17 @@ jobs: - name: Test Report uses: dorny/test-reporter@v1 - if: success() + if: success() || failure() with: - name: Tests - path: reports/junit.xml + name: Lint + path: reports/test-results.xml reporter: jest-junit - name: Test Summary uses: test-summary/action@v2 + if: always() with: - paths: 'reports/junit.xml' + paths: 'reports/test-results.xml' run-typecheck: name: Type Check @@ -169,14 +150,3 @@ jobs: - name: Run type check run: yarn typecheck - - - name: Type Check Report - uses: dorny/test-reporter@v1 - if: success() - with: - name: Type Check - - - name: Type Check Summary - uses: test-summary/action@v2 - with: - paths: 'reports/typecheck.xml' diff --git a/.gitignore b/.gitignore index cfe2bb4..a34acd9 100644 --- a/.gitignore +++ b/.gitignore @@ -80,3 +80,6 @@ lib/ # React Native Codegen ios/generated android/generated + +# Generated by tools +reports/* diff --git a/package.json b/package.json index 9d5ba24..1a83af9 100644 --- a/package.json +++ b/package.json @@ -75,6 +75,7 @@ "eslint-config-prettier": "^9.0.0", "eslint-plugin-prettier": "^5.0.1", "jest": "^29.7.0", + "jest-junit": "^16.0.0", "prettier": "^3.0.3", "react": "18.2.0", "react-native": "0.75.4", @@ -102,8 +103,16 @@ "modulePathIgnorePatterns": [ "/example/node_modules", "/lib/" + ], + "reporters": [ + "default", + "jest-junit" ] }, + "jest-junit": { + "outputDirectory": "reports", + "outputName": "test-results.xml" + }, "commitlint": { "extends": [ "@commitlint/config-conventional" diff --git a/yarn.lock b/yarn.lock index a6008ef..cd0cf3b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9402,6 +9402,18 @@ __metadata: languageName: node linkType: hard +"jest-junit@npm:^16.0.0": + version: 16.0.0 + resolution: "jest-junit@npm:16.0.0" + dependencies: + mkdirp: ^1.0.4 + strip-ansi: ^6.0.1 + uuid: ^8.3.2 + xml: ^1.0.1 + checksum: 412aa4bfeec4254a9b34f417fda79107c7cbd295e56ffeb299ac9c977545910fbabe57c91c6cd1f12b700d4a1f60f79872b0075003f02da87d463e30fc2d9d78 + languageName: node + linkType: hard + "jest-leak-detector@npm:^29.7.0": version: 29.7.0 resolution: "jest-leak-detector@npm:29.7.0" @@ -12359,6 +12371,7 @@ __metadata: eslint-config-prettier: ^9.0.0 eslint-plugin-prettier: ^5.0.1 jest: ^29.7.0 + jest-junit: ^16.0.0 prettier: ^3.0.3 react: 18.2.0 react-native: 0.75.4 @@ -15173,6 +15186,13 @@ __metadata: languageName: node linkType: hard +"xml@npm:^1.0.1": + version: 1.0.1 + resolution: "xml@npm:1.0.1" + checksum: 11b5545ef3f8fec3fa29ce251f50ad7b6c97c103ed4d851306ec23366f5fa4699dd6a942262df52313a0cd1840ab26256da253c023bad3309d8ce46fe6020ca0 + languageName: node + linkType: hard + "xmlbuilder@npm:^14.0.0": version: 14.0.0 resolution: "xmlbuilder@npm:14.0.0"