Central Package Management #612
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: .NET | |
on: | |
push: | |
pull_request: | |
merge_group: | |
permissions: | |
statuses: write | |
checks: write | |
contents: write | |
pull-requests: write | |
actions: write | |
packages: write | |
jobs: | |
Build: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '9.0.x' | |
dotnet-quality: 'preview' | |
- name: Pack | |
# TODO decide whether we want experimental builds to use Debug or Release - using Release for now... | |
run: >- | |
dotnet run --project eng/build/Silk.NET.NUKE.csproj -c Release -- | |
Pack | |
--configuration Release | |
--msbuild-properties | |
VersionSuffix=${{ github.event_name != 'pull_request' && format('build{0}.0', github.run_number) || format('pr{0}.{1}', github.event.number, github.run_number) }} | |
ContinuousIntegrationBuild=true | |
- name: Upload Unsigned Artifacts to Actions | |
uses: actions/upload-artifact@v4 | |
with: | |
name: unsigned_nupkgs | |
path: "artifacts/**/*nupkg" | |
if-no-files-found: warn | |
retention-days: 1 | |
- name: Push to Experimental Feed | |
if: ${{ github.repository == 'dotnet/Silk.NET' }} | |
run: ./build.sh PushToNuGet --skip Clean Compile Pack --nuget-feed https://dotnet.github.io/Silk.NET/nuget/experimental/index.json --nuget-username ${{ secrets.EXP_NUGET_USERNAME }} --nuget-password ${{ secrets.EXP_NUGET_PASSWORD }} --nuget-api-key ${{ secrets.EXP_NUGET_PASSWORD }} | |
- name: Push to GitHub Packages | |
if: ${{ github.repository == 'dotnet/Silk.NET' }} | |
run: ./build.sh PushToNuGet --skip Clean Compile Pack --nuget-feed https://nuget.pkg.github.com/dotnet/index.json --nuget-api-key ${{ secrets.GITHUB_TOKEN }} | |
Test: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- rid: win-x64 | |
os: windows-latest | |
name: win-x64 | |
- rid: linux-x64 | |
os: ubuntu-20.04 | |
name: linux-x64 | |
- rid: osx-arm64 | |
os: macos-latest | |
name: osx-arm64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.0.x' | |
dotnet-quality: 'preview' | |
- name: Restore | |
run: dotnet restore --runtime ${{ matrix.rid }} | |
- name: Test | |
run: dotnet test -c Release --no-restore --runtime ${{ matrix.rid }} --collect:"XPlat Code Coverage" --results-directory ./coverage --logger:"trx" | |
- name: Test Report | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() | |
with: | |
name: .NET Test Report (${{ matrix.rid }}) | |
path: ./coverage/**/*.trx | |
reporter: dotnet-trx | |
- name: Upload Coverage Results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-${{ matrix.name }} | |
path: ./coverage/**/coverage.cobertura.xml | |
Report-Coverage: | |
runs-on: ubuntu-latest | |
needs: Test | |
permissions: | |
pull-requests: write | |
checks: write | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
path: ./coverage | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 6.0.300 | |
- name: Generate Report | |
uses: danielpalme/[email protected] | |
with: | |
reports: './coverage/**/**/coverage.cobertura.xml' | |
targetdir: './coveragereport' | |
reporttypes: 'Cobertura' | |
verbosity: 'Info' | |
tag: '${{ github.run_number }}_${{ github.run_id }}' | |
- uses: 5monkeys/cobertura-action@master | |
continue-on-error: true | |
with: | |
path: coveragereport/Cobertura.xml | |
minimum_coverage: 0 |