fix: Fix build #175
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: Build | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "dev", "main" ] | |
pull_request: | |
branches: [ "dev", "main" ] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
configuration: [Debug, Release] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install .NET 7.0 | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.0.x | |
- name: Restore dependencies | |
run: dotnet restore src/Lavalink4NET.sln | |
- name: Build | |
run: dotnet build src/Lavalink4NET.sln --no-restore --configuration ${{ matrix.configuration }} /property:Version=4.0.0-beta.3-2 | |
- name: Run tests | |
working-directory: ci | |
run: dotnet test ../src/Lavalink4NET.sln --no-build --configuration ${{ matrix.configuration }} --verbosity normal --collect:"XPlat Code Coverage" --results-directory ../coverage | |
shell: bash | |
- name: Download artifact | |
id: download-artifact | |
if: github.event_name == 'pull_request' && matrix.configuration == 'Release' | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
github_token: ${{secrets.GITHUB_TOKEN}} | |
commit: ${{github.event.pull_request.base.sha}} | |
name: CoverageHistory.html | |
path: coverage/history/ | |
search_artifacts: true | |
if_no_artifact_found: ignore | |
- name: Code Coverage Report | |
run: | | |
dotnet tool install -g dotnet-reportgenerator-globaltool | |
reportgenerator -reports:coverage/**/coverage.cobertura.xml -targetdir:coverage/ -sourcedirs:src/ "-reporttypes:TextSummary;HtmlSummary;MarkdownDeltaSummary" -historydir:coverage/history | |
cat coverage/Summary.txt | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: CoverageSummary.html | |
path: coverage/summary.html | |
- name: Archive code coverage history | |
uses: actions/upload-artifact@v3 | |
with: | |
name: CoverageHistory.html | |
path: coverage/history/*.xml | |
- name: Add Coverage Pull Request Comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
if: github.event_name == 'pull_request' | |
continue-on-error: true | |
with: | |
recreate: true | |
path: coverage/DeltaSummary.md | |
- name: Publish NuGet artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: NuGet Packages-${{ matrix.configuration }} | |
path: '**/*.nupkg' |