Browse Source

Update codecov calc and use inbuild ref source/targets

pull/1089/head
James Jackson-South 6 years ago
parent
commit
e6f8d46c4f
  1. 51
      .github/workflows/build-and-test.yml
  2. 2
      .gitignore
  3. 3
      Directory.Build.props
  4. 4
      ImageSharp.sln
  5. 15
      ci-build.ps1
  6. 11
      ci-pack.ps1
  7. 10
      tests/Directory.Build.targets
  8. 2
      tests/ImageSharp.Tests/ImageSharp.Tests.csproj
  9. 11
      tests/NuGet.config

51
.github/workflows/build-and-test.yml

@ -82,7 +82,7 @@ jobs:
shell: pwsh
run: ./ci-test.ps1 "${{matrix.options.os}}" "${{matrix.options.framework}}" "${{matrix.options.runtime}}" "${{matrix.options.codecov}}"
env:
CI : True
CI: True
XUNIT_PATH: .\tests\ImageSharp.Tests # Required for xunit
- name: Update Codecov
@ -93,13 +93,54 @@ jobs:
file: "coverage.${{matrix.options.framework}}.xml"
flags: unittests
- name: Pack # We can use this filter as we know it happens only once and takes the most time to complete.
if: (github.event_name == 'push') && (matrix.options.codecov == true)
Publish:
needs: [Build]
runs-on: windows-latest
if: (github.event_name == 'push')
steps:
- uses: actions/checkout@v2
- name: Install NuGet
uses: NuGet/setup-nuget@v1
- name: Setup Git
shell: bash
run: |
git config --global core.autocrlf false
git config --global core.longpaths true
git fetch --prune --unshallow
git submodule -q update --init --recursive
- name: Fetch Tags for GitVersion
run: |
git fetch --tags
- name: Fetch master for GitVersion
if: github.ref != 'refs/heads/master'
run: git branch --create-reflog master origin/master
- name: Install GitVersion
uses: gittools/actions/setup-gitversion@v0.3
with:
versionSpec: "5.1.x"
- name: Use GitVersion
id: gitversion # step id used as reference for output values
uses: gittools/actions/execute-gitversion@v0.3
- name: Setup DotNet SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: "3.1.101"
- name: Pack
shell: pwsh
run: ./ci-build.ps1 "${{steps.gitversion.outputs.nuGetVersion}}"
run: ./ci-pack.ps1 "${{steps.gitversion.outputs.nuGetVersion}}"
- name: Publish to MyGet
if: (github.event_name == 'push') && (matrix.options.codecov == true)
shell: pwsh
run: nuget.exe push .\artifacts\*.nupkg ${{secrets.MYGET_TOKEN}} -Source https://www.myget.org/F/sixlabors/api/v2/package
# TODO: If github.ref starts with 'refs/tags' then it was tag push and we can optionally push out package to nuget.org

2
.gitignore

@ -216,7 +216,7 @@ artifacts/
*.csproj.bak
#CodeCoverage
/ImageSharp.Coverage.xml
*.lcov
# Tests
**/Images/ActualOutput

3
Directory.Build.props

@ -91,8 +91,9 @@
<RepositoryType>git</RepositoryType>
<RestoreSources>
https://www.myget.org/F/sixlabors/api/v3/index.json;
https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
https://api.nuget.org/v3/index.json;
<!-- Contains RemoteExecutor. Taken from: https://github.com/dotnet/runtime/blob/master/NuGet.config -->
https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json;
</RestoreSources>
<SixLaborsPublicKey>002400000c8000009400000006020000002400005253413100040000010001000147e6fe6766715eec6cfed61f1e7dcdbf69748a3e355c67e9d8dfd953acab1d5e012ba34b23308166fdc61ee1d0390d5f36d814a6091dd4b5ed9eda5a26afced924c683b4bfb4b3d64b0586a57eff9f02b1f84e3cb0ddd518bd1697f2c84dcbb97eb8bb5c7801be12112ed0ec86db934b0e9a5171e6bb1384b6d2f7d54dfa97</SixLaborsPublicKey>
<UseSharedCompilation>true</UseSharedCompilation>

4
ImageSharp.sln

