From bd2276e8ec877a02bc2feafd6eb4db07d6d33e30 Mon Sep 17 00:00:00 2001 From: Kirill Gavrilov Date: Wed, 18 May 2022 21:48:54 +0300 Subject: [PATCH] ci: perform sonar scan with CI --- .github/workflows/ci.yml | 14 ++++++++++++-- sonar-project.properties | 6 ++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 sonar-project.properties diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 72ac11b..23f4e17 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,16 +2,26 @@ name: Build on: push: - branches: "**" + branches: + - '**' pull_request: - branches: [master] + types: [opened, synchronize, reopened] jobs: Build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - name: Install dependencies run: npm ci - name: Build run: npm run build + - name: Test + run: npm run test + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..b94d575 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,6 @@ +sonar.projectKey=gavvvr_obsidian-imgur-plugin +sonar.organization=gavvvr + +sonar.sources=src +sonar.tests=test +sonar.javascript.lcov.reportPaths=./coverage/lcov.info