Skip to content

Commit 4fb47d7

Browse files
committed
Imazen.Common - change new interfaces
Create Imazen.Common.Extensibility.BlobCache.* Move Imazen.Common.Storage.Caching there. Introduced IUniqueNamed for caches and providers Add Imazen.Common.Concurrency.BoundedTaskCollection And IBoundedTaskItem and BlobTaskItem. This replaces the AsyncWriteCollection established in hybridcache Add Imazen.Common.Extensibility.Logging DI-friendly IReLoggerStore and IReLoggerFactory allow for memory-constrained error retention for in-component diagnostics. Add HostedServiceProxy to Imazen.Common.Extensibility.Support This allows any DI component to easily (also) be an IHostedService by registering a proxy that is generic over its own type, so that even if there are multiple instances of said novel type, all will be started/stopped. Add BlobStringValidator to Imazen.Common (Imazen.Common.Extensibility.Support) to support blob cache provider creation Imazen.Common: Add INamedStreamCache & IStreamCacheProvider IUniqueNamed is required for both WIP WIP that builds WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP wip WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP - fixing nullability annotations and warnings WIP WIP WIP WIP WIP WIP - cleanup Bump dependencies, enable trim/aot/singlefile analyzers, drop newtonsoft Improve code and reduce warnings Start moving Licensing into routing Build a custom route matching engine because I'm just not tired enough by this massive rewrite Wrap up inital draft of MatchExpression tester Fix build errors; still working on tests Expression matching tests passing Fix bugs in matching engine Improvements to match syntax Add IBackedByReadOnlyMemory and ReadOnlyMemoryBlob Update Imageflow.Net Licensing WIP Fix bug in IFastCond optimizer and make HasSupportedImageExtension a generic copy of HasFastSuffixes Fix failing signature verification Fix WhenAnyMatchesOrDefault tests and impl Add AsyncDisposableHost to make testing more ergonomic Add DisposalPromise enum, Refactor IConsumableBlob.TakeStream to .BorrowStream(DisposalPromise), and fix usage to be proper. Also, replace pointless implementations of IConsumableBlob with the default one, since it does everything all of the impls .needed Fix PresetsLayer Skip empty cache group Fix s3 bucket ref Make Imazen.Routing.Helpers.PathHelpers.ImagePathSuffixes internally accessible Register LicenseOptions in tests Misc Nuget update public string->string? MyOpenSourceProjectUrl Don't dispose the HttpClient in RemoteReader; and start streaming data after the headers have buffered. Nullability fixes
1 parent d644008 commit 4fb47d7

File tree

460 files changed

+34596
-11053
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

460 files changed

+34596
-11053
lines changed

.dockerignore

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
**/.dockerignore
2+
**/.env
3+
**/.git
4+
**/.gitignore
5+
**/.project
6+
**/.settings
7+
**/.toolstarget
8+
**/.vs
9+
**/.vscode
10+
**/.idea
11+
**/*.*proj.user
12+
**/*.dbmdl
13+
**/*.jfm
14+
**/azds.yaml
15+
**/bin
16+
**/charts
17+
**/docker-compose*
18+
**/Dockerfile*
19+
**/node_modules
20+
**/npm-debug.log
21+
**/obj
22+
**/secrets.dev.yaml
23+
**/values.dev.yaml
24+
LICENSE
25+
README.md

.github/workflows/dockerize_host.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This builds a .net 8 app using src/Imageflow.Server.Host/Dockerfile
2+
# using nowsprinting/check-version-format-action@v3 to determine the version
3+
# and uploads it to docker hub
4+
5+
# This is the docker image name
6+
name: Build Docker Image for Imageflow.Server.Host
7+
on:
8+
push:
9+
branches: [ main ]
10+
release:
11+
types: [ published ]
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- name: Set up Docker Build
20+
uses: docker/setup-buildx-action@v1
21+
22+
- name: Get version
23+
uses: nowsprinting/check-version-format-action@v3
24+
id: version
25+
with:
26+
prefix: 'v'
27+
28+
- name: Login
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ghcr.io
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Build and push
36+
if: steps.version.outputs.is_valid == 'true' && github.event_name == 'release'
37+
uses: docker/build-push-action@v5
38+
with:
39+
context: .
40+
file: ./src/Imageflow.Server.Host/Dockerfile
41+
push: true
42+
tags: your-dockerhub-username/imageflow-server-host:${{ steps.get_version.outputs.version }}

