Skip to content

Commit 8dcc836

Browse files
authored
♻️ harmonise platform names with other client libs (#292)
1 parent 78afdd4 commit 8dcc836

File tree

5 files changed

+31
-51
lines changed

5 files changed

+31
-51
lines changed

.github/workflows/integration-tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ jobs:
3737
with:
3838
dotnet-version: |
3939
6.0.x
40+
7.0.x
4041
8.0.x
42+
9.0.x
4143
4244
- name: Install dependencies
4345
run: |
@@ -77,7 +79,9 @@ jobs:
7779
with:
7880
dotnet-version: |
7981
6.0.x
82+
7.0.x
8083
8.0.x
84+
9.0.x
8185
8286
- name: Install dependencies
8387
run: |

.github/workflows/tag-version.yml

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,4 @@ on:
77

88
jobs:
99
tag-version:
10-
runs-on: ubuntu-latest
11-
if: "contains(github.event.head_commit.message, ':bookmark:')"
12-
13-
steps:
14-
- uses: actions/checkout@v4
15-
with:
16-
fetch-depth: '0'
17-
18-
- name: Tag version
19-
run: |
20-
msg_start=':bookmark: Version '
21-
version_format='[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}'
22-
version=$(git log -1 --skip=0 --pretty=%s | grep -oP "(?<=${msg_start})${version_format}")
23-
24-
if [ -z "${version}" ]; then
25-
echo 'Version not found, aborting.'
26-
exit 1
27-
fi
28-
29-
echo "Found version: ${version}";
30-
tag="v${version}";
31-
32-
echo "Would tag: ${tag}";
33-
existing_tag=$(git tag -l "${tag}");
34-
35-
if [ "${existing_tag}" ]; then
36-
echo "Tag '${existing_tag}' already exists, aborting.";
37-
exit 1;
38-
fi
39-
40-
git config user.name "Mindee";
41-
git config user.email "opensource@mindee.com"
42-
43-
git tag -a "${tag}" -m"Version ${version}";
44-
git push origin "${tag}"
45-
46-
echo "Tagged and pushed: ${tag}"
10+
uses: mindee/client-lib-actions/.github/workflows/tag-version.yml@main

.github/workflows/test-sample-codes.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
matrix:
1818
os:
1919
- "ubuntu-22.04"
20-
dotnet-version:
20+
dotnet:
2121
- "net6.0"
2222
- "net7.0"
2323
- "net8.0"
@@ -32,7 +32,9 @@ jobs:
3232
with:
3333
dotnet-version: |
3434
6.0.x
35+
7.0.x
3536
8.0.x
37+
9.0.x
3638
3739
# - uses: actions/cache@v4
3840
# with:
@@ -58,7 +60,7 @@ jobs:
5860
5961
- name: Publish Locally
6062
run: |
61-
dotnet pack "src/Mindee" -p:TargetFrameworks=${{ matrix.dotnet-version }} --output ./dist
63+
dotnet pack "src/Mindee" -p:TargetFrameworks=${{ matrix.dotnet }} --output ./dist
6264
cd ./dist
6365
dotnet nuget push *.nupkg --source "NugetLocal"
6466

.github/workflows/unit-tests.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
os:
1313
- "ubuntu-22.04"
1414
- "macos-13"
15-
dotnet-version:
15+
dotnet:
1616
- "net6.0"
1717
- "net7.0"
1818
- "net8.0"
@@ -24,10 +24,13 @@ jobs:
2424

2525
- name: Set up .NET
2626
uses: actions/setup-dotnet@v4
27+
id: setup-step
2728
with:
2829
dotnet-version: |
2930
6.0.x
31+
7.0.x
3032
8.0.x
33+
9.0.x
3134
3235
- uses: actions/cache@v4
3336
with:
@@ -40,20 +43,16 @@ jobs:
4043
run: |
4144
dotnet restore
4245
43-
- name: Build
44-
run: |
45-
dotnet build -f ${{ matrix.dotnet-version }} --no-restore
46-
47-
- name: Test
46+
- name: Build and test
4847
run: |
49-
dotnet test -f ${{ matrix.dotnet-version }} --no-restore --verbosity normal "tests\Mindee.UnitTests"
48+
dotnet test -f ${{ matrix.dotnet }} --no-restore --verbosity normal "tests\Mindee.UnitTests"
5049
5150
test-windows:
5251
name: Test on Windows
5352
timeout-minutes: 30
5453
strategy:
5554
matrix:
56-
dotnet-version:
55+
dotnet:
5756
- "net472"
5857
- "net482"
5958
- "net6.0"
@@ -67,10 +66,13 @@ jobs:
6766

6867
- name: Set up .NET
6968
uses: actions/setup-dotnet@v4
69+
id: setup-step
7070
with:
7171
dotnet-version: |
7272
6.0.x
73+
7.0.x
7374
8.0.x
75+
9.0.x
7476
7577
- uses: actions/cache@v4
7678
with:
@@ -85,4 +87,4 @@ jobs:
8587
8688
- name: Build and test
8789
run: |
88-
dotnet test -f ${{ matrix.dotnet-version }} --no-restore --verbosity normal "tests\Mindee.UnitTests"
90+
dotnet test -f ${{ matrix.dotnet }} --no-restore --verbosity normal "tests\Mindee.UnitTests"

src/Mindee/ServiceCollectionsExtensions.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
using System;
2-
using System.Net;
32
using System.Net.Http.Headers;
43
using System.Reflection;
4+
using System.Runtime.InteropServices;
55
using Microsoft.Extensions.DependencyInjection;
6-
using Microsoft.Extensions.DependencyInjection.Extensions;
76
using Microsoft.Extensions.Options;
87
using Mindee.Http;
98
using Mindee.Pdf;
@@ -60,9 +59,18 @@ private static void RegisterRestSharpClient(IServiceCollection services, bool th
6059

6160
private static string BuildUserAgent()
6261
{
62+
string platform;
63+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
64+
platform = "windows";
65+
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
66+
platform = "linux";
67+
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
68+
platform = "macos";
69+
else
70+
platform = "other";
6371
return $"mindee-api-dotnet@v{Assembly.GetExecutingAssembly().GetName().Version}"
6472
+ $" dotnet-v{Environment.Version}"
65-
+ $" {Environment.OSVersion}";
73+
+ $" {platform}";
6674
}
6775

6876
/// <summary>

0 commit comments

Comments
 (0)