Skip to content

Commit 36f4ad4

Browse files
Enable .NET 6 Preview Builds (#1745)
Enable Net 6 and C#9
1 parent 9b09775 commit 36f4ad4

File tree

8 files changed

+125
-49
lines changed

8 files changed

+125
-49
lines changed
Lines changed: 97 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,37 @@
11
name: Build
22

33
on:
4-
push:
5-
branches:
6-
- master
7-
tags:
8-
- "v*"
9-
pull_request:
10-
branches:
11-
- master
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- "v*"
9+
pull_request:
10+
branches:
11+
- master
1212
jobs:
1313
Build:
1414
strategy:
1515
matrix:
1616
options:
17+
- os: ubuntu-latest
18+
framework: net6.0
19+
sdk: 6.0.x
20+
sdk-preview: true
21+
runtime: -x64
22+
codecov: false
23+
- os: macos-latest
24+
framework: net6.0
25+
sdk: 6.0.x
26+
sdk-preview: true
27+
runtime: -x64
28+
codecov: false
29+
- os: windows-latest
30+
framework: net6.0
31+
sdk: 6.0.x
32+
sdk-preview: true
33+
runtime: -x64
34+
codecov: false
1735
- os: ubuntu-latest
1836
framework: net5.0
1937
runtime: -x64
@@ -52,98 +70,133 @@ jobs:
5270
codecov: false
5371

5472
runs-on: ${{matrix.options.os}}
55-
if: "!contains(github.event.head_commit.message, '[skip ci]')"
5673

5774
steps:
58-
- uses: actions/checkout@v2
75+
- name: Git Config
76+
shell: bash
77+
run: |
78+
git config --global core.autocrlf false
79+
git config --global core.longpaths true
80+
81+
- name: Git Checkout
82+
uses: actions/checkout@v2
83+
with:
84+
fetch-depth: 0
85+
submodules: recursive
5986

6087
# See https://github.com/actions/checkout/issues/165#issuecomment-657673315
61-
- name: Create LFS file list
88+
- name: Git Create LFS FileList
6289
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
6390

64-
- name: Restore LFS cache
91+
- name: Git Setup LFS Cache
6592
uses: actions/cache@v2
6693
id: lfs-cache
6794
with:
6895
path: .git/lfs
6996
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1
7097

71-
- name: Git LFS Pull
98+
- name: Git Pull LFS
7299
run: git lfs pull
73100

74-
- name: Install NuGet
101+
- name: NuGet Install
75102
uses: NuGet/setup-nuget@v1
76103

77-
- name: Setup Git
78-
shell: bash
79-
run: |
80-
git config --global core.autocrlf false
81-
git config --global core.longpaths true
82-
git fetch --prune --unshallow
83-
git submodule -q update --init --recursive
84-
85-
- name: Setup NuGet Cache
104+
- name: NuGet Setup Cache
86105
uses: actions/cache@v2
87106
id: nuget-cache
88107
with:
89108
path: ~/.nuget
90109
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets') }}
91110
restore-keys: ${{ runner.os }}-nuget-
92111

93-
- name: Build
112+
- name: DotNet Setup Preview
113+
if: ${{ matrix.options.sdk-preview == true }}
114+
uses: actions/setup-dotnet@v1
115+
with:
116+
dotnet-version: ${{ matrix.options.sdk }}
117+
include-prerelease: true
118+
119+
- name: DotNet Build
120+
if: ${{ matrix.options.sdk-preview != true }}
94121
shell: pwsh
95122
run: ./ci-build.ps1 "${{matrix.options.framework}}"
96123
env:
97124
SIXLABORS_TESTING: True
98125

99-
- name: Test
126+
- name: DotNet Build Preview
127+
if: ${{ matrix.options.sdk-preview == true }}
128+
shell: pwsh
129+
run: ./ci-build.ps1 "${{matrix.options.framework}}"
130+
env:
131+
SIXLABORS_TESTING_PREVIEW: True
132+
133+
- name: DotNet Test
134+
if: ${{ matrix.options.sdk-preview != true }}
100135
shell: pwsh
101136
run: ./ci-test.ps1 "${{matrix.options.os}}" "${{matrix.options.framework}}" "${{matrix.options.runtime}}" "${{matrix.options.codecov}}"
102137
env:
103-
SIXLABORS_TESTING: True
104-
XUNIT_PATH: .\tests\ImageSharp.Tests # Required for xunit
138+
SIXLABORS_TESTING: True
139+
XUNIT_PATH: .\tests\ImageSharp.Tests # Required for xunit
140+
141+
- name: DotNet Test Preview
142+
if: ${{ matrix.options.sdk-preview == true }}
143+
shell: pwsh
144+
run: ./ci-test.ps1 "${{matrix.options.os}}" "${{matrix.options.framework}}" "${{matrix.options.runtime}}" "${{matrix.options.codecov}}"
145+
env:
146+
SIXLABORS_TESTING_PREVIEW: True
147+
XUNIT_PATH: .\tests\ImageSharp.Tests # Required for xunit
105148

106149
- name: Export Failed Output
107150
uses: actions/upload-artifact@v2
108151
if: failure()
109152
with:
110-
name: actual_output_${{ runner.os }}_${{ matrix.options.framework }}${{ matrix.options.runtime }}.zip
111-
path: tests/Images/ActualOutput/
153+
name: actual_output_${{ runner.os }}_${{ matrix.options.framework }}${{ matrix.options.runtime }}.zip
154+
path: tests/Images/ActualOutput/
112155

113-
- name: Update Codecov
156+
- name: Codecov Update
114157
uses: codecov/codecov-action@v1
115158
if: matrix.options.codecov == true && startsWith(github.repository, 'SixLabors')
116159
with:
117-
flags: unittests
160+
flags: unittests
118161

119162
Publish:
120163
needs: [Build]
121164

122-
runs-on: windows-latest
165+
runs-on: ubuntu-latest
123166

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

126169
steps:
127-
- uses: actions/checkout@v2
128-
129-
- name: Install NuGet
130-
uses: NuGet/setup-nuget@v1
131-
132-
- name: Setup Git
170+
- name: Git Config
133171
shell: bash
134172
run: |
135173
git config --global core.autocrlf false
136174
git config --global core.longpaths true
137-
git fetch --prune --unshallow
138-
git submodule -q update --init --recursive
139175
140-
- name: Pack
176+
- name: Git Checkout
177+
uses: actions/checkout@v2
178+
with:
179+
fetch-depth: 0
180+
submodules: recursive
181+
182+
- name: NuGet Install
183+
uses: NuGet/setup-nuget@v1
184+
185+
- name: NuGet Setup Cache
186+
uses: actions/cache@v2
187+
id: nuget-cache
188+
with:
189+
path: ~/.nuget
190+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets') }}
191+
restore-keys: ${{ runner.os }}-nuget-
192+
193+
- name: DotNet Pack
141194
shell: pwsh
142195
run: ./ci-pack.ps1
143196

144-
- name: Publish to MyGet
197+
- name: MyGet Publish
145198
shell: pwsh
146199
run: |
147-
nuget.exe push .\artifacts\*.nupkg ${{secrets.MYGET_TOKEN}} -Source https://www.myget.org/F/sixlabors/api/v2/package
148-
nuget.exe push .\artifacts\*.snupkg ${{secrets.MYGET_TOKEN}} -Source https://www.myget.org/F/sixlabors/api/v3/index.json
200+
dotnet nuget push .\artifacts\*.nupkg -k ${{secrets.MYGET_TOKEN}} -s https://www.myget.org/F/sixlabors/api/v2/package
201+
dotnet nuget push .\artifacts\*.snupkg -k ${{secrets.MYGET_TOKEN}} -s https://www.myget.org/F/sixlabors/api/v3/index.json
149202
# TODO: If github.ref starts with 'refs/tags' then it was tag push and we can optionally push out package to nuget.org

Directory.Build.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
<!-- Import the shared global .props file -->
1919
<Import Project="$(MSBuildThisFileDirectory)shared-infrastructure\msbuild\props\SixLabors.Global.props" />
2020

21+
<PropertyGroup Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
22+
<!-- Workaround various issues bound to implicit language features. -->
23+
<LangVersion>preview</LangVersion>
24+
</PropertyGroup>
25+
2126
<!--
2227
Ensure all custom build configurations based upon "Release" are optimized.
2328
This is easier than setting each project individually.

src/ImageSharp/ImageSharp.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
</PropertyGroup>
1717

1818
<Choose>
19+
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
20+
<PropertyGroup>
21+
<TargetFrameworks>net6.0;net5.0;netcoreapp3.1;netcoreapp2.1;netstandard2.1;netstandard2.0;netstandard1.3;net472</TargetFrameworks>
22+
</PropertyGroup>
23+
</When>
1924
<When Condition="$(SIXLABORS_TESTING) == true">
2025
<PropertyGroup>
2126
<TargetFrameworks>net5.0;netcoreapp3.1;netcoreapp2.1;netstandard2.1;netstandard2.0;netstandard1.3;net472</TargetFrameworks>

src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ private void CopyPixelRowFast(
257257
[MethodImpl(InliningOptions.ShortMethod)]
258258
private void AddPixelsToHistogram(ref Vector4 greyValuesBase, ref int histogramBase, int luminanceLevels, int length)
259259
{
260-
for (int idx = 0; idx < length; idx++)
260+
for (nint idx = 0; idx < length; idx++)
261261
{
262262
int luminance = ColorNumerics.GetBT709Luminance(ref Unsafe.Add(ref greyValuesBase, idx), luminanceLevels);
263263
Unsafe.Add(ref histogramBase, luminance)++;

tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@
99
<!--Used to hide test project from dotnet test-->
1010
<IsTestProject>false</IsTestProject>
1111
<Configurations>Debug;Release;Debug-InnerLoop;Release-InnerLoop</Configurations>
12-
<LangVersion>9</LangVersion>
1312
<!-- Uncomment this to run benchmarks depending on Colorful or Pfim (colorspaces and TGA): -->
1413
<!--<SignAssembly>false</SignAssembly>-->
1514
</PropertyGroup>
1615

1716
<Choose>
17+
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
18+
<PropertyGroup>
19+
<TargetFrameworks>net6.0;net5.0;netcoreapp3.1;netcoreapp2.1;net472</TargetFrameworks>
20+
</PropertyGroup>
21+
</When>
1822
<When Condition="$(Configuration.EndsWith('InnerLoop')) == true">
1923
<PropertyGroup>
2024
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>

tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@
1414
<EnsureNETCoreAppRuntime>false</EnsureNETCoreAppRuntime>
1515
<Configurations>Debug;Release;Debug-InnerLoop;Release-InnerLoop</Configurations>
1616
<ValidateExecutableReferencesMatchSelfContained>false</ValidateExecutableReferencesMatchSelfContained>
17-
<LangVersion>9</LangVersion>
1817
</PropertyGroup>
1918

2019
<Choose>
20+
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
21+
<PropertyGroup>
22+
<TargetFrameworks>net6.0;net5.0;netcoreapp3.1;netcoreapp2.1;net472</TargetFrameworks>
23+
</PropertyGroup>
24+
</When>
2125
<When Condition="$(Configuration.EndsWith('InnerLoop')) == true">
2226
<PropertyGroup>
2327
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>

tests/ImageSharp.Tests/ImageSharp.Tests.csproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
</PropertyGroup>
1111

1212
<Choose>
13+
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
14+
<PropertyGroup>
15+
<TargetFrameworks>net6.0;net5.0;netcoreapp3.1;netcoreapp2.1;net472</TargetFrameworks>
16+
</PropertyGroup>
17+
</When>
1318
<When Condition="$(Configuration.EndsWith('InnerLoop')) == true">
1419
<PropertyGroup>
1520
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
@@ -21,7 +26,7 @@
2126
</PropertyGroup>
2227
</Otherwise>
2328
</Choose>
24-
29+
2530
<ItemGroup>
2631
<InternalsVisibleTo Include="ImageSharp.Tests.ProfilingSandbox" Key="$(SixLaborsPublicKey)" />
2732
</ItemGroup>

0 commit comments

Comments
 (0)