Skip to content

SonarCloud

SonarCloud #117

Workflow file for this run

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.5'
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@383f7e52eae3ab0510c3cb0e7d9d150bbaeab838 #v3.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}