Skip to content

Commit e232799

Browse files
authored
Merge pull request #27 from SixLabors/js/update-dependencies-
Update to match latest ImageSharp build
2 parents dbb84df + 78903d8 commit e232799

40 files changed

Lines changed: 346 additions & 238 deletions

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

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,64 @@ jobs:
8585
CI: True
8686
XUNIT_PATH: .\tests\ImageSharp.Drawing.Tests # Required for xunit
8787

88+
# Avoid "Please provide the repository token to upload reports via `-t :repository-token`"
89+
# https://community.codecov.io/t/whitelist-github-action-servers-to-upload-without-a-token/491/10
90+
# https://github.community/t5/GitHub-Actions/Make-secrets-available-to-builds-of-forks/m-p/42814/highlight/true#M5129
8891
- name: Update Codecov
8992
uses: iansu/codecov-action-node@v1.0.0
90-
if: matrix.options.codecov == true
93+
if: matrix.options.codecov == true && startsWith(github.repository, 'SixLabors')
9194
with:
92-
token: ${{secrets.CODECOV_TOKEN}}
93-
file: "coverage.${{matrix.options.framework}}.xml"
95+
token: 0ef021c7-2679-4012-b42f-4bed33d99450
9496
flags: unittests
9597

96-
- name: Pack # We can use this filter as we know it happens only once and takes the most time to complete.
97-
if: (github.event_name == 'push') && (matrix.options.codecov == true)
98+
Publish:
99+
needs: [Build]
100+
101+
runs-on: windows-latest
102+
103+
if: (github.event_name == 'push')
104+
105+
steps:
106+
- uses: actions/checkout@v2
107+
108+
- name: Install NuGet
109+
uses: NuGet/setup-nuget@v1
110+
111+
- name: Setup Git
112+
shell: bash
113+
run: |
114+
git config --global core.autocrlf false
115+
git config --global core.longpaths true
116+
git fetch --prune --unshallow
117+
git submodule -q update --init --recursive
118+
119+
- name: Fetch Tags for GitVersion
120+
run: |
121+
git fetch --tags
122+
123+
- name: Fetch master for GitVersion
124+
if: github.ref != 'refs/heads/master'
125+
run: git branch --create-reflog master origin/master
126+
127+
- name: Install GitVersion
128+
uses: gittools/actions/setup-gitversion@v0.3
129+
with:
130+
versionSpec: "5.1.x"
131+
132+
- name: Use GitVersion
133+
id: gitversion # step id used as reference for output values
134+
uses: gittools/actions/execute-gitversion@v0.3
135+
136+
- name: Setup DotNet SDK
137+
uses: actions/setup-dotnet@v1
138+
with:
139+
dotnet-version: "3.1.101"
140+
141+
- name: Pack
98142
shell: pwsh
99-
run: ./ci-build.ps1 "${{steps.gitversion.outputs.nuGetVersion}}"
143+
run: ./ci-pack.ps1 "${{steps.gitversion.outputs.nuGetVersion}}"
100144

101145
- name: Publish to MyGet
102-
if: (github.event_name == 'push') && (matrix.options.codecov == true)
103146
shell: pwsh
104147
run: nuget.exe push .\artifacts\*.nupkg ${{secrets.MYGET_TOKEN}} -Source https://www.myget.org/F/sixlabors/api/v2/package
105148
# 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.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
<!--Src Dependencies-->
2626
<PackageReference Update="SixLabors.Fonts" Version="1.0.0-unstable0024" />
27-
<PackageReference Update="SixLabors.ImageSharp" Version="1.0.0-unstable0542" />
27+
<PackageReference Update="SixLabors.ImageSharp" Version="1.0.0-unstable0702" />
2828
</ItemGroup>
2929

3030
</Project>

ImageSharp.Drawing.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1010
.gitignore = .gitignore
1111
.gitmodules = .gitmodules
1212
ci-build.ps1 = ci-build.ps1
13+
ci-pack.ps1 = ci-pack.ps1
1314
ci-test.ps1 = ci-test.ps1
1415
Directory.Build.props = Directory.Build.props
1516
Directory.Build.targets = Directory.Build.targets

ci-build.ps1

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
param(
22
[Parameter(Mandatory, Position = 0)]
33
[string]$version,
4-
[Parameter(Mandatory = $false, Position = 1)]
5-
[string]$targetFramework = 'ALL'
4+
[Parameter(Mandatory = $true, Position = 1)]
5+
[string]$targetFramework
66
)
77

88
dotnet clean -c Release
99

