Skip to content

Merge pull request #165 from NycroV/dev #361

Merge pull request #165 from NycroV/dev

Merge pull request #165 from NycroV/dev #361

Workflow file for this run

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 8.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.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.19-beta.6
- 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@v4
continue-on-error: true
with:
name: CoverageSummary.html
path: coverage/summary.html
- name: Archive code coverage history
uses: actions/upload-artifact@v4
continue-on-error: true
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: Upload NuGet artifacts
uses: actions/upload-artifact@v3
with:
name: NuGet Packages-${{ matrix.configuration }}
path: '**/*.nupkg'
- name: Publish NuGet Packages
if: matrix.configuration == 'Release'
run: find . -type f -name "*.nupkg" -exec dotnet nuget push --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate {} ';'
shell: bash