diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index fb47763..15b9090 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -10,84 +10,10 @@ on:
release:
types: [published]
-env:
- BuildConfig: Release
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
-
jobs:
- build:
- runs-on: ubuntu-latest
- steps:
-
- - name: Checkout code
- uses: actions/checkout@v4
- with:
- fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
-
- - name: Setup .NET SDK
- uses: actions/setup-dotnet@v4
- with:
- global-json-file: ./global.json
-
- - name: Restore dependencies
- run: dotnet restore
-
- - name: Setup Git Versioning
- uses: dotnet/nbgv@master
- id: nbgv
-
- - name: Show Version Info
- run: |
- echo 'SemVer2: ${{ steps.nbgv.outputs.SemVer2 }}'
-
- - name: Build with dotnet
- run: dotnet build
- --no-restore --configuration ${{ env.BuildConfig }}
- /p:Version=${{ steps.nbgv.outputs.AssemblyVersion }}
-
- - name: Test with dotnet
- run: dotnet test
- --no-build --configuration ${{ env.BuildConfig }}
- --logger "trx;LogFileName=test-results.trx" --results-directory ./artifacts/test-results
- continue-on-error: true
-
- - name: Pack NuGet
- run: dotnet pack
- --configuration ${{ env.BuildConfig }}
- --output ./artifacts/nuget-packages
- /p:ContinuousIntegrationBuild=true
- /p:Version=${{ steps.nbgv.outputs.NuGetPackageVersion }}
-
- - name: Upload Artifacts
- uses: actions/upload-artifact@v4
- with:
- name: artifacts
- path: ./artifacts/**/*
-
- # the deploy job runs only when the build job is successful and the event is a release
- deploy:
- if: github.event_name == 'release'
- name: Publish Package
- needs: build
- runs-on: ubuntu-latest
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- with:
- fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
-
- - name: Download build artifacts
- uses: actions/download-artifact@v4
-
- - name: Upload release asset
- run: gh release upload ${{ github.event.release.tag_name }}
- ${{ github.workspace }}/artifacts/nuget-packages/*.*nupkg
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
- - name: Publish package
- run: dotnet nuget push
- ${{github.workspace}}/artifacts/nuget-packages/*.nupkg
- --source https://api.nuget.org/v3/index.json
- --api-key ${{ secrets.NUGET_API_KEY }}
- --skip-duplicate
+ build:
+ uses: mycsharp/github-actions/.github/workflows/dotnet-nuget-build.yml@main
+ with:
+ configuration: Release
+ secrets:
+ NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
diff --git a/src/MyCSharp.HttpUserAgentParser/HttpUserAgentPlatformType.cs b/src/MyCSharp.HttpUserAgentParser/HttpUserAgentPlatformType.cs
index 42deba8..de57827 100644
--- a/src/MyCSharp.HttpUserAgentParser/HttpUserAgentPlatformType.cs
+++ b/src/MyCSharp.HttpUserAgentParser/HttpUserAgentPlatformType.cs
@@ -46,5 +46,9 @@ public enum HttpUserAgentPlatformType : byte
///
/// Symbian
///
- Symbian
+ Symbian,
+ ///
+ /// ChromeOS
+ ///
+ ChromeOS
}
diff --git a/src/MyCSharp.HttpUserAgentParser/HttpUserAgentStatics.cs b/src/MyCSharp.HttpUserAgentParser/HttpUserAgentStatics.cs
index d6e2753..38339c2 100644
--- a/src/MyCSharp.HttpUserAgentParser/HttpUserAgentStatics.cs
+++ b/src/MyCSharp.HttpUserAgentParser/HttpUserAgentStatics.cs
@@ -47,6 +47,7 @@ public static class HttpUserAgentStatics
new(CreateDefaultPlatformRegex("iphone"), "iOS", HttpUserAgentPlatformType.IOS),
new(CreateDefaultPlatformRegex("ipad"), "iOS", HttpUserAgentPlatformType.IOS),
new(CreateDefaultPlatformRegex("ipod"), "iOS", HttpUserAgentPlatformType.IOS),
+ new(CreateDefaultPlatformRegex("cros"), "ChromeOS", HttpUserAgentPlatformType.ChromeOS),
new(CreateDefaultPlatformRegex("os x"), "Mac OS X", HttpUserAgentPlatformType.MacOS),
new(CreateDefaultPlatformRegex("ppc mac"), "Power PC Mac", HttpUserAgentPlatformType.MacOS),
new(CreateDefaultPlatformRegex("freebsd"), "FreeBSD", HttpUserAgentPlatformType.Linux),
@@ -271,7 +272,8 @@ public static readonly (string Key, string Value)[] Robots =
( "seoscanners.net", "SEO Scanners"),
( "Sistrix", "Sistrix" ),
( "WhatsApp", "WhatsApp" ),
- ( "CensysInspect", "CensysInspect" )
+ ( "CensysInspect", "CensysInspect" ),
+ ( "InternetMeasurement", "InternetMeasurement" )
];
///
diff --git a/tests/MyCSharp.HttpUserAgentParser.UnitTests/HttpUserAgentParserTests.cs b/tests/MyCSharp.HttpUserAgentParser.UnitTests/HttpUserAgentParserTests.cs
index 72f17bb..ffd2bf3 100644
--- a/tests/MyCSharp.HttpUserAgentParser.UnitTests/HttpUserAgentParserTests.cs
+++ b/tests/MyCSharp.HttpUserAgentParser.UnitTests/HttpUserAgentParserTests.cs
@@ -31,6 +31,7 @@ public class HttpUserAgentParserTests
[InlineData("Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.210 Mobile Safari/537.36", "Chrome", "90.0.4430.210", "Android", HttpUserAgentPlatformType.Android, "Android")]
[InlineData("Mozilla/5.0 (Linux; Android 10; SM-A205U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.210 Mobile Safari/537.36", "Chrome", "90.0.4430.210", "Android", HttpUserAgentPlatformType.Android, "Android")]
[InlineData("Mozilla/5.0 (Linux; Android 10; LM-Q720) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.210 Mobile Safari/537.36", "Chrome", "90.0.4430.210", "Android", HttpUserAgentPlatformType.Android, "Android")]
+ [InlineData("Mozilla/5.0 (X11; CrOS x86_64 15917.71.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.6533.132 Safari/537.36", "Chrome", "127.0.6533.132", "ChromeOS", HttpUserAgentPlatformType.ChromeOS, null)]
// Safari
[InlineData("Mozilla/5.0 (Windows; U; Windows NT 10.0; en-US) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/11.0 Safari/605.1.15", "Safari", "11.0", "Windows 10", HttpUserAgentPlatformType.Windows, null)]
[InlineData("Mozilla/5.0 (Macintosh; Intel Mac OS X 11_3_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Safari/605.1.15", "Safari", "14.1", "Mac OS X", HttpUserAgentPlatformType.MacOS, null)]
@@ -147,6 +148,7 @@ public void BrowserTests(string ua, string name, string version, string platform
[InlineData("Mozilla/5.0 (compatible; archive.org_bot +http://archive.org/details/archive.org_bot)", "archive.org")]
[InlineData("Mozilla/5.0 (compatible; MojeekBot/0.11; +mojeek.com/bot.html)", "MojeekBot")]
[InlineData("Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)", "CensysInspect")]
+ [InlineData("Mozilla/5.0 (compatible; InternetMeasurement/1.0; +https://internet-measurement.com/)", "InternetMeasurement")]
public void BotTests(string ua, string name)
{
HttpUserAgentInformation uaInfo = HttpUserAgentInformation.Parse(ua);