This repository has been archived by the owner on Feb 28, 2024. It is now read-only.
Sonar #853
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: Sonar | |
'on': | |
push: | |
branches: | |
- "**" | |
pull_request_target: | |
branches: | |
- "**" | |
types: [opened, synchronize, reopened, labeled] | |
schedule: | |
- cron: 0 16 * * * | |
workflow_dispatch: | |
jobs: | |
sonarcloud: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Check for external PR | |
if: ${{ !(contains(github.event.pull_request.labels.*.name, 'safe') || | |
github.event.pull_request.head.repo.full_name == github.repository || | |
github.event_name != 'pull_request_target') }} | |
run: echo "Unsecure PR, must be labelled with the 'safe' label, then run the workflow again" && exit 1 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.7 | |
- name: Setup java | |
uses: actions/setup-java@v1 | |
with: | |
java-version: '11' | |
- name: Install dependencies | |
run: > | |
wget | |
https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.3.0.1492.zip | |
unzip sonar-scanner-cli-3.3.0.1492.zip | |
bundle install --jobs=3 --retry=3 | |
- name: Run tests | |
run: | | |
gem build *.gemspec | |
gem install *.gem | |
rake test | |
- name: Sonar | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
SONAR_TOKEN: '${{ secrets.SONAR_TOKEN }}' | |
run: | | |
sonar-scanner-3.3.0.1492/bin/sonar-scanner \ | |
-Dsonar.sources=./lib \ | |
-Dsonar.tests=./test \ | |
-Dsonar.ruby.coverage.reportPaths=coverage/.resultset.json |