Skip to content

Commit f0dfa05

Browse files
authored
Merge pull request #427 from LykosAI/main
v2.8.0
2 parents 530a79b + bb5ff4a commit f0dfa05

File tree

307 files changed

+17177
-3192
lines changed

Some content is hidden

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

307 files changed

+17177
-3192
lines changed

.github/workflows/release.yml

+190-8
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ on:
4343
- stable
4444
- preview
4545
- development
46+
test-release-artifacts:
47+
type: boolean
48+
description: "[Debug] Test release artifacts?"
49+
default: false
4650

4751
jobs:
4852
release-linux:
@@ -171,11 +175,122 @@ jobs:
171175
with:
172176
name: StabilityMatrix-${{ env.platform-id }}
173177
path: ./out/${{ env.out-name }}
174-
178+
179+
release-macos:
180+
name: Release (macos-arm64)
181+
env:
182+
platform-id: osx-arm64
183+
app-name: "Stability Matrix.app"
184+
out-name: "StabilityMatrix-macos-arm64.dmg"
185+
runs-on: macos-13
186+
steps:
187+
- uses: actions/checkout@v3
188+
189+
- uses: olegtarasov/[email protected]
190+
if: github.event_name == 'release'
191+
id: tag_name
192+
with:
193+
tagRegex: "v(.*)"
194+
195+
- name: Set Version from Tag
196+
if: github.event_name == 'release'
197+
run: |
198+
echo "Using tag ${{ env.GIT_TAG_NAME }}"
199+
echo "RELEASE_VERSION=${{ env.GIT_TAG_NAME }}" >> $GITHUB_ENV
200+
201+
- name: Set Version from manual input
202+
if: github.event_name == 'workflow_dispatch'
203+
run: |
204+
echo "Using version ${{ github.event.inputs.version }}"
205+
echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
206+
207+
- name: Set up .NET 8
208+
uses: actions/setup-dotnet@v3
209+
with:
210+
dotnet-version: '8.0.x'
211+
212+
- name: Install dependencies
213+
run: dotnet restore -p:PublishReadyToRun=true
214+
215+
- name: Check Version
216+
run: echo $RELEASE_VERSION
217+
218+
- name: .NET Msbuild (App)
219+
env:
220+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
221+
run: >
222+
dotnet msbuild ./StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj
223+
-t:BundleApp -p:UseAppHost=true -p:SelfContained=true
224+
-p:Configuration=Release -p:RuntimeIdentifier=${{ env.platform-id }}
225+
-p:Version=$RELEASE_VERSION
226+
-p:PublishDir=out
227+
-p:PublishReadyToRun=true
228+
-p:CFBundleShortVersionString=$RELEASE_VERSION
229+
-p:CFBundleName="Stability Matrix"
230+
-p:CFBundleDisplayName="Stability Matrix"
231+
-p:CFBundleVersion=$RELEASE_VERSION
232+
-p:SentryOrg=${{ secrets.SENTRY_ORG }} -p:SentryProject=${{ secrets.SENTRY_PROJECT }}
233+
-p:SentryUploadSymbols=true -p:SentryUploadSources=true
234+
235+
- name: Post Build (App)
236+
run: mkdir -p signing && mv "./StabilityMatrix.Avalonia/out/Stability Matrix.app" "./signing/${{ env.app-name }}"
237+
238+
- name: Codesign app bundle
239+
env:
240+
MACOS_CERTIFICATE: ${{ secrets.PROD_MACOS_CERTIFICATE }}
241+
MACOS_CERTIFICATE_PWD: ${{ secrets.PROD_MACOS_CERTIFICATE_PWD }}
242+
MACOS_CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}
243+
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }}
244+
run: ./Build/codesign_macos.sh "./signing/${{ env.app-name }}"
245+
246+
- name: Notarize app bundle
247+
env:
248+
MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }}
249+
MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }}
250+
MACOS_NOTARIZATION_PWD: ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }}
251+
run: ./Build/notarize_macos.sh "./signing/${{ env.app-name }}"
252+
253+
- name: Zip Artifact (App)
254+
working-directory: signing
255+
run: zip -r -y "../StabilityMatrix-${{ env.platform-id }}-app.zip" "${{ env.app-name }}"
256+
257+
- name: Upload Artifact (App)
258+
uses: actions/upload-artifact@v2
259+
with:
260+
name: StabilityMatrix-${{ env.platform-id }}-app
261+
path: StabilityMatrix-${{ env.platform-id }}-app.zip
262+
263+
- uses: actions/setup-node@v4
264+
with:
265+
node-version: '20.x'
266+
267+
- name: Install dependencies for dmg creation
268+
run: >
269+
npm install --global create-dmg
270+
brew install graphicsmagick imagemagick
271+
272+
- name: Create dmg
273+
working-directory: signing
274+
run: >
275+
create-dmg "${{ env.app-name }}" --overwrite --identity "${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}"
276+
277+
- name: Rename dmg
278+
working-directory: signing
279+
run: mv "$(find . -type f -name "*.dmg")" "${{ env.out-name }}"
280+
281+
- name: Zip Artifact (dmg)
282+
working-directory: signing
283+
run: zip -r -y "../StabilityMatrix-${{ env.platform-id }}-dmg.zip" "${{ env.out-name }}"
284+
285+
- name: Upload Artifact (dmg)
286+
uses: actions/upload-artifact@v2
287+
with:
288+
name: StabilityMatrix-${{ env.platform-id }}-dmg
289+
path: StabilityMatrix-${{ env.platform-id }}-dmg.zip
175290

176291
publish-release:
177292
name: Publish GitHub Release
178-
needs: [ release-linux, release-windows ]
293+
needs: [ release-linux, release-windows, release-macos ]
179294
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.github-release == 'true' }}
180295
runs-on: ubuntu-latest
181296
steps:
@@ -194,11 +309,12 @@ jobs:
194309
- name: Download Artifacts
195310
uses: actions/download-artifact@v3
196311

197-
# Zip each build
312+
# Zip each build (except macos which is already dmg)
198313
- name: Zip Artifacts
199314
run: |
200315
cd StabilityMatrix-win-x64 && zip -r ../StabilityMatrix-win-x64.zip ./. && cd $OLDPWD
201316
cd StabilityMatrix-linux-x64 && zip -r ../StabilityMatrix-linux-x64.zip ./. && cd $OLDPWD
317+
unzip "StabilityMatrix-osx-arm64-dmg/StabilityMatrix-osx-arm64-dmg.zip"
202318
203319
- name: Create Github Release
204320
id: create_release
@@ -209,15 +325,75 @@ jobs:
209325
files: |
210326
StabilityMatrix-win-x64.zip
211327
StabilityMatrix-linux-x64.zip
328+
StabilityMatrix-macos-arm64.dmg
212329
fail_on_unmatched_files: true
213330
tag_name: v${{ github.event.inputs.version }}
214331
body: ${{ steps.release_notes.outputs.release_notes }}
215332
draft: ${{ github.event.inputs.github-release-draft == 'true' }}
216333
prerelease: ${{ github.event.inputs.github-release-prerelease == 'true' }}
217334