1010
$repositoryUrl = "https://github.com/$env:GITHUB_REPOSITORY"
11-
if ($targetFramework -ne 'ALL') {
1211

13-
# Building for a specific framework.
14-
dotnet build -c Release -f $targetFramework /p:packageversion=$version /p:RepositoryUrl=$repositoryUrl
15-
}
16-
else {
17-
18-
# Building for packing and publishing.
19-
dotnet pack -c Release --output "$PSScriptRoot/artifacts" /p:packageversion=$version /p:RepositoryUrl=$repositoryUrl
20-
}
12+
# Building for a specific framework.
13+
dotnet build -c Release -f $targetFramework /p:packageversion=$version /p:RepositoryUrl=$repositoryUrl

ci-pack.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
param(
2+
[Parameter(Mandatory, Position = 0)]
3+
[string]$version
4+
)
5+
6+
dotnet clean -c Release
7+
8+
$repositoryUrl = "https://github.com/$env:GITHUB_REPOSITORY"
9+
10+
# Building for packing and publishing.
11+
dotnet pack -c Release --output "$PSScriptRoot/artifacts" /p:packageversion=$version /p:RepositoryUrl=$repositoryUrl

codecov.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Documentation: https://docs.codecov.io/docs/codecov-yaml
2+
3+
codecov:
4+
# Avoid "Missing base report"
5+
# https://github.com/codecov/support/issues/363
6+
# https://docs.codecov.io/docs/comparing-commits
7+
allow_coverage_offsets: true
8+
9+
# Avoid Report Expired
10+
# https://docs.codecov.io/docs/codecov-yaml#section-expired-reports
11+
max_report_age: off

src/ImageSharp.Drawing/Processing/BrushApplicator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected virtual void Dispose(bool disposing)
8383
/// <remarks>scanlineBuffer will be > scanlineWidth but provide and offset in case we want to share a larger buffer across runs.</remarks>
8484
internal virtual void Apply(Span<float> scanline, int x, int y)
8585
{
86-
MemoryAllocator memoryAllocator = this.Target.MemoryAllocator;
86+
MemoryAllocator memoryAllocator = this.Configuration.MemoryAllocator;
8787

8888
using (IMemoryOwner<float> amountBuffer = memoryAllocator.Allocate<float>(scanline.Length))
8989
using (IMemoryOwner<TPixel> overlay = memoryAllocator.Allocate<TPixel>(scanline.Length))

src/ImageSharp.Drawing/Processing/ImageBrush.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Buffers;
66

77
using SixLabors.ImageSharp.Advanced;
8+
using SixLabors.ImageSharp.Memory;
89
using SixLabors.ImageSharp.PixelFormats;
910

1011
namespace SixLabors.ImageSharp.Processing
@@ -140,8 +141,9 @@ protected override void Dispose(bool disposing)
140141
internal override void Apply(Span<float> scanline, int x, int y)
141142
{
142143
// Create a span for colors
143-
using (IMemoryOwner<float> amountBuffer = this.Target.MemoryAllocator.Allocate<float>(scanline.Length))
144-
using (IMemoryOwner<TPixel> overlay = this.Target.MemoryAllocator.Allocate<TPixel>(scanline.Length))
144+
MemoryAllocator allocator = this.Configuration.MemoryAllocator;
145+
using (IMemoryOwner<float> amountBuffer = allocator.Allocate<float>(scanline.Length))
146+
using (IMemoryOwner<TPixel> overlay = allocator.Allocate<TPixel>(scanline.Length))
145147
{
146148
Span<float> amountSpan = amountBuffer.Memory.Span;
147149
Span<TPixel> overlaySpan = overlay.Memory.Span;

src/ImageSharp.Drawing/Processing/PathGradientBrush.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public PathGradientBrushApplicator(
283283
{
284284
(Edge edge, Intersection? info) closest = default;
285285

286-
MemoryAllocator allocator = this.Target.MemoryAllocator;
286+
MemoryAllocator allocator = this.Configuration.MemoryAllocator;
287287
foreach (Edge edge in this.edges)
288288
{
289289
Intersection? intersection = edge.FindIntersection(start, end, allocator);

src/ImageSharp.Drawing/Processing/PatternBrush.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public PatternBrushApplicator(
145145
internal override void Apply(Span<float> scanline, int x, int y)
146146
{
147147
int patternY = y % this.pattern.Rows;
148-
MemoryAllocator memoryAllocator = this.Target.MemoryAllocator;
148+
MemoryAllocator memoryAllocator = this.Configuration.MemoryAllocator;
149149

150150
using (IMemoryOwner<float> amountBuffer = memoryAllocator.Allocate<float>(scanline.Length))
151151
using (IMemoryOwner<TPixel> overlay = memoryAllocator.Allocate<TPixel>(scanline.Length))

0 commit comments

Comments
 (0)