.github/workflows/dotnet-core.yml

+175-61
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,24 @@ name: Build
22

33
on:
44
push:
5-
branches: [ main ]
65
pull_request:
7-
branches: [ main ]
86
release:
97
types: [ published ]
108

119
jobs:
12-
build:
10+
test:
1311
strategy:
1412
fail-fast: false
1513
matrix:
14+
os: [ubuntu-20.04, macos-11.0, windows-latest]
1615
include:
17-
- name: ubuntu-20.04
18-
os: ubuntu-20.04
19-
uploader: true
20-
cache_dependencies: true
21-
22-
- name: osx_11.0-x86_64
23-
os: macos-11.0
24-
cache_dependencies: true
25-
26-
- name: win-x86_64
27-
os: windows-latest
28-
cache_dependencies: false
29-
16+
- os: windows-latest
17+
pack: true
18+
docs: true
19+
dotnet: all
20+
coverage: true
21+
- os: ubuntu-latest
22+
id: ubuntu-latest
3023
runs-on: ${{matrix.os}}
3124
steps:
3225
- uses: actions/checkout@v3
@@ -35,18 +28,34 @@ jobs:
3528
with:
3629
path: ~/.nuget/packages
3730
key: ${{ runner.os }}-nuget-breaker3-${{ hashFiles('**/packages.lock.json') }}
38-
if: matrix.cache_dependencies
31+
restore-keys: |
32+
${{ runner.os }}-nuget-
33+
34+
- name: Check .NET versions available to see if we can skip installs
35+
shell: bash
36+
run: |
37+
echo "DOTNET_VERSION_LIST<<EOF" >> $GITHUB_ENV
38+
dotnet --list-sdks >> $GITHUB_ENV
39+
echo "EOF" >> $GITHUB_ENV
40+
41+
- name: Setup .NET 6, 7, 8
42+
uses: actions/setup-dotnet@v3
43+
if: contains(env.DOTNET_VERSION_LIST, '6.0.') == 'false' || contains(env.DOTNET_VERSION_LIST, '7.0.') == 'false' || contains(env.DOTNET_VERSION_LIST, '8.0.') == 'false'
44+
with:
45+
dotnet-version: "6\n7\n8\n"
46+
47+
- name: Setup .NET 4.8.1 if on windows
48+
uses: actions/setup-dotnet@v3
49+
if: matrix.os == 'windows-latest' && contains(env.DOTNET_VERSION_LIST, '4.8.1') == 'false'
50+
with:
51+
dotnet-version: '4.8.1'
3952

4053
- uses: nowsprinting/check-version-format-action@v3
4154
id: version
4255
with:
4356
prefix: 'v'
4457

45-
- name: Upload planned for Nuget.org?
46-
run: echo "This runner will upload to Nuget.org if tests pass"
47-
if: matrix.uploader && github.event_name == 'release' && steps.version.outputs.is_valid == 'true'
48-
49-
- name: Set the release version (if applicable)
58+
- name: Set the release version (if applicable) - The source code depends on these
5059
run: |
5160
echo "TAGGED_VERSION=${{ steps.version.outputs.full_without_prefix }}" >> $GITHUB_ENV
5261
echo "ARTIFACT_VERSION=${{ steps.version.outputs.full_without_prefix }}" >> $GITHUB_ENV
@@ -61,28 +70,8 @@ jobs:
6170
echo Set ARTIFACT_VERSION to commit-${{ github.sha }}
6271
shell: bash
6372
if: steps.version.outputs.is_valid == 'false' || github.event_name != 'release'
64-
65-
- name: Set the Imageflow.Server.Host zip file name
66-
run: |
67-
echo "HOST_ZIP_FILE=Imageflow.Server.Host-${{matrix.os}}-${{ env.ARTIFACT_VERSION }}.zip" >> $GITHUB_ENV
68-
echo Set HOST_ZIP_FILE to ${{ env.HOST_ZIP_FILE }}
69-
shell: bash
70-
71-
- name: Check .NET versions available to see if we can skip install
72-
shell: bash
73-
run: |
74-
echo "DOTNET_VERSION_LIST<<EOF" >> $GITHUB_ENV
75-
dotnet --list-sdks >> $GITHUB_ENV
76-
echo "EOF" >> $GITHUB_ENV
7773

