Created
November 25, 2019 21:53
-
-
Save GuillaumeLebeau/c5a1b15598526087586d092e74955096 to your computer and use it in GitHub Desktop.
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 Core | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: [windows-latest] | |
steps: | |
- uses: actions/checkout@v1 | |
# - name: Cache dotnet | |
# uses: actions/cache@v1 | |
# with: | |
# path: ~/.nuget/packages | |
# key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
# restore-keys: | | |
# ${{ runner.os }}-nuget- | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 2.2.108 | |
- name: Setup MSBuild.exe | |
uses: warrenbuckley/Setup-MSBuild@v1 | |
- name: Setup NuGet | |
uses: nuget/setup-nuget@v1 | |
with: | |
nuget-version: '5.x' | |
nuget-api-key: ${{ secrets.GITHUB_TOKEN }} | |
nuget-api-key-source: https://nuget.pkg.github.com/agileo-gle/index.json | |
- name: Generate code... | |
run: dotnet run --project "CodeGen/CodeGen.csproj" | |
- name: Build UnitsNet solution | |
run: dotnet build --configuration Release "UnitsNet.sln" | |
- name: Build WindowsRuntimeComponent solution | |
run: | | |
msbuild UnitsNet.WindowsRuntimeComponent.sln /verbosity:minimal /p:Configuration=Release /t:restore | |
msbuild UnitsNet.WindowsRuntimeComponent.sln /verbosity:minimal /p:Configuration=Release | |
- name: UnitsNet.Tests code coverage | |
working-directory: UnitsNet.Tests | |
run: | | |
dotnet dotcover test --no-build --dotCoverFilters="+:module=UnitsNet*;-:module=*Tests" --dotCoverOutput="${{ github.workspace }}/Artifacts/Coverage/UnitsNet.Tests.coverage.xml" --dcReportType=DetailedXML | |
- name: UnitsNet.Serialization.JsonNet.Tests code coverage | |
working-directory: UnitsNet.Serialization.JsonNet.Tests | |
run: | | |
dotnet dotcover test --no-build --dotCoverFilters="+:module=UnitsNet*;-:module=*Tests" --dotCoverOutput="${{ github.workspace }}/Artifacts/Coverage/UnitsNet.Serialization.JsonNet.Tests.coverage.xml" --dcReportType=DetailedXML | |
- name: UnitsNet.Serialization.JsonNet.CompatibilityTests code coverage | |
working-directory: UnitsNet.Serialization.JsonNet.CompatibilityTests | |
run: | | |
dotnet dotcover test --no-build --dotCoverFilters="+:module=UnitsNet*;-:module=*Tests" --dotCoverOutput="${{ github.workspace }}/Artifacts/Coverage/UnitsNet.Serialization.JsonNet.CompatibilityTests.coverage.xml" --dcReportType=DetailedXML | |
- name: Generate code coverage report | |
run: | | |
dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools | |
tools/reportgenerator.exe -reports:"${{ github.workspace }}/Artifacts/Coverage/*.coverage.xml" -targetdir:"${{ github.workspace }}/Artifacts/Coverage/Report" -reporttypes:"HtmlInline_AzurePipelines_Dark;lcov;Cobertura" -sourcedirs:"${{ github.workspace }}" | |
- name: Publish coverage to Codecov | |
run: | | |
dotnet tool install --global Codecov.Tool | |
codecov -f "${{ github.workspace }}/Artifacts/Coverage/Report/Cobertura.xml" -t ${{ secrets.CODECOV_TOKEN }} --flag unittests -n codecov-unitsnet --branch ${{ github.ref }} | |
- name: Generate packages | |
run: | | |
dotnet pack --configuration Release --no-build -o "${{ github.workspace }}/Artifacts/NuGet" "UnitsNet/UnitsNet.csproj" | |
dotnet pack --configuration Release --no-build -o "${{ github.workspace }}/Artifacts/NuGet" "UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj" | |
nuget pack "UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec" -Verbosity detailed -OutputDirectory "${{ github.workspace }}/Artifacts/NuGet" | |
- name: Publish packages | |
run: | | |
nuget push -Source https://nuget.pkg.github.com/agileo-gle/index.json -ApiKey ${{ secrets.GITHUB_TOKEN }} -Skip "${{ github.workspace }}\Artifacts\*.nupkg" | |
- name: Publish artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: artifacts | |
path: ${{ github.workspace }}/Artifacts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment