You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
3.9 KiB
144 lines
3.9 KiB
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
|
name: Build & Test
|
|
|
|
on:
|
|
push:
|
|
paths-ignore:
|
|
- "wiki/**"
|
|
- "**.md"
|
|
pull_request:
|
|
paths-ignore:
|
|
- "wiki/**"
|
|
- "**.md"
|
|
|
|
env:
|
|
dotnetVersion: "6.0.x"
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
include:
|
|
- runtime: win-x64
|
|
image: windows-latest
|
|
- runtime: linux-x64
|
|
image: ubuntu-latest
|
|
- runtime: osx-x64
|
|
image: macos-latest
|
|
# Must run on Windows so that version info gets properly set in host EXE. See:
|
|
# https://github.com/dotnet/runtime/issues/3828
|
|
runs-on: ${{ matrix.image }}
|
|
steps:
|
|
- name: Checkout Source Code
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0 # avoid shallow clone for NBGV
|
|
|
|
- uses: dotnet/nbgv@master
|
|
id: nbgv
|
|
|
|
- name: Setup .NET Core SDK ${{ env.dotnetVersion }}
|
|
uses: actions/setup-dotnet@v1
|
|
with:
|
|
dotnet-version: ${{ env.dotnetVersion }}
|
|
|
|
- name: Test
|
|
run: dotnet test src --configuration Release --logger GitHubActions
|
|
|
|
- name: Publish & Zip
|
|
shell: pwsh
|
|
run: ci/PublishAndZip.ps1 ${{ matrix.runtime }}
|
|
|
|
- name: Upload Artifacts
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
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"
|
|
-d:sonar.cs.opencover.reportsPaths="**/TestResults/*/coverage.opencover.xml"
|
|
|
|
- name: Test
|
|
run: dotnet test src --collect:"XPLat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
|
|
|
|
- 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')
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0 # avoid shallow clone for NBGV
|
|
# token: ${{ secrets.GITHUB_TOKEN }} # Allows git push
|
|
|
|
- name: Set up NBGV
|
|
uses: dotnet/nbgv@master
|
|
id: nbgv
|
|
|
|
- name: Verify tag matches version.json
|
|
if: endsWith(github.ref, steps.nbgv.outputs.SimpleVersion) != true
|
|
run: |
|
|
echo "The tag ${{ github.ref }} does not match version.json: ${{ steps.nbgv.outputs.SimpleVersion }}"
|
|
exit 1
|
|
|
|
- name: Download Artifacts
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: trash
|
|
|
|
- name: Extract Changelog
|
|
id: changelog
|
|
uses: ffurrer2/extract-release-notes@v1
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.PAT }}
|
|
with:
|
|
files: trash-*.zip
|
|
body: ${{ steps.changelog.outputs.release_notes }}
|
|
tag_name: ${{ github.event.create.ref }}
|
|
draft: false
|
|
prerelease: ${{ steps.nbgv.outputs.PrereleaseVersion != '' }}
|