Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 14 additions & 6 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:war
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning
dotnet_style_parentheses_in_other_operators = always_for_clarity:suggestion
# Expression-level preferences
dotnet_style_object_initializer = true:warning
dotnet_style_collection_initializer = true:warning
dotnet_style_object_initializer = true:error
dotnet_style_collection_initializer = true:error
dotnet_style_explicit_tuple_names = true:warning
dotnet_style_prefer_inferred_tuple_names = true:warning
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
Expand Down Expand Up @@ -135,9 +135,9 @@ csharp_style_prefer_null_check_over_type_check = true:warning
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#c-style-rules
[*.{cs,csx,cake}]
# 'var' preferences
csharp_style_var_for_built_in_types = false:warning
csharp_style_var_when_type_is_apparent = false:warning
csharp_style_var_elsewhere = false:warning
csharp_style_var_for_built_in_types = false:error
csharp_style_var_when_type_is_apparent = false:error
csharp_style_var_elsewhere = false:error
# Expression-bodied members
csharp_style_expression_bodied_methods = true:warning
csharp_style_expression_bodied_constructors = true:warning
Expand All @@ -160,7 +160,10 @@ csharp_style_pattern_local_over_anonymous_function = true:warning
csharp_style_deconstructed_variable_declaration = true:warning
csharp_style_prefer_index_operator = true:warning
csharp_style_prefer_range_operator = true:warning
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
csharp_style_implicit_object_creation_when_type_is_apparent = true:error
# ReSharper inspection severities
resharper_arrange_object_creation_when_type_evident_highlighting = error
resharper_arrange_object_creation_when_type_not_evident_highlighting = error
# "Null" checking preferences
csharp_style_throw_expression = true:warning
csharp_style_conditional_delegate_call = true:warning
Expand All @@ -172,6 +175,11 @@ dotnet_diagnostic.IDE0063.severity = suggestion
csharp_using_directive_placement = outside_namespace:warning
# Modifier preferences
csharp_prefer_static_local_function = true:warning
# Primary constructor preferences
csharp_style_prefer_primary_constructors = false:none
# Collection preferences
dotnet_style_prefer_collection_expression = true:error
resharper_use_collection_expression_highlighting =true:error

