From 7b9a33419bbe2a17ba2e8c7342bf28da4fa8609c Mon Sep 17 00:00:00 2001 From: "deepsource-io[bot]" <42547082+deepsource-io[bot]@users.noreply.github.com> Date: Fri, 31 Mar 2023 21:21:30 +0000 Subject: [PATCH 1/5] ci: Add .deepsource.toml --- .deepsource.toml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .deepsource.toml diff --git a/.deepsource.toml b/.deepsource.toml new file mode 100644 index 0000000..2dfc466 --- /dev/null +++ b/.deepsource.toml @@ -0,0 +1,13 @@ +version = 1 + +[[analyzers]] +name = "javascript" + + [analyzers.meta] + plugins = ["react"] + +[[analyzers]] +name = "docker" + +[[analyzers]] +name = "test-coverage" \ No newline at end of file From affe51bddb0a95010a052fcd7ceb0e0f594e7356 Mon Sep 17 00:00:00 2001 From: Manuel Date: Fri, 31 Mar 2023 23:50:47 +0200 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=91=B7=20Remove=20Sonarcloud=20from?= =?UTF-8?q?=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .deepsource.toml | 5 +- .github/workflows/sonarcloud.yml | 85 -------------------------------- 2 files changed, 1 insertion(+), 89 deletions(-) delete mode 100644 .github/workflows/sonarcloud.yml diff --git a/.deepsource.toml b/.deepsource.toml index 2dfc466..2ebcef1 100644 --- a/.deepsource.toml +++ b/.deepsource.toml @@ -7,7 +7,4 @@ name = "javascript" plugins = ["react"] [[analyzers]] -name = "docker" - -[[analyzers]] -name = "test-coverage" \ No newline at end of file +name = "docker" \ No newline at end of file diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml deleted file mode 100644 index efaed3a..0000000 --- a/.github/workflows/sonarcloud.yml +++ /dev/null @@ -1,85 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# This workflow helps you trigger a SonarCloud analysis of your code and populates -# GitHub Code Scanning alerts with the vulnerabilities found. -# Free for open source project. - -# 1. Login to SonarCloud.io using your GitHub account - -# 2. Import your project on SonarCloud -# * Add your GitHub organization first, then add your repository as a new project. -# * Please note that many languages are eligible for automatic analysis, -# which means that the analysis will start automatically without the need to set up GitHub Actions. -# * This behavior can be changed in Administration > Analysis Method. -# -# 3. Follow the SonarCloud in-product tutorial -# * a. Copy/paste the Project Key and the Organization Key into the args parameter below -# (You'll find this information in SonarCloud. Click on "Information" at the bottom left) -# -# * b. Generate a new token and add it to your Github repository's secrets using the name SONAR_TOKEN -# (On SonarCloud, click on your avatar on top-right > My account > Security -# or go directly to https://sonarcloud.io/account/security/) - -# Feel free to take a look at our documentation (https://docs.sonarcloud.io/getting-started/github/) -# or reach out to our community forum if you need some help (https://community.sonarsource.com/c/help/sc/9) - -name: SonarCloud analysis - -on: - push: - branches: [ "master", "dev" ] - pull_request: - branches: [ "master", "dev" ] - workflow_dispatch: - -permissions: - pull-requests: read # allows SonarCloud to decorate PRs with analysis results - -jobs: - Analysis: - runs-on: ubuntu-latest - - steps: - - name: Setup - uses: actions/setup-node@v3 - - name: Checkout - uses: actions/checkout@v3 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn config get cacheFolder)" - - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - run: yarn test:cov - - name: Analyze with SonarCloud - - # You can pin the exact commit or the version. - # uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049 - uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret) - with: - # Additional arguments for the sonarcloud scanner - args: - # Unique keys of your project and organization. You can find them in SonarCloud > Information (bottom-left menu) - # mandatory - -Dsonar.projectKey=manuel-rw_jellyfin-discord-music-bot - -Dsonar.organization=manuel-rw - -Dsonar.javascript.lcov.reportPaths=coverage/lcov.info - # Comma-separated paths to directories containing main source files. - #-Dsonar.sources= # optional, default is project base directory - # When you need the analysis to take place in a directory other than the one from which it was launched - #-Dsonar.projectBaseDir= # optional, default is . - # Comma-separated paths to directories containing test source files. - #-Dsonar.tests= # optional. For more info about Code Coverage, please refer to https://docs.sonarcloud.io/enriching/test-coverage/overview/ - # Adds more detail to both client and server-side analysis logs, activating DEBUG mode for the scanner, and adding client-side environment variables and system properties to the server-side log of analysis report processing. - #-Dsonar.verbose= # optional, default is false From 23fbfdc6bee4f7cd6d6a1197f002ab8aa6502602 Mon Sep 17 00:00:00 2001 From: Manuel Date: Sat, 1 Apr 2023 12:21:37 +0200 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=91=B7=20Add=20test=20coverage=20for?= =?UTF-8?q?=20deepsource?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .deepsource.toml | 6 ++- .github/workflows/deepsource-tests.yml | 58 ++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deepsource-tests.yml diff --git a/.deepsource.toml b/.deepsource.toml index 2ebcef1..0c1cb01 100644 --- a/.deepsource.toml +++ b/.deepsource.toml @@ -7,4 +7,8 @@ name = "javascript" plugins = ["react"] [[analyzers]] -name = "docker" \ No newline at end of file +name = "docker" + +[[analyzers]] +name = "test-coverage" +enabled = true \ No newline at end of file diff --git a/.github/workflows/deepsource-tests.yml b/.github/workflows/deepsource-tests.yml new file mode 100644 index 0000000..703f3fa --- /dev/null +++ b/.github/workflows/deepsource-tests.yml @@ -0,0 +1,58 @@ +name: Deepsource report test coverage +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +on: + push: + branches: [dev,master] + paths-ignore: + - '.github/**' + - 'images/' + - '*.md' + pull_request: + branches: + - master + - dev + + workflow_dispatch: + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + +jobs: + report-test-coverage: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Setup + uses: actions/setup-node@v3 + - name: Checkout + uses: actions/checkout@v3 + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn config get cacheFolder)" + - uses: actions/cache@v3 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - run: yarn install --immutable + - run: yarn test:cov + - run: curl https://deepsource.io/cli | sh + - name: Report test-coverage to DeepSource + run: | + # Install the CLI + curl https://deepsource.io/cli | sh + + # Send the report to DeepSource + ./bin/deepsource report --analyzer test-coverage --key javascript --value-file ./coverage/clover.xml + env: + DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }} \ No newline at end of file From 7cb730186db7ac7dca9d78e76b6f0a1df77d688a Mon Sep 17 00:00:00 2001 From: Manuel Date: Sat, 1 Apr 2023 12:56:06 +0200 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=93=9D=20Add=20deepsource=20badge=20i?= =?UTF-8?q?n=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a6316aa..2a04b8b 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@

+


From 41c98a3c9c7ae125a56bbf4f70bec94e4c39a762 Mon Sep 17 00:00:00 2001 From: Manuel Date: Sat, 1 Apr 2023 13:02:59 +0200 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=91=B7=20Fix=20coverage=20file=20for?= =?UTF-8?q?=20deepsource?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deepsource-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deepsource-tests.yml b/.github/workflows/deepsource-tests.yml index 703f3fa..7b8b523 100644 --- a/.github/workflows/deepsource-tests.yml +++ b/.github/workflows/deepsource-tests.yml @@ -53,6 +53,6 @@ jobs: curl https://deepsource.io/cli | sh # Send the report to DeepSource - ./bin/deepsource report --analyzer test-coverage --key javascript --value-file ./coverage/clover.xml + ./bin/deepsource report --analyzer test-coverage --key javascript --value-file ./coverage/lcov.info env: DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }} \ No newline at end of file