335+
test-artifacts:
336+
name: Test Release Artifacts
337+
needs: [ release-linux, release-windows, release-macos ]
338+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.test-release-artifacts == 'true' }}
339+
runs-on: ubuntu-latest
340+
steps:
341+
- uses: actions/checkout@v3
342+
343+
- name: Extract Release Notes
344+
id: release_notes
345+
run: |
346+
RELEASE_NOTES="$(awk -v version="${{ github.event.inputs.version }}" '/## v/{if(p) exit; if($0 ~ version) p=1}; p' CHANGELOG.md)"
347+
RELEASE_NOTES="${RELEASE_NOTES//'%'/'%25'}"
348+
RELEASE_NOTES="${RELEASE_NOTES//$'\n'/'%0A'}"
349+
RELEASE_NOTES="${RELEASE_NOTES//$'\r'/'%0D'}"
350+
echo "::set-output name=release_notes::$RELEASE_NOTES"
351+
echo "Release Notes:"
352+
echo "$RELEASE_NOTES"
353+
354+
# Downloads all previous artifacts to the current working directory
355+
- name: Download Artifacts
356+
uses: actions/download-artifact@v3
357+
358+
# Zip each build (except macos which is already dmg)
359+
- name: Zip Artifacts
360+
run: |
361+
cd StabilityMatrix-win-x64 && zip -r ../StabilityMatrix-win-x64.zip ./. && cd $OLDPWD
362+
cd StabilityMatrix-linux-x64 && zip -r ../StabilityMatrix-linux-x64.zip ./. && cd $OLDPWD
363+
unzip "StabilityMatrix-osx-arm64-dmg/StabilityMatrix-osx-arm64-dmg.zip"
364+
365+
# Check that the zips and CHANGELOG.md are in the current working directory
366+
- name: Check files
367+
run: |
368+
if [ ! -f StabilityMatrix-win-x64.zip ]; then
369+
echo "StabilityMatrix-win-x64.zip not found"
370+
exit 1
371+
else
372+
echo "StabilityMatrix-win-x64.zip found"
373+
sha256sum StabilityMatrix-win-x64.zip
374+
fi
375+
if [ ! -f StabilityMatrix-linux-x64.zip ]; then
376+
echo "StabilityMatrix-linux-x64.zip not found"
377+
exit 1
378+
else
379+
echo "StabilityMatrix-linux-x64.zip found"
380+
sha256sum StabilityMatrix-linux-x64.zip
381+
fi
382+
if [ ! -f StabilityMatrix-macos-arm64.dmg ]; then
383+
echo "StabilityMatrix-macos-arm64.dmg not found"
384+
exit 1
385+
else
386+
echo "StabilityMatrix-macos-arm64.dmg found"
387+
sha256sum StabilityMatrix-macos-arm64.dmg
388+
fi
389+
if [ ! -f CHANGELOG.md ]; then
390+
echo "CHANGELOG.md not found"
391+
exit 1
392+
fi
393+
218394
publish-auto-update-github:
219395
name: Publish Auto-Update Release (GitHub)
220-
needs: [ release-linux, release-windows ]
396+
needs: [ release-linux, release-windows, release-macos ]
221397
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.auto-update-release == 'true' && github.event.inputs.auto-update-release-mode == 'github url' }}
222398
runs-on: ubuntu-latest
223399
steps:
@@ -233,7 +409,7 @@ jobs:
233409
python-version: '3.11'
234410

235411
- name: Install Python Dependencies
236-
run: pip install stability-matrix-tools>=0.2.18 --upgrade
412+
run: pip install stability-matrix-tools>=0.3.0 --upgrade
237413

238414
- name: Publish Auto-Update Release
239415
env:
@@ -246,7 +422,7 @@ jobs:
246422

247423
publish-auto-update-b2:
248424
name: Publish Auto-Update Release (B2)
249-
needs: [ release-linux, release-windows ]
425+
needs: [ release-linux, release-windows, release-macos ]
250426
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.auto-update-release == 'true' && github.event.inputs.auto-update-release-mode == 'upload to b2' }}
251427
runs-on: ubuntu-latest
252428
steps:
@@ -261,18 +437,19 @@ jobs:
261437
- name: Download Artifacts
262438
uses: actions/download-artifact@v3
263439

264-
# Zip each build
440+
# Zip each build (except macos which is already dmg)
265441
- name: Zip Artifacts
266442
run: |
267443
cd StabilityMatrix-win-x64 && zip -r ../StabilityMatrix-win-x64.zip ./. && cd $OLDPWD
268444
cd StabilityMatrix-linux-x64 && zip -r ../StabilityMatrix-linux-x64.zip ./. && cd $OLDPWD
445+
unzip "StabilityMatrix-osx-arm64-dmg/StabilityMatrix-osx-arm64-dmg.zip"
269446
270447
- uses: actions/setup-python@v4
271448
with:
272449
python-version: '3.11'
273450

274451
- name: Install Python Dependencies
275-
run: pip install stability-matrix-tools>=0.2.18 --upgrade
452+
run: pip install stability-matrix-tools>=0.3.0 --upgrade
276453