##########################################
# Unnecessary Code Rules
Expand Down
27 changes: 21 additions & 6 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,12 @@
###############################################################################
*.basis binary
*.dll binary
*.eot binary
*.exe binary
*.otf binary
*.pdf binary
*.ppt binary
*.pptx binary
*.pvr binary
*.snk binary
*.ttc binary
*.ttf binary
*.woff binary
*.woff2 binary
*.xls binary
*.xlsx binary
###############################################################################
Expand All @@ -118,17 +112,38 @@
*.bmp filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.qoi filter=lfs diff=lfs merge=lfs -text
*.tif filter=lfs diff=lfs merge=lfs -text
*.tiff filter=lfs diff=lfs merge=lfs -text
*.tga filter=lfs diff=lfs merge=lfs -text
*.webp filter=lfs diff=lfs merge=lfs -text
*.dds filter=lfs diff=lfs merge=lfs -text
*.ktx filter=lfs diff=lfs merge=lfs -text
*.ktx2 filter=lfs diff=lfs merge=lfs -text
*.astc filter=lfs diff=lfs merge=lfs -text
*.pam filter=lfs diff=lfs merge=lfs -text
*.pbm filter=lfs diff=lfs merge=lfs -text
*.pgm filter=lfs diff=lfs merge=lfs -text
*.ppm filter=lfs diff=lfs merge=lfs -text
*.pnm filter=lfs diff=lfs merge=lfs -text
*.wbmp filter=lfs diff=lfs merge=lfs -text
*.exr filter=lfs diff=lfs merge=lfs -text
*.ico filter=lfs diff=lfs merge=lfs -text
*.cur filter=lfs diff=lfs merge=lfs -text
*.ani filter=lfs diff=lfs merge=lfs -text
*.heic filter=lfs diff=lfs merge=lfs -text
*.hif filter=lfs diff=lfs merge=lfs -text
*.avif filter=lfs diff=lfs merge=lfs -text
###############################################################################
# Handle ICC files by git lfs
###############################################################################
*.icc filter=lfs diff=lfs merge=lfs -text
###############################################################################
# Handle font files by git lfs
###############################################################################
*.eot filter=lfs diff=lfs merge=lfs -text
*.otf filter=lfs diff=lfs merge=lfs -text
*.ttc filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.woff filter=lfs diff=lfs merge=lfs -text
*.woff2 filter=lfs diff=lfs merge=lfs -text
89 changes: 71 additions & 18 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,90 @@ on:
push:
branches:
- main
- release/*
tags:
- "v*"
pull_request:
branches:
- main
- release/*
types: [ opened, synchronize, reopened ]

jobs:
# Prime a single LFS cache and expose the exact key for the matrix
WarmLFS:
runs-on: ubuntu-latest
outputs:
lfs_key: ${{ steps.expose-key.outputs.lfs_key }}
steps:
- name: Git Config
shell: bash
run: |
git config --global core.autocrlf false
git config --global core.longpaths true

- name: Git Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: recursive

# Deterministic list of LFS object IDs, then compute a portable key:
# - `git lfs ls-files -l` lists all tracked LFS objects with their SHA-256
# - `awk '{print $1}'` extracts just the SHA field
# - `sort` sorts in byte order (hex hashes sort the same everywhere)
# This ensures the file content is identical regardless of OS or locale
- name: Git Create LFS id list
shell: bash
run: git lfs ls-files -l | awk '{print $1}' | sort > .lfs-assets-id

- name: Git Expose LFS cache key
id: expose-key
shell: bash
env:
LFS_KEY: lfs-${{ hashFiles('.lfs-assets-id') }}-v1
run: echo "lfs_key=$LFS_KEY" >> "$GITHUB_OUTPUT"

- name: Git Setup LFS Cache
uses: actions/cache@v5
with:
path: .git/lfs
key: ${{ steps.expose-key.outputs.lfs_key }}

- name: Git Pull LFS
shell: bash
run: git lfs pull

Build:
needs: WarmLFS
strategy:
matrix:
options:
- os: ubuntu-latest
framework: net7.0
framework: net10.0
sdk-preview: true
runtime: -x64
codecov: false
- os: macos-latest
framework: net7.0
framework: net10.0
sdk-preview: true
runtime: -x64
codecov: false
- os: windows-latest
framework: net7.0
framework: net10.0
sdk-preview: true
runtime: -x64
codecov: true
- os: ubuntu-latest
framework: net6.0
framework: net8.0
runtime: -x64
codecov: false
- os: macos-latest
framework: net6.0
framework: net8.0
runtime: -x64
codecov: false
- os: windows-latest
framework: net6.0
framework: net8.0
runtime: -x64
codecov: false

Expand All @@ -58,25 +106,22 @@ jobs:
fetch-depth: 0
submodules: recursive

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

# Use the warmed key from WarmLFS. Do not recompute or recreate .lfs-assets-id here.
- name: Git Setup LFS Cache
uses: actions/cache@v4
id: lfs-cache
uses: actions/cache@v5
with:
path: .git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1
key: ${{ needs.WarmLFS.outputs.lfs_key }}

- name: Git Pull LFS
shell: bash
run: git lfs pull

- name: NuGet Install
uses: NuGet/setup-nuget@v2

- name: NuGet Setup Cache
uses: actions/cache@v4
uses: actions/cache@v5
id: nuget-cache
with:
path: ~/.nuget
Expand Down Expand Up @@ -112,11 +157,18 @@ jobs:
s3rver -d . &

- name: DotNet Setup
uses: actions/setup-dotnet@v4
if: ${{ matrix.options.sdk-preview != true }}
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x

- name: DotNet Setup Preview
if: ${{ matrix.options.sdk-preview == true }}
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
7.0.x
6.0.x
10.0.x

- name: DotNet Build
if: ${{ matrix.options.sdk-preview != true }}
Expand Down Expand Up @@ -153,6 +205,7 @@ jobs:
if: matrix.options.codecov == true && startsWith(github.repository, 'SixLabors')
with:
flags: unittests
token: ${{ secrets.CODECOV_TOKEN }}

Publish:
needs: [Build]
Expand All @@ -178,7 +231,7 @@ jobs:
uses: NuGet/setup-nuget@v2

- name: NuGet Setup Cache
uses: actions/cache@v4
uses: actions/cache@v5
id: nuget-cache
with:
path: ~/.nuget
Expand Down
3 changes: 1 addition & 2 deletions samples/ImageSharp.Web.Sample/ImageSharp.Web.Sample.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions samples/ImageSharp.Web.Sample/Pages/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
<code>sixlabors.imagesharp.web.png?width=300&bgcolor=128,28,32</code>
</p>
<p>
<img src="sixlabors.imagesharp.web.png" imagesharp-width="300" imagesharp-bgcolor="Color.FromRgb(128, 28, 32)" />
<img src="sixlabors.imagesharp.web.png" imagesharp-width="300" imagesharp-bgcolor="Color.FromPixel<Rgba32>(new(128, 28, 32))" />
</p>
</div>
<div>
Expand All @@ -253,7 +253,7 @@
<code>sixlabors.imagesharp.web.png?width=300&bgcolor=128,28,32,128</code>
</p>
<p>
<img src="sixlabors.imagesharp.web.png" imagesharp-width="300" imagesharp-bgcolor="Color.FromRgba(128, 28, 32, 128)" />
<img src="sixlabors.imagesharp.web.png" imagesharp-width="300" imagesharp-bgcolor="Color.FromPixel<Rgba32>(new(128, 28, 32, 128))" />
</p>
</div>
</section>
Expand Down
1 change: 1 addition & 0 deletions samples/ImageSharp.Web.Sample/Pages/_ViewImports.cshtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@using SixLabors.ImageSharp
@using SixLabors.ImageSharp.PixelFormats
@using SixLabors.ImageSharp.Processing
@using SixLabors.ImageSharp.Web
@using ImageSharp.Web.Sample
Expand Down
4 changes: 2 additions & 2 deletions samples/ImageSharp.Web.Sample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.

using SixLabors.ImageSharp.Web;
using SixLabors.ImageSharp.Web.Caching;
using SixLabors.ImageSharp.Web.Commands;
using SixLabors.ImageSharp.Web.DependencyInjection;
using SixLabors.ImageSharp.Web.Processors;
using SixLabors.ImageSharp.Web.Providers;

Expand All @@ -27,7 +27,7 @@ public static void Main(string[] args)
services.AddRazorPages();

// TODO: Enable HMAC
services.AddImageSharp(options => options.HMACSecretKey = new byte[] { 1, 2, 3, 4, 5 })
services.AddImageSharp(options => options.HMACSecretKey = [1, 2, 3, 4, 5])
.SetRequestParser<QueryCollectionRequestParser>()
.Configure<PhysicalFileSystemCacheOptions>(options =>
{
Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp.Web.Providers.AWS/AmazonS3BucketClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using Amazon.S3;

namespace SixLabors.ImageSharp.Web;
namespace SixLabors.ImageSharp.Web.AWS;

/// <summary>
/// Represents a scoped Amazon S3 client instance that is explicitly associated with a single S3 bucket.
Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp.Web.Providers.AWS/AmazonS3ClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Amazon.Runtime;
using Amazon.S3;

namespace SixLabors.ImageSharp.Web;
namespace SixLabors.ImageSharp.Web.AWS;

internal static class AmazonS3ClientFactory
{
Expand Down
5 changes: 3 additions & 2 deletions src/ImageSharp.Web.Providers.AWS/Caching/AWSS3StorageCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
using Amazon.S3;
using Amazon.S3.Model;
using Microsoft.Extensions.Options;
using SixLabors.ImageSharp.Web.AWS.Resolvers;
using SixLabors.ImageSharp.Web.Caching;
using SixLabors.ImageSharp.Web.Resolvers;
using SixLabors.ImageSharp.Web.Resolvers.AWS;

namespace SixLabors.ImageSharp.Web.Caching.AWS;
namespace SixLabors.ImageSharp.Web.AWS.Caching;

/// <summary>
/// Implements an AWS S3 Storage based cache.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.

namespace SixLabors.ImageSharp.Web.Caching.AWS;
namespace SixLabors.ImageSharp.Web.AWS.Caching;

/// <summary>
/// Configuration options for the <see cref="AWSS3StorageCache"/> provider.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.

namespace SixLabors.ImageSharp.Web;
namespace SixLabors.ImageSharp.Web.AWS;

/// <summary>
/// Provides a common interface for AWS S3 Bucket Client Options.
Expand Down
Loading
Loading