78-
- name: Setup .NET 6.0.x and 7.0.x
79-
uses: actions/setup-dotnet@v2
80-
if: contains(env.DOTNET_VERSION_LIST, '6.0') == 'false' || contains(env.DOTNET_VERSION_LIST, '7.0.') == 'false'
81-
with:
82-
dotnet-version: |
83-
6
84-
7
85-
74+
8675
- name: Clear & clean on release or cache miss
8776
run: |
8877
dotnet clean --configuration Release
@@ -92,39 +81,87 @@ jobs:
9281
- name: Restore packages
9382
run: dotnet restore --force-evaluate
9483

95-
- name: Build
84+
- name: Build all if on windows
9685
run: dotnet build --maxcpucount:1 -c Release
97-
98-
- name: Test
99-
run: dotnet test -c Release --blame --no-build
86+
if: matrix.os == 'windows-latest'
87+
88+
- name: Build for .NET 8, 6
89+
run: dotnet build --maxcpucount:1 -c Release --framework net6.0 net8.0
90+
if: matrix.os != 'windows-latest'
91+
92+
- name: Test .NET 6, 8 without Coverage
93+
if: matrix.os != 'windows-latest'
94+
run: |
95+
dotnet test -c Release --framework net6.0
96+
dotnet test -c Release --framework net8.0
10097
10198
- uses: actions/upload-artifact@v3
10299
if: failure()
103100
with:
104101
name: TestResults-${{matrix.os}}-${{ env.ARTIFACT_VERSION }}
105102
path: TestResults/
103+
104+
- name: Test .NET 8, 6, and 4.8.1 with Coverage
105+
if: matrix.os == 'windows-latest'
106+
run: |
107+
dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=./TestResults/coverage.net48.opencover.xml --framework net48
108+
dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=./TestResults/coverage.net6.opencover.xml --framework net6.0
109+
dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=./TestResults/coverage.net8.opencover.xml --framework net8.0
106110
107-
- name: Publish Host App
108-
run: dotnet publish -c Release -o host/publish/ src/Imageflow.Server.Host/Imageflow.Server.Host.csproj
111+
- name: Upload coverage to Codecov
112+
uses: codecov/codecov-action@v3
113+
if: matrix.os == 'windows-latest'
114+
with:
115+
files: ./TestResults/coverage.**.opencover.xml
116+
token: ${{ secrets.CODECOV_TOKEN }} # replace with your Codecov token
117+
fail_ci_if_error: false
118+
119+
- uses: actions/upload-artifact@v3
120+
if: failure()
121+
with:
122+
name: TestResults-${{matrix.os}}-${{ env.ARTIFACT_VERSION }}
123+
path: TestResults/
124+
125+
- name: Pack
126+
run: dotnet pack -c Release --include-source
127+
if: matrix.pack
109128

