From d7b79f23a6afcfc5cdecebea1098eae2f48840c4 Mon Sep 17 00:00:00 2001 From: Ming Deng Date: Sat, 9 Jan 2021 21:15:48 +0800 Subject: [PATCH 1/3] Add sonar check action --- .github/workflows/sonar.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/sonar.yml diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml new file mode 100644 index 00000000..9c63eaac --- /dev/null +++ b/.github/workflows/sonar.yml @@ -0,0 +1,19 @@ +on: + # Trigger analysis when pushing in master or pull requests, and when creating + # a pull request. + pull_request: + types: [opened, synchronize, reopened] +name: Main Workflow +jobs: + sonarcloud: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + # Disabling shallow clone is recommended for improving relevancy of reporting + fetch-depth: 0 + - name: SonarCloud Scan + uses: sonarsource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file From 2590fbd5cb1276cbd220db08542c5a56478a6b9b Mon Sep 17 00:00:00 2001 From: Ming Deng Date: Sat, 9 Jan 2021 21:36:30 +0800 Subject: [PATCH 2/3] Fix sonar check --- .github/workflows/sonar.yml | 13 ++++++++----- CHANGELOG.md | 1 + sonar-project.properties | 6 ++++++ 3 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 sonar-project.properties diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index 9c63eaac..1a3b927a 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -1,9 +1,15 @@ on: # Trigger analysis when pushing in master or pull requests, and when creating # a pull request. + push: + branches: + - develop pull_request: types: [opened, synchronize, reopened] -name: Main Workflow +name: Sonar Check +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} jobs: sonarcloud: runs-on: ubuntu-latest @@ -13,7 +19,4 @@ jobs: # Disabling shallow clone is recommended for improving relevancy of reporting fetch-depth: 0 - name: SonarCloud Scan - uses: sonarsource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file + uses: sonarsource/sonarcloud-github-action@master \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 14c40055..ec59f070 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # developing +- Add sonar check. [4432](https://github.com/beego/beego/pull/4432) - Update changlog.yml to check every PR to develop branch.[4427](https://github.com/beego/beego/pull/4427) - Fix 4396: Add context.param module into adapter. [4398](https://github.com/beego/beego/pull/4398) - Remove `duration` from prometheus labels. [4391](https://github.com/beego/beego/pull/4391) diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..2fc78d8d --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,6 @@ +sonar.organization=beego +sonar.projectKey=beego_beego + +# relative paths to source directories. More details and properties are described +# in https://sonarcloud.io/documentation/project-administration/narrowing-the-focus/ +sonar.sources=. \ No newline at end of file From eed869a29671aa2732a52a36ed650754795e0ac5 Mon Sep 17 00:00:00 2001 From: Ming Deng Date: Sun, 10 Jan 2021 13:20:55 +0800 Subject: [PATCH 3/3] Remove sonar --- .github/workflows/sonar.yml | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 .github/workflows/sonar.yml diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml deleted file mode 100644 index 1a3b927a..00000000 --- a/.github/workflows/sonar.yml +++ /dev/null @@ -1,22 +0,0 @@ -on: - # Trigger analysis when pushing in master or pull requests, and when creating - # a pull request. - push: - branches: - - develop - pull_request: - types: [opened, synchronize, reopened] -name: Sonar Check -env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} -jobs: - sonarcloud: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - # Disabling shallow clone is recommended for improving relevancy of reporting - fetch-depth: 0 - - name: SonarCloud Scan - uses: sonarsource/sonarcloud-github-action@master \ No newline at end of file