diff --git a/.github/scripts/code-coverage.sh b/.github/scripts/code-coverage.sh deleted file mode 100755 index 4557708..0000000 --- a/.github/scripts/code-coverage.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -GOPATH=`go env GOPATH 2>/dev/null` -go test -v ./... -coverprofile cover.out diff --git a/.github/scripts/test.sh b/.github/scripts/test.sh index c2e17a9..f72ecea 100755 --- a/.github/scripts/test.sh +++ b/.github/scripts/test.sh @@ -38,6 +38,6 @@ perform() { check go "needs go from http://golang.org" -perform tests go test -v ./... +perform tests go test -v ./... -coverprofile cover.out echo "\x1B[38;5;2msuccess.\x1B[0m" diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml deleted file mode 100644 index 0a9defc..0000000 --- a/.github/workflows/code-coverage.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: omise-go code-coverage - -on: - push: - -jobs: - sonarcloud: - name: SonarCloud - runs-on: ubuntu-latest - env: - GOPATH: ${{ github.workspace }} - WORKDIR: src/github.com/${{ github.repository }} - - strategy: - matrix: - go: [ '1.21', '1.20', '1.19', '1.18', '1.17' ] - steps: - - name: Set up Go ${{ matrix.go }} - uses: actions/setup-go@v4 - with: - go-version: ${{ matrix.go }} - cache: false - - - name: Check out code into the Go module directory - uses: actions/checkout@v4 - with: - fetch-depth: 0 - path: ${{ env.WORKDIR }} - - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - version: v1.54 - working-directory: ${{ env.WORKDIR }} - - - name: Build - working-directory: ${{ env.WORKDIR }} - run: .github/scripts/setup.sh - - - name: Generate coverage - working-directory: ${{ env.WORKDIR }} - env: - OMISE_PKEY: pkey_test_xxx - OMISE_SKEY: skey_test_xxx - run: .github/scripts/code-coverage.sh - - - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master - with: - projectBaseDir: ${{ env.WORKDIR }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/v1-ci.yml b/.github/workflows/v1-ci.yml index 323d069..7f36fda 100644 --- a/.github/workflows/v1-ci.yml +++ b/.github/workflows/v1-ci.yml @@ -47,3 +47,12 @@ jobs: OMISE_SKEY: skey_test_xxx GOPATH: ${{ github.workspace }} run: .github/scripts/test.sh + + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + if: matrix.go == '1.21' + with: + projectBaseDir: ${{ env.WORKDIR }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/sonar-project.properties b/sonar-project.properties index b328731..74d802d 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,5 +1,5 @@ sonar.projectKey=omise_omise-go sonar.organization=omise -sonar.go.coverage.reportPaths=src/github.com/omise/omise-go/cover.out +sonar.go.coverage.reportPaths=cover.out sonar.exclusions=internal/testutil/** sonar.coverage.exclusions=**/*_test.go, /vendor/**, /testdata/**