Skip to content

SonarCloud Analysis #955

SonarCloud Analysis

SonarCloud Analysis #955

Workflow file for this run

name: SonarCloud Analysis
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
schedule:
- cron: '00 6 * * *' # 06:00 UTC every day
jobs:
sonar:
if: github.repository == 'GoogleContainerTools/jib-extensions' # Only run on upstream branch
name: Build with Sonar
runs-on: ubuntu-20.04
steps:
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d' --utc)" >> $GITHUB_OUTPUT
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache SonarCloud packages
uses: actions/cache@v2
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar-${{ steps.date.outputs.date }}
- uses: actions/cache@v2
with:
path: |
~/.m2/repository
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Test w/ coverage
continue-on-error: true
run: |
cd first-party
./gradlew clean build jacocoTestReport --stacktrace
- name: Build and analyze
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
cd first-party
./gradlew sonarqube --stacktrace