From 1302b14799117728d3a6caddc0e83c84ab5cb688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Victor=20Gon=C3=A7alves?= Date: Mon, 19 Aug 2024 23:53:29 -0300 Subject: [PATCH] chore: adapt build action --- .github/workflows/build.yml | 31 +++++++++++++++++-------------- package.json | 4 +++- sonar-project.properties | 2 +- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d2fdb5c5..6714a948 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,27 +10,30 @@ on: jobs: sonarcloud: - name: SonarCloud + name: Test Unit & Sonar Scan runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v3 with: fetch-depth: 0 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + - name: Install dependencies - run: yarn - - name: Test and coverage - run: yarn jest --coverage + run: npm install --legacy-peer-deps + + - name: Linter + run: npm run lint:report + + - name: Tests & Coverage + run: npm run test:cov + - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - - name: Sincroniza cobertura de testes com o Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: true - flags: jest - name: 2023-2-GEROcuidado-Front - verbose: true diff --git a/package.json b/package.json index 24c7e35a..19d18a47 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,9 @@ "web": "expo start --web", "test": "jest --passWithNoTests --no-cache --runInBand --detectOpenHandles --coverage --colors", "test:all": "CI=true npm run test -- --coverage", - "lint": "eslint . --fix" + "lint": "eslint . --fix", + "lint:report": "eslint . --format json --output-file reports/lint-report.json", + "test:cov": "jest --runInBand --coverage --colors" }, "dependencies": { "@expo/metro-config": "^0.18.11", diff --git a/sonar-project.properties b/sonar-project.properties index 8add75c3..bd0d505b 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -19,4 +19,4 @@ sonar.junit.reportPaths=junit.xml sonar.tests=src sonar.test.inclusions=**/*.spec.ts,**/*.spec.tsx,**/*.spec.js,**/*.test.ts,**/*.test.tsx sonar.testExecutionReportPaths=reports/sonar-report.xml -sonar.typescript.tslint.reportPaths=reports/tslint-report.json +sonar.typescript.tslint.reportPaths=reports/lint-report.json