diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 040f260..19e5386 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,19 +7,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - # FIXME: Tools won't run in .NET 5.0 unless you install 3.1.x LTS side by side. - # https://itnext.io/how-to-support-multiple-net-sdks-in-github-actions-workflows-b988daa884e - - name: Install .NET 3.1.x LTS - uses: actions/setup-dotnet@v1 + - name: Install .NET 8.0.x + uses: actions/setup-dotnet@v3 with: - dotnet-version: "3.1.x" - - - name: Install .NET 6.0.x - uses: actions/setup-dotnet@v1 - with: - dotnet-version: "6.0.x" + dotnet-version: "8.0.x" - name: Restore Tools run: dotnet tool restore @@ -31,7 +24,7 @@ jobs: uses: actions/cache@v3 with: path: ${{ github.workspace }}/inspectcode - key: inspectcode-${{ hashFiles('.config/dotnet-tools.json', '.github/workflows/ci.yml', 'osu-framework-microphone.sln*', 'osu-framework-microphone*.slnf', '.editorconfig', '.globalconfig', 'CodeAnalysis/*') }} + key: inspectcode-${{ hashFiles('.config/dotnet-tools.json', '.github/workflows/ci.yml', 'osu-framework-microphone.sln*', 'osu-framework-microphone*.slnf', '.editorconfig', '.globalconfig', 'CodeAnalysis/*', '**/*.csproj', '**/*.props') }} - name: Dotnet code style run: dotnet build -c Debug -warnaserror osu-framework-microphone.Desktop.slnf -p:EnforceCodeStyleInBuild=true @@ -62,23 +55,24 @@ jobs: OSU_EXECUTION_MODE: ${{matrix.threadingMode}} OSU_TESTS_LOCAL_HTTPBIN: 1 strategy: - fail-fast: false - matrix: - os: - - { prettyname: Windows, fullname: windows-latest } - - { prettyname: macOS, fullname: macos-latest } - - { prettyname: Linux, fullname: ubuntu-latest } - threadingMode: ['SingleThread', 'MultiThreaded'] + fail-fast: false + matrix: + os: + - { prettyname: Windows, fullname: windows-latest, configuration: Debug } + - { prettyname: macOS, fullname: macos-latest, configuration: Debug } + - { prettyname: Linux, fullname: ubuntu-latest, configuration: Debug } + - { prettyname: Linux, fullname: ubuntu-latest, configuration: Release } + threadingMode: ['SingleThread', 'MultiThreaded'] timeout-minutes: 60 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - - name: Install .NET 6.0.x - uses: actions/setup-dotnet@v1 + - name: Install .NET 8.0.x + uses: actions/setup-dotnet@v3 with: - dotnet-version: "6.0.x" + dotnet-version: "8.0.x" - name: Setup Go uses: actions/setup-go@v3 @@ -91,20 +85,20 @@ jobs: shell: bash - name: Compile - run: dotnet build -c Debug -warnaserror osu-framework-microphone.Desktop.slnf + run: dotnet build -c ${{matrix.os.configuration}} -warnaserror osu-framework-microphone.Desktop.slnf - name: Test - run: dotnet test $pwd/**/*.Tests/bin/Debug/*/*.Tests.dll --settings $pwd/build/vstestconfig.runsettings --logger "trx;LogFileName=TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx" + run: dotnet test $pwd/**/*.Tests/bin/${{matrix.os.configuration}}/*/*.Tests.dll --no-build --settings $pwd/build/vstestconfig.runsettings --logger "trx;LogFileName=TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}-${{matrix.os.configuration}}.trx" shell: pwsh # Attempt to upload results even if test fails. # https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#always - name: Upload Test Results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: ${{ always() }} with: - name: osu-framework-microphone-test-results-${{matrix.os.prettyname}}-${{matrix.threadingMode}} - path: ${{github.workspace}}/TestResults/TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx + name: osu-framework-test-results-${{matrix.os.prettyname}}-${{matrix.threadingMode}}-${{matrix.os.configuration}} + path: ${{github.workspace}}/TestResults/TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}-${{matrix.os.configuration}}.trx build-only-android: name: Build only (Android) @@ -112,36 +106,42 @@ jobs: timeout-minutes: 60 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 + + - name: Setup JDK 11 + uses: actions/setup-java@v3 + with: + distribution: microsoft + java-version: 11 - - name: Install .NET 6.0.x - uses: actions/setup-dotnet@v1 + - name: Install .NET 8.0.x + uses: actions/setup-dotnet@v3 with: - dotnet-version: "6.0.x" + dotnet-version: "8.0.x" - name: Restore .NET workloads - run: dotnet workload restore + run: dotnet workload install android - name: Compile run: dotnet build -c Debug osu-framework-microphone.Android.slnf build-only-ios: - # ignore the ios build. - if: false name: Build only (iOS) runs-on: macos-latest timeout-minutes: 60 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - - name: Install .NET 6.0.x - uses: actions/setup-dotnet@v1 + - name: Install .NET 8.0.x + uses: actions/setup-dotnet@v3 with: - dotnet-version: "6.0.x" + dotnet-version: "8.0.x" - name: Restore .NET workloads - run: dotnet workload restore + # `dotnet workload restore` is bugged in .NET 7.0.101+ when restoring iOS projects, + # see https://github.com/xamarin/xamarin-macios/issues/16400. + run: dotnet workload install ios - name: Compile run: dotnet build -c Debug osu-framework-microphone.iOS.slnf diff --git a/.github/workflows/deploy-pack.yml b/.github/workflows/deploy-pack.yml index be30d1c..447cf4c 100644 --- a/.github/workflows/deploy-pack.yml +++ b/.github/workflows/deploy-pack.yml @@ -51,17 +51,10 @@ jobs: id: artifactsPath run: echo "::set-output name=NUGET_ARTIFACTS::${{github.workspace}}\artifacts" - # FIXME: 3.1 LTS is required here because iOS builds refuse to build without it. - # https://itnext.io/how-to-support-multiple-net-sdks-in-github-actions-workflows-b988daa884e - - name: Install .NET 3.1.x LTS - uses: actions/setup-dotnet@v1 + - name: Install .NET 8.0.x + uses: actions/setup-dotnet@v3 with: - dotnet-version: "3.1.x" - - - name: Install .NET 6.0.x - uses: actions/setup-dotnet@v1 - with: - dotnet-version: "6.0.x" + dotnet-version: "8.0.x" - name: Build (Framework) run: dotnet build -c Release osu.Framework.Microphone /p:Version=${{needs.check-if-tag.outputs.version}} /p:GenerateDocumentationFile=true/// diff --git a/Directory.Build.props b/Directory.Build.props index b93a2fd..5509892 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,10 +1,14 @@ - 10.0 + 12.0 true enable + + true + $(NoWarn);CS1591 + osu-framework-microphone.licenseheader @@ -37,8 +41,4 @@ https://github.com/karaoke-dev/osu-framework-microphone https://github.com/karaoke-dev/osu-framework-microphone - - false - $(EnableSourceLink) - diff --git a/osu-framework-microphone.sln b/osu-framework-microphone.sln index cff630e..be13e1c 100644 --- a/osu-framework-microphone.sln +++ b/osu-framework-microphone.sln @@ -104,7 +104,17 @@ Global {431614F4-D662-4CBD-B6C2-3E0D79CA968B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {431614F4-D662-4CBD-B6C2-3E0D79CA968B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {4D112E30-462B-4264-B44D-53B61ABB185E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4D112E30-462B-4264-B44D-53B61ABB185E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4D112E30-462B-4264-B44D-53B61ABB185E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4D112E30-462B-4264-B44D-53B61ABB185E}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {4D112E30-462B-4264-B44D-53B61ABB185E}.Debug|iPhone.Build.0 = Debug|Any CPU + {4D112E30-462B-4264-B44D-53B61ABB185E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {4D112E30-462B-4264-B44D-53B61ABB185E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {4D112E30-462B-4264-B44D-53B61ABB185E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4D112E30-462B-4264-B44D-53B61ABB185E}.Release|Any CPU.Build.0 = Release|Any CPU + {4D112E30-462B-4264-B44D-53B61ABB185E}.Release|iPhone.ActiveCfg = Release|Any CPU + {4D112E30-462B-4264-B44D-53B61ABB185E}.Release|iPhone.Build.0 = Release|Any CPU + {4D112E30-462B-4264-B44D-53B61ABB185E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {4D112E30-462B-4264-B44D-53B61ABB185E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/osu-framework-microphone.sln.DotSettings b/osu-framework-microphone.sln.DotSettings index 5c9b830..290e3c6 100644 --- a/osu-framework-microphone.sln.DotSettings +++ b/osu-framework-microphone.sln.DotSettings @@ -824,6 +824,7 @@ See the LICENCE file in the repository root for full licence text. True True True + True True True True diff --git a/osu.Framework.Microphone.Android.props b/osu.Framework.Microphone.Android.props index 089ae08..cfb888a 100644 --- a/osu.Framework.Microphone.Android.props +++ b/osu.Framework.Microphone.Android.props @@ -1,6 +1,5 @@ - 10.0 21.0 android-x86;android-arm;android-arm64 apk @@ -8,5 +7,6 @@ true true + $(NoWarn);XA4218 diff --git a/osu.Framework.Microphone.Android/osu.Framework.Microphone.Android.csproj b/osu.Framework.Microphone.Android/osu.Framework.Microphone.Android.csproj index 374c0eb..2ccea6a 100644 --- a/osu.Framework.Microphone.Android/osu.Framework.Microphone.Android.csproj +++ b/osu.Framework.Microphone.Android/osu.Framework.Microphone.Android.csproj @@ -1,6 +1,6 @@ - net6.0-android + net8.0-android 21.0 Library true @@ -18,6 +18,6 @@ - + diff --git a/osu.Framework.Microphone.Tests.Android/osu.Framework.Microphone.Tests.Android.csproj b/osu.Framework.Microphone.Tests.Android/osu.Framework.Microphone.Tests.Android.csproj index d711081..ea956fd 100644 --- a/osu.Framework.Microphone.Tests.Android/osu.Framework.Microphone.Tests.Android.csproj +++ b/osu.Framework.Microphone.Tests.Android/osu.Framework.Microphone.Tests.Android.csproj @@ -1,7 +1,7 @@  - net6.0-android + net8.0-android Exe osu.Framework.Microphone.Tests.Android osu.Framework.Tests.Android diff --git a/osu.Framework.Microphone.Tests.iOS/AppDelegate.cs b/osu.Framework.Microphone.Tests.iOS/AppDelegate.cs deleted file mode 100644 index 39db88a..0000000 --- a/osu.Framework.Microphone.Tests.iOS/AppDelegate.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) karaoke.dev . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using Foundation; -using osu.Framework.iOS; - -namespace osu.Framework.Tests; - -[Register("AppDelegate")] -public class AppDelegate : GameAppDelegate -{ - protected override Game CreateGame() => new VisualTestGame(); -} diff --git a/osu.Framework.Microphone.Tests.iOS/Application.cs b/osu.Framework.Microphone.Tests.iOS/Application.cs index 51eb9ec..644b465 100644 --- a/osu.Framework.Microphone.Tests.iOS/Application.cs +++ b/osu.Framework.Microphone.Tests.iOS/Application.cs @@ -1,14 +1,12 @@ // Copyright (c) karaoke.dev . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using UIKit; +using osu.Framework.iOS; namespace osu.Framework.Tests; public static class Application { - public static void Main(string[] args) - { - UIApplication.Main(args, null, typeof(AppDelegate)); - } + // This is the main entry point of the application. + public static void Main(string[] args) => GameApplication.Main(new VisualTestGame()); } diff --git a/osu.Framework.Microphone.Tests.iOS/osu.Framework.Microphone.Tests.iOS.csproj b/osu.Framework.Microphone.Tests.iOS/osu.Framework.Microphone.Tests.iOS.csproj index 51bd243..4b19a0a 100644 --- a/osu.Framework.Microphone.Tests.iOS/osu.Framework.Microphone.Tests.iOS.csproj +++ b/osu.Framework.Microphone.Tests.iOS/osu.Framework.Microphone.Tests.iOS.csproj @@ -1,7 +1,7 @@  Exe - net6.0-ios + net8.0-ios 13.4 osu.Framework.Tests osu.Framework.Tests diff --git a/osu.Framework.Microphone.Tests/osu.Framework.Microphone.Tests.csproj b/osu.Framework.Microphone.Tests/osu.Framework.Microphone.Tests.csproj index 20133a9..7f25010 100644 --- a/osu.Framework.Microphone.Tests/osu.Framework.Microphone.Tests.csproj +++ b/osu.Framework.Microphone.Tests/osu.Framework.Microphone.Tests.csproj @@ -1,6 +1,6 @@ - net6.0 + net8.0 WinExe diff --git a/osu.Framework.Microphone.iOS.props b/osu.Framework.Microphone.iOS.props index 720a62a..09889df 100644 --- a/osu.Framework.Microphone.iOS.props +++ b/osu.Framework.Microphone.iOS.props @@ -1,12 +1,11 @@  iPhone Developer - 10.0 true - MT7091 + $(NoWarn);MT7091 ios-arm64 diff --git a/osu.Framework.Microphone.iOS/Input/IOSMicrophoneHandler.cs b/osu.Framework.Microphone.iOS/Input/IOSMicrophoneHandler.cs index 25a2ec5..ae84b0c 100644 --- a/osu.Framework.Microphone.iOS/Input/IOSMicrophoneHandler.cs +++ b/osu.Framework.Microphone.iOS/Input/IOSMicrophoneHandler.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using AVFoundation; -using Foundation; using osu.Framework.Input.Handlers.Microphone; using osu.Framework.Logging; using osu.Framework.Platform; @@ -31,21 +30,13 @@ public override bool Initialize(GameHost host) if (granted) { - session.SetCategory(AVAudioSession.CategoryRecord, out NSError error); + var error = session.SetCategory(AVAudioSessionCategory.Record); if (error == null) { session.SetActive(true, out error); - - if (error != null) - { - Logger.Log(error.LocalizedDescription, LoggingTarget.Information, LogLevel.Error); - } - else - { - success = base.Initialize(host); - Logger.Log($"Microphone get permission status : {success}", LoggingTarget.Information); - } + success = base.Initialize(host); + Logger.Log($"Microphone get permission status : {success}", LoggingTarget.Information); } else { diff --git a/osu.Framework.Microphone.iOS/osu.Framework.Microphone.iOS.csproj b/osu.Framework.Microphone.iOS/osu.Framework.Microphone.iOS.csproj index 433a323..239cdb1 100644 --- a/osu.Framework.Microphone.iOS/osu.Framework.Microphone.iOS.csproj +++ b/osu.Framework.Microphone.iOS/osu.Framework.Microphone.iOS.csproj @@ -1,6 +1,6 @@ - net6.0-ios + net8.0-ios 13.4 Library true @@ -18,6 +18,6 @@ - + diff --git a/osu.Framework.Microphone/osu.Framework.Microphone.csproj b/osu.Framework.Microphone/osu.Framework.Microphone.csproj index 8f913fb..7e8c6d3 100644 --- a/osu.Framework.Microphone/osu.Framework.Microphone.csproj +++ b/osu.Framework.Microphone/osu.Framework.Microphone.csproj @@ -1,7 +1,7 @@ Library - net6.0 + net8.0 enable @@ -23,6 +23,6 @@ - +