@ -10,6 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.gitignore = .gitignore
.gitmodules = .gitmodules
ci-build.ps1 = ci-build.ps1
ci-pack.ps1 = ci-pack.ps1
ci-test.ps1 = ci-test.ps1
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
@ -44,7 +45,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{56801022
ProjectSection(SolutionItems) = preProject
tests\Directory.Build.props = tests\Directory.Build.props
tests\Directory.Build.targets = tests\Directory.Build.targets
tests\NuGet.config = tests\NuGet.config
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Images", "Images", "{FA55F5DE-11A6-487D-ABA4-BC93A02717DD}"
@ -330,7 +330,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SharedInfrastructure", "shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.shproj", "{68A8CC40-6AED-4E96-B524-31B1158FDEEA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageSharp.Tests.ProfilingSandbox", "tests\ImageSharp.Tests.ProfilingSandbox\ImageSharp.Tests.ProfilingSandbox.csproj", "{FC527290-2F22-432C-B77B-6E815726B02C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageSharp.Tests.ProfilingSandbox", "tests\ImageSharp.Tests.ProfilingSandbox\ImageSharp.Tests.ProfilingSandbox.csproj", "{FC527290-2F22-432C-B77B-6E815726B02C}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution

15
ci-build.ps1

@ -1,20 +1,13 @@
param(
[Parameter(Mandatory, Position = 0)]
[string]$version,
[Parameter(Mandatory = $false, Position = 1)]
[string]$targetFramework = 'ALL'
[Parameter(Mandatory = $true, Position = 1)]
[string]$targetFramework
)
dotnet clean -c Release
$repositoryUrl = "https://github.com/$env:GITHUB_REPOSITORY"
if ($targetFramework -ne 'ALL') {
# Building for a specific framework.
dotnet build -c Release -f $targetFramework /p:packageversion=$version /p:RepositoryUrl=$repositoryUrl
}
else {
# Building for packing and publishing.
dotnet pack -c Release --output "$PSScriptRoot/artifacts" /p:packageversion=$version /p:RepositoryUrl=$repositoryUrl
}
# Building for a specific framework.
dotnet build -c Release -f $targetFramework /p:packageversion=$version /p:RepositoryUrl=$repositoryUrl

11
ci-pack.ps1

@ -0,0 +1,11 @@
param(
[Parameter(Mandatory, Position = 0)]
[string]$version
)
dotnet clean -c Release
$repositoryUrl = "https://github.com/$env:GITHUB_REPOSITORY"
# Building for packing and publishing.
dotnet pack -c Release --output "$PSScriptRoot/artifacts" /p:packageversion=$version /p:RepositoryUrl=$repositoryUrl

10
tests/Directory.Build.targets

@ -28,10 +28,12 @@
<PropertyGroup Condition="'$(codecov)' == 'true' AND '$(IsTestProject)' == 'true'">
<CollectCoverage>true</CollectCoverage>
<UseSourceLink>true</UseSourceLink>
<CoverletOutputFormat>opencover</CoverletOutputFormat>
<Include>[SixLabors.*]*</Include>
<CoverletOutputFormat>lcov</CoverletOutputFormat>
<!--Output injects target framework into name despite explicit config. See build yml-->
<CoverletOutput>$(MSBuildThisFileDirectory)..\coverage.xml</CoverletOutput>
<!--Used by coverlet dues to reference issues with SixLabors.Core-->
<CoverletOutputPath>$(MSBuildThisFileDirectory)..\</CoverletOutputPath>
<CoverletOutput>$(CoverletOutputPath)$(AssemblyName).$(TargetFramework).lcov</CoverletOutput>
<!--Used by coverlet dues to reference issues-->
<!--https://github.com/tonerdo/coverlet/blob/master/Documentation/KnowIssues.md#4-failed-to-resolve-assembly-during-instrumentation-->
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
@ -43,11 +45,11 @@
<PackageReference Update="coverlet.collector" Version="1.1.0" PrivateAssets="All"/>
<PackageReference Update="coverlet.msbuild" Version="2.8.0" PrivateAssets="All"/>
<PackageReference Update="Magick.NET-Q16-AnyCPU" Version="7.14.4" />
<PackageReference Update="Microsoft.DotNet.RemoteExecutor" Version="5.0.0-beta.20069.1" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Update="Moq" Version="4.10.0" />
<PackageReference Update="Pfim" Version="0.9.1" />
<PackageReference Update="System.Drawing.Common" Version="4.7.0" />
<!--TODO: Fix implicit conversion issues so we can move to 2.4.1-->
<PackageReference Update="xunit" Version="2.4.1" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.4.1" />
</ItemGroup>

2
tests/ImageSharp.Tests/ImageSharp.Tests.csproj

@ -18,9 +18,9 @@
<ItemGroup>
<PackageReference Include="Magick.NET-Q16-AnyCPU" />
<PackageReference Include="Microsoft.DotNet.RemoteExecutor" />
<PackageReference Include="Moq" />
<PackageReference Include="System.Drawing.Common" />
<PackageReference Include="Microsoft.DotNet.RemoteExecutor" Version="5.0.0-beta.20069.1" />
</ItemGroup>
<ItemGroup>

11
tests/NuGet.config

@ -1,11 +0,0 @@
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<!--
Contains RemoteExecutor. Taken from:
https://github.com/dotnet/runtime/blob/master/NuGet.config
-->
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
</packageSources>
</configuration>
Loading…
Cancel
Save