SonarCloud #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SonarCloud | |
on: | |
schedule: | |
- cron: "0 5 * * 2,4,6" | |
# pull_request: | |
# types: | |
# - opened | |
# - synchronize | |
# - reopened | |
jobs: | |
gotest: | |
name: 'Generate Golang Test Reports' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: 'Checkout repo' | |
uses: actions/checkout@v4 | |
- name: 'Setup Go' | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 | |
with: | |
go-version: '1.22.3' | |
check-latest: false | |
cache-dependency-path: | | |
service/go.sum | |
sdk/go.sum | |
examples/go.sum | |
protocol/go/go.sum | |
- name: 'Generate Golang Test Reports' | |
run: go test -v -coverprofile coverage.out -json ./sdk/... ./service/... ./lib/ocrypto | tee coverage.json | |
- name: 'Cover report' | |
run: go tool cover -func=coverage.out | |
- name: 'Archive Golang Test Results' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage-report | |
path: coverage.* | |
retention-days: 3 | |
sonarcloud: | |
name: 'SonarCloud' | |
runs-on: ubuntu-latest | |
needs: [gotest] | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository | |
permissions: | |
contents: read | |
steps: | |
- name: 'Checkout repo' | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: 'Download Code Coverage Report' | |
uses: actions/download-artifact@v4 | |
with: | |
name: code-coverage-report | |
- name: 'SonarCloud Scan' | |
uses: SonarSource/sonarcloud-github-action@4006f663ecaf1f8093e8e4abb9227f6041f52216 #v2.2.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |