Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
bb55ac8
add "macos-latest" to build matrix
antonfirsov Aug 3, 2020
5d4cf9e
try installing "mono-libgdiplus"
antonfirsov Aug 3, 2020
525fdbd
add "shell: bash"
antonfirsov Aug 3, 2020
0f076c8
try 'macos-10.15'
antonfirsov Aug 3, 2020
f087dee
try ${{matrix.options.os}}
antonfirsov Aug 3, 2020
921aa06
next hack to try
antonfirsov Aug 3, 2020
ff14733
if: startsWith(matrix.options.os, 'macos')
antonfirsov Aug 3, 2020
95dfbd0
Merge remote-tracking branch 'origin/af/macos-ci' into af/macos-libgd…
AlexNDRmac Oct 26, 2020
eb7e80f
Add Nuget cache, improve build matrix
AlexNDRmac Oct 26, 2020
fe06e3b
Add support using libgdiplus on macOS
AlexNDRmac Oct 26, 2020
e587161
Fix incompatible package reference for OSX
AlexNDRmac Oct 26, 2020
8527b2c
Revert syntax for workflow, move osx package to build targets
AlexNDRmac Oct 27, 2020
902fbaa
Remove setup netcore action
AlexNDRmac Oct 28, 2020
3fc0b60
Disable nuget packages cache
AlexNDRmac Oct 28, 2020
734aca2
Do not run windows specific tests on macOS
AlexNDRmac Oct 30, 2020
a4bf8b7
Decorate OSX specific tests
AlexNDRmac Oct 30, 2020
9e27be8
Merge branch 'master' into af/macos-libgdiplus-fix
JimBobSquarePants Oct 30, 2020
c06de77
Enable nuget cache, rework redundant shell for all steps
AlexNDRmac Nov 2, 2020
fd7a759
Declare powershell in unix way
AlexNDRmac Nov 2, 2020
2855437
Save actual output of Images for failed CI runs
AlexNDRmac Nov 6, 2020
2af8cba
Merge branch 'master' into af/macos-libgdiplus-fix
JimBobSquarePants Nov 6, 2020
0b35db8
Merge branch 'master' into af/macos-libgdiplus-fix
antonfirsov Nov 12, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ jobs:
framework: netcoreapp3.1
runtime: -x64
codecov: true
- os: macos-latest
framework: netcoreapp3.1
runtime: -x64
codecov: false
- os: windows-latest
framework: netcoreapp3.1
runtime: -x64
Expand All @@ -38,26 +42,39 @@ jobs:
runs-on: ${{matrix.options.os}}
if: "!contains(github.event.head_commit.message, '[skip ci]')"

defaults:
run:
shell: pwsh

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: Setup nuget cache
uses: actions/cache@v2
id: nuget-cache
with:
path: ~/.nuget
key: ${{ runner.os }}-nuget-${{ hashFiles('**/src/ImageSharp/*.csproj') }}
restore-keys: ${{ runner.os }}-nuget-

- name: Install macos dependencies
if: startsWith(matrix.options.os, 'macos')
run: brew install mono-libgdiplus

- name: Build
shell: pwsh
run: ./ci-build.ps1 "${{matrix.options.framework}}"

- name: Test
shell: pwsh
run: ./ci-test.ps1 "${{matrix.options.os}}" "${{matrix.options.framework}}" "${{matrix.options.runtime}}" "${{matrix.options.codecov}}"
env:
CI: True
Expand All @@ -69,10 +86,19 @@ jobs:
with:
flags: unittests

- name: Store Output Images after failed tests
uses: actions/upload-artifact@v2
if: ${{ failure() }}
name: actual_output_${{ matrix.options.os }}.zip
path: tests/Images/ActualOutput/

Publish:
needs: [Build]

runs-on: windows-latest
defaults:
run:
shell: pwsh

if: (github.event_name == 'push')

Expand All @@ -83,19 +109,16 @@ jobs:
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: Pack
shell: pwsh
run: ./ci-pack.ps1

- name: Publish to MyGet
shell: pwsh
run: |
nuget.exe push .\artifacts\*.nupkg ${{secrets.MYGET_TOKEN}} -Source https://www.myget.org/F/sixlabors/api/v2/package
nuget.exe push .\artifacts\*.snupkg ${{secrets.MYGET_TOKEN}} -Source https://www.myget.org/F/sixlabors/api/v3/index.json
Expand Down
2 changes: 2 additions & 0 deletions tests/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Update="Moq" Version="4.14.6" />
<PackageReference Update="Pfim" Version="0.9.1" />
<!-- Enable support for using libgdiplus on macOS -->
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="5.8.64" Condition="$([MSBuild]::IsOSPlatform('OSX'))" />
<PackageReference Update="SharpZipLib" Version="1.3.0" />
<PackageReference Update="System.Drawing.Common" Version="4.7.0" />
<PackageReference Update="xunit" Version="2.4.1" />
Expand Down
2 changes: 1 addition & 1 deletion tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Condition="'$(OS)' == 'Windows_NT'" />
<PackageReference Include="Colourful" />
<PackageReference Include="Pfim" />
<PackageReference Include="SharpZipLib" />
<PackageReference Include="SharpZipLib" />
<PackageReference Include="System.Drawing.Common" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ public void Resize_WorksWithAllResamplers<TPixel>(
}

[Theory]
[PlatformSpecific(~TestPlatforms.OSX)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JimBobSquarePants reminder to ourselves that we shall open an issue for the disabled tests when this gets merged.

@AlexNDRmac I suppose you work on Mac. Can you help us by posting the output images saved by these tests on your machine? (tests/Images/ActualOutput/ResizeTests/ResizeFromSourceRectangle_Rgba32_CalliphoraPartial.png). Same for the other 2 disabled tests.

Expected images are under tests/Images/External/ReferenceOutput/ResizeTests/ if interested.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose to use save-action and fail scenario. For example: tests on mac failed, then starts build step with condition 'on-fail' and save any details (pictures, logs... etc) as build artifacts. Next, you can download it for investigation :)
I can add this scenario to workflow, it's very simple and useful.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds awesome, let's give it a try!
I wonder though what's simplest: here or in a separate PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the tests not fail locally or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, better - is separate PR, because this improvement not related to libgdiplus.

On my Mac some tests failed, but on CI such tests - passed :) I use 10.14.16, but CI using 10.15.x.... and on my Mac some tests kills some dotnet sub-processes... It's very interesting case, maybe I can foud whick component have "magic" influence on tests, but experiments requires some time.

[WithFileCollection(nameof(CommonTestImages), DefaultPixelType)]
public void ResizeFromSourceRectangle<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
Expand Down Expand Up @@ -437,6 +438,7 @@ public void ResizeWidthCannotKeepAspectKeepsOnePixel<TPixel>(TestImageProvider<T
}

[Theory]
[PlatformSpecific(~TestPlatforms.OSX)]
[WithFileCollection(nameof(CommonTestImages), DefaultPixelType)]
public void ResizeWithBoxPadMode<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
Expand Down Expand Up @@ -547,6 +549,7 @@ public void ResizeWithMinMode<TPixel>(TestImageProvider<TPixel> provider)
}

[Theory]
[PlatformSpecific(~TestPlatforms.OSX)]
[WithFileCollection(nameof(CommonTestImages), DefaultPixelType)]
public void ResizeWithPadMode<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void GetReferenceOutputFileName()
[InlineData("lol/Baz.gif", typeof(GifEncoder))]
public void GetReferenceEncoder_ReturnsCorrectEncoders_Windows(string fileName, Type expectedEncoderType)
{
if (TestEnvironment.IsLinux)
if (!TestEnvironment.IsWindows)
{
return;
}
Expand All @@ -83,7 +83,7 @@ public void GetReferenceEncoder_ReturnsCorrectEncoders_Windows(string fileName,
[InlineData("lol/Baz.gif", typeof(GifDecoder))]
public void GetReferenceDecoder_ReturnsCorrectDecoders_Windows(string fileName, Type expectedDecoderType)
{
if (TestEnvironment.IsLinux)
if (!TestEnvironment.IsWindows)
{
return;
}
Expand Down