# 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: runtime: [win-x64, win-arm64, linux-x64, linux-arm, linux-arm64, osx-x64, osx-arm64] # Must run on Windows so that version info gets properly set in host EXE. See: # https://github.com/dotnet/runtime/issues/3828 runs-on: windows-latest steps: - name: Checkout Source Code uses: actions/checkout@v2 with: fetch-depth: 0 # avoid shallow clone for GitVersion - 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 shell: pwsh run: ci/Publish.ps1 ${{ matrix.runtime }} - name: Smoke Test shell: pwsh run: ci/SmokeTest.ps1 ${{ matrix.runtime }} if: ${{ endsWith(matrix.runtime, 'linux-x64') }} - name: Upload Artifacts uses: actions/upload-artifact@v2 with: name: trash-${{ matrix.runtime }} path: publish/${{ matrix.runtime }}/* 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 GitVersion # token: ${{ secrets.GITHUB_TOKEN }} # Allows git push - name: Install GitVersion uses: gittools/actions/gitversion/setup@v0.9.7 with: versionSpec: 5.x - name: Determine Version uses: gittools/actions/gitversion/execute@v0.9.7 id: gitversion - name: Download Artifacts uses: actions/download-artifact@v2 with: path: publish - name: Create Zip Files shell: pwsh run: ci/CreateZip.ps1 publish - 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: publish-zip/trash-*.zip body: ${{ steps.changelog.outputs.release_notes }} tag_name: ${{ github.event.create.ref }} draft: false prerelease: ${{ steps.gitversion.outputs.preReleaseTag != '' }} 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 # avoid shallow clone for GitVersion - name: Setup dotnet uses: actions/setup-dotnet@v1 with: dotnet-version: ${{ env.dotnetVersion }} - name: Install GitVersion uses: gittools/actions/gitversion/setup@v0.9.7 with: versionSpec: 5.x - name: Determine Version uses: gittools/actions/gitversion/execute@v0.9.7 id: gitversion - 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.gitversion.outputs.fullSemVer }}" -d:sonar.login="${{ secrets.SONAR_TOKEN }}" -d:sonar.host.url="https://sonarcloud.io" -d:sonar.cs.opencover.reportsPaths="**/TestResults/*/coverage.opencover.xml" # Run a full build command because if we just do the tests, it will not build everything. - name: Build run: dotnet build src - name: Test run: > dotnet test src --no-build --collect:"XPLat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover - name: End Sonar Scanner run: > dotnet sonarscanner end -d:sonar.login="${{ secrets.SONAR_TOKEN }}"