From e6daa1b68c5868fa96f7a3a21b987da19585d0ab Mon Sep 17 00:00:00 2001 From: Phuwathid Summaviwat <28344318+phwt@users.noreply.github.com> Date: Wed, 14 Aug 2024 19:48:56 +0700 Subject: [PATCH] Feature/refactor (#29) * refactor: merge `RUN` instruction with the consecutive ones * ci: upgrade `actions/checkout` and `actions/setup-node` to `v4` * ci/refactor: lock `SonarSource/sonarcloud-github-action` to `v2` * ci: exclude unit tests from duplication check * build: bump package version to `1.4.5` --- .github/workflows/main.yml | 7 ++++--- .github/workflows/pr.yml | 9 +++++---- Dockerfile | 3 +-- package.json | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index db0a10a..0877814 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,11 +15,11 @@ jobs: name: SonarCloud runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: cache: npm @@ -29,7 +29,7 @@ jobs: npm test - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master + uses: SonarSource/sonarcloud-github-action@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} @@ -38,6 +38,7 @@ jobs: -Dsonar.organization=phwt -Dsonar.projectKey=sonarqube-quality-gate-action -Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info + -Dsonar.cpd.exclusions=**/__tests__/*.ts - name: Wait for the quality gate result run: sleep 5 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 4b39dab..a924fa1 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -13,11 +13,11 @@ jobs: name: Check code quality on pull request branch runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: cache: npm @@ -27,7 +27,7 @@ jobs: npm test - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master + uses: SonarSource/sonarcloud-github-action@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} @@ -37,6 +37,7 @@ jobs: -Dsonar.projectKey=sonarqube-quality-gate-action -Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info -Dsonar.branch.name=${{ github.event.pull_request.head.ref }} + -Dsonar.cpd.exclusions=**/__tests__/*.ts - name: Wait for the quality gate result run: sleep 5 @@ -60,7 +61,7 @@ jobs: name: Retrieve quality gate result of the main branch runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/Dockerfile b/Dockerfile index c17be42..8087f49 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ FROM node:20-alpine COPY . . -RUN npm ci && npm install -g typescript -RUN tsc +RUN npm ci && npm install -g typescript && tsc ENTRYPOINT ["node", "/src/index.js"] diff --git a/package.json b/package.json index 6c2fb6d..87babfc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sonarqube-quality-gate-action", - "version": "1.4.4", + "version": "1.4.5", "description": "", "main": "index.js", "scripts": {