110-
# Zip the contents of folder host/publish/ into host/Imageflow.Server.Host-${{matrix.os}}-${{ env.ARTIFACT_VERSION }}.zip
129+
- name: Upload artifacts
130+
uses: actions/upload-artifact@v4
131+
id: nuget-artifact-upload-step
132+
if: npack
133+
with:
134+
name: NuGetPackages
135+
path: NuGetPackages/Release/*.nupkg
136+
137+
############################ We build the host for every OS, but only upload it for release ############################
138+
- name: Set the Imageflow.Server.Host zip file name
139+
run: |
140+
echo "HOST_ZIP_FILE=Imageflow.Server.Host-${{matrix.os}}-${{ env.ARTIFACT_VERSION }}.zip" >> $GITHUB_ENV
141+
echo Set HOST_ZIP_FILE to ${{ env.HOST_ZIP_FILE }}
142+
shell: bash
143+
144+
- name: Create Host App Folder
145+
run: dotnet publish -c Release -o host/publish/ src/Imageflow.Server.Host/Imageflow.Server.Host.csproj --framework net8.0
146+
147+
# Zip the contents of folder host/publish/ into host/Imageflow.Server.Host-${{matrix.os}}-${{ env.ARTIFACT_VERSION }}.zip
111148
- name: Zip Server.Host
112149
uses: thedoctor0/[email protected]
113150
with:
114151
type: 'zip'
115152
directory: 'host/publish/'
116153
filename: '../${{env.HOST_ZIP_FILE}}'
117154
path: '.'
118-
119-
# Upload the publish folder for src/Imageflow.Server.Host to the release artifacts
120-
- name: Upload Imageflow.Server.Host to artifacts
121-
uses: actions/upload-artifact@v3
155+
156+
- name: Upload Imageflow.Server.Host to job
157+
uses: actions/upload-artifact@v4
158+
id: host-upload-step
122159
if: success()
123160
with:
124161
name: ${{env.HOST_ZIP_FILE}}
125162
path: host/${{env.HOST_ZIP_FILE}}
126-
127-
# If this is a release, upload it to the github release page using the git
163+
164+
# If this is a release, upload it to the github release page using the git
128165
- name: Upload Imageflow.Server.Host to release
129166
uses: Shopify/[email protected]
130167
if: steps.version.outputs.is_valid == 'true' && github.event_name == 'release'
@@ -133,12 +170,89 @@ jobs:
133170
path: host/${{env.HOST_ZIP_FILE}}
134171
repo-token: ${{ secrets.GITHUB_TOKEN }}
135172
content-type: application/zip
173+
174+
- name: Install DocFX
175+
run: dotnet tool install --global docfx
176+
if: matrix.docs
177+
- name: Generate Documentation
178+
run: docfx src/DocFx/docfx.json --output docs
179+
if: matrix.docs
136180

181+
- name: Upload documentation to job
182+
id: docs-upload-step
183+
uses: actions/upload-artifact@v4
184+
if: success() && matrix.docs
185+
with:
186+
name: Documentation
187+
path: docs/
137188

138-
- name: Pack
139-
run: dotnet pack -c Release --include-source
140-
189+
outputs:
190+
host_artifact-id: ${{ steps.host-upload-step.outputs.artifact_id }}
191+
nuget_artifact-id: ${{ steps.nuget-artifact-upload-step.outputs.artifact_id }}
192+
docs_artifact-id: ${{ steps.docs-upload-step.outputs.artifact_id }}
193+
194+
195+
publish:
196+
needs: test
197+
if: github.event_name == 'release'
198+
199+
runs-on: ubuntu-latest
200+
steps:
201+
- uses: nowsprinting/check-version-format-action@v3
202+
id: version
203+
with:
204+
prefix: 'v'
205+
206+
# Download nuget artifacts from the test job into a folder called NuGetPackages
207+
- name: Download artifacts
208+
uses: actions/download-artifact@v4
209+
if: steps.version.outputs.is_valid == 'true' && github.event_name == 'release'
210+
with:
211+
name: NuGetPackages
212+
path: NuGetPackages
213+
141214
- name: Publish NuGet packages to Nuget.org
142-
if: steps.version.outputs.is_valid == 'true' && github.event_name == 'release' && matrix.uploader
215+
if: steps.version.outputs.is_valid == 'true' && github.event_name == 'release'
143216
run: |
144-
dotnet nuget push bin/Release/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source nuget.org
217+
dotnet nuget push NuGetPackages/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source nuget.org
218+
219+
- name: Download Documentation
220+
uses: actions/download-artifact@v4
221+
if: steps.version.outputs.is_valid == 'true' && github.event_name == 'release'
222+
with:
223+
name: Documentation
224+
path: docs
225+
226+
- name: Deploy Documentation to GitHub Pages
227+
uses: peaceiris/actions-gh-pages@v3
228+
with:
229+
github_token: ${{ secrets.GITHUB_TOKEN }}
230+
publish_dir: ./docs
231+
232+
dockerize_host:
233+
needs: test
234+
if: github.event_name == 'release'
235+
236+
runs-on: ubuntu-latest
237+
steps:
238+
- uses: nowsprinting/check-version-format-action@v3
239+
id: version
240+
with:
241+
prefix: 'v'
242+
# download artifact using the host artifact id from the test job, the ubuntu-latest matrix version
243+
- name: Download Imageflow.Server.Host
244+
uses: actions/download-artifact@v4
245+
if: steps.version.outputs.is_valid == 'true' && github.event_name == 'release'
246+
with:
247+
name: ${{ steps.test.outputs.host_artifact-id }}
248+
path: host
249+
250+
# Create a docker image for the host and push, using the host artifact id from the test job, the ubuntu-latest matrix version
251+
252+
253+
254+
## Create a docker image for the host and push, using the host artifact id from the test job, the ubuntu-latest matrix version
255+
256+
257+
258+

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ bld/
2424
[Oo]bj/
2525
[Ll]og/
2626
host/
27+
NugetPackages/
28+
test-publish/
2729

2830
# DocFX build results
2931
_site/

0 commit comments

Comments
 (0)