ci: sonarcloud code analysis support

Squashed commit of the following:

commit 673f4b7441d910cf25dce6842552a06bf5f76490
Author: Robert Dailey <rcdailey@gmail.com>
Date:   Wed Nov 10 12:37:55 2021 -0600

    Add SonarCloud integration

commit 5dfe5cf7a2c2a96ecdc0c684c605334460efbf73
Author: Robert Dailey <rcdailey@gmail.com>
Date:   Wed Nov 10 12:46:40 2021 -0600

    Reformat YAML

commit d210104ffee6fea81304312588e9fa89fb1a86f0
Author: Robert Dailey <rcdailey@gmail.com>
Date:   Wed Nov 10 12:46:16 2021 -0600

    Remove stale comments in build.yml

commit 66f18519c39b1cece888d7028cd2056d2f8dfbe3
Author: Robert Dailey <rcdailey@gmail.com>
Date:   Wed Nov 10 12:44:28 2021 -0600

    Set up schema for build.yml
pull/47/head
Robert Dailey 3 years ago
parent 4dfd03d82c
commit d339a95825

@ -1,17 +1,18 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build & Test
on:
push:
paths-ignore:
- 'wiki/**'
- '**.md'
- "wiki/**"
- "**.md"
pull_request:
paths-ignore:
- 'wiki/**'
- '**.md'
- "wiki/**"
- "**.md"
env:
dotnetVersion: 6.0.x
dotnetVersion: "6.0.x"
jobs:
build:
@ -56,15 +57,56 @@ jobs:
name: trash
path: publish/zip/trash-*.zip
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
env:
DOTNET_ROLL_FORWARD: LatestMajor
GITHUB_TOKEN: ${{ secrets.PAT }}
steps:
- name: Get Source Code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup NBGV
uses: dotnet/nbgv@master
id: nbgv
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.dotnetVersion }}
- name: Install Sonar Scanner
run: dotnet tool install --global dotnet-sonarscanner
- name: Begin Sonar Scanner
run: >
dotnet sonarscanner begin
-o:"rcdailey"
-k:"rcdailey_trash-updater"
-n:"Trash Updater"
-v:"${{ steps.nbgv.outputs.SimpleVersion }}"
-d:"sonar.login=${{ secrets.SONAR_TOKEN }}"
-d:"sonar.host.url=https://sonarcloud.io"
- name: Build
run: dotnet build src
- name: Test
run: dotnet test src
- name: End Sonar Scanner
run: >
dotnet sonarscanner end
-d:"sonar.login=${{ secrets.SONAR_TOKEN }}"
release:
name: Release
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
# github.event.create.ref_type == 'tag'
# startsWith(github.event.push.ref, 'refs/heads/release/')
# github.event.pull_request.merged == true &&
# startsWith(github.event.pull_request.head.ref, 'release/')
steps:
- name: Checkout
uses: actions/checkout@v2

@ -2,6 +2,7 @@
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/rcdailey/trash-updater/blob/master/LICENSE)
![build status](https://github.com/rcdailey/trash-updater/actions/workflows/build.yml/badge.svg?branch=master)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=rcdailey_trash-updater&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=rcdailey_trash-updater)
[![GitHub release](https://img.shields.io/github/release/rcdailey/trash-updater.svg)](https://github.com/rcdailey/trash-updater/releases/)
[![Support Server](https://img.shields.io/discord/492590071455940612.svg?color=7289da&label=TRaSH-Guides&logo=discord&style=flat-square)](https://discord.com/invite/Vau8dZ3)

Loading…
Cancel
Save