277454
# Check that the zips and CHANGELOG.md are in the current working directory
278455
- name: Check files
@@ -285,6 +462,10 @@ jobs:
285462
echo "StabilityMatrix-linux-x64.zip not found"
286463
exit 1
287464
fi
465+
if [ ! -f StabilityMatrix-macos-arm64.dmg ]; then
466+
echo "StabilityMatrix-macos-arm64.dmg not found"
467+
exit 1
468+
fi
288469
if [ ! -f CHANGELOG.md ]; then
289470
echo "CHANGELOG.md not found"
290471
exit 1
@@ -303,4 +484,5 @@ jobs:
303484
--changelog CHANGELOG.md
304485
--win-x64 StabilityMatrix-win-x64.zip
305486
--linux-x64 StabilityMatrix-linux-x64.zip
487+
--macos-arm64 StabilityMatrix-macos-arm64.dmg
306488
-y

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -397,3 +397,4 @@ FodyWeavers.xsd
397397

398398
# JetBrains Rider
399399
*.sln.iml
400+
.husky/pre-commit

Avalonia.Gif/Avalonia.Gif.csproj

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net8.0</TargetFramework>
4+
<LangVersion>latest</LangVersion>
5+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
6+
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64;osx-arm64</RuntimeIdentifiers>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
10+
<EnableWindowsTargeting>true</EnableWindowsTargeting>
11+
</PropertyGroup>
12+
<ItemGroup>
13+
<PackageReference Include="Avalonia" Version="11.0.7" />
14+
<PackageReference Include="SkiaSharp" Version="2.88.7" />
15+
<PackageReference Include="DotNet.Bundle" Version="0.9.13" />
16+
</ItemGroup>
17+
18+
</Project>

Avalonia.Gif/BgWorkerCommand.cs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace Avalonia.Gif
2+
{
3+
internal enum BgWorkerCommand
4+
{
5+
Null,
6+
Play,
7+
Pause,
8+
Dispose
9+
}
10+
}

Avalonia.Gif/BgWorkerState.cs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace Avalonia.Gif
2+
{
3+
internal enum BgWorkerState
4+
{
5+
Null,
6+
Start,
7+
Running,
8+
Paused,
9+
Complete,
10+
Dispose
11+
}
12+
}

Avalonia.Gif/Decoding/BlockTypes.cs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace Avalonia.Gif.Decoding
2+
{
3+
internal enum BlockTypes
4+
{
5+
Empty = 0,
6+
Extension = 0x21,
7+
ImageDescriptor = 0x2C,
8+
Trailer = 0x3B,
9+
}
10+
}
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Avalonia.Gif.Decoding
2+
{
3+
internal enum ExtensionType
4+
{
5+
GraphicsControl = 0xF9,
6+
Application = 0xFF
7+
}
8+
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace Avalonia.Gif.Decoding
2+
{
3+
public enum FrameDisposal
4+
{
5+
Unknown = 0,
6+
Leave = 1,
7+
Background = 2,
8+
Restore = 3
9+
}
10+
}

Avalonia.Gif/Decoding/GifColor.cs

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Runtime.InteropServices;
2+
3+
namespace Avalonia.Gif
4+
{
5+
[StructLayout(LayoutKind.Explicit)]
6+
public readonly struct GifColor
7+
{
8+
[FieldOffset(3)]
9+
public readonly byte A;
10+
11+
[FieldOffset(2)]
12+
public readonly byte R;
13+
14+
[FieldOffset(1)]
15+
public readonly byte G;
16+
17+
[FieldOffset(0)]
18+
public readonly byte B;
19+
20+
/// <summary>
21+
/// A struct that represents a ARGB color and is aligned as
22+
/// a BGRA bytefield in memory.
23+
/// </summary>
24+
/// <param name="r">Red</param>
25+
/// <param name="g">Green</param>
26+
/// <param name="b">Blue</param>
27+
/// <param name="a">Alpha</param>
28+
public GifColor(byte r, byte g, byte b, byte a = byte.MaxValue)
29+
{
30+
A = a;
31+
R = r;
32+
G = g;
33+
B = b;
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)