Skip to content

Commit

Permalink
Merge pull request #284 from andy840119/add-net-6-support
Browse files Browse the repository at this point in the history
Add net 6 support.
  • Loading branch information
andy840119 authored Dec 20, 2022
2 parents 23a4c4c + eaa8d1f commit 3ae2396
Show file tree
Hide file tree
Showing 18 changed files with 120 additions and 302 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
]
},
"jetbrains.resharper.globaltools": {
"version": "2022.1.1",
"version": "2022.2.3",
"commands": [
"jb"
]
Expand Down
101 changes: 47 additions & 54 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
on: [push, pull_request]
name: Continuous Integration

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
inspect-code:
name: Code Quality
Expand All @@ -14,7 +9,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

# FIXME: Tools won't run in .NET 6.0 unless you install 3.1.x LTS side by side.
# 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
Expand All @@ -30,34 +25,29 @@ jobs:
run: dotnet tool restore

- name: Restore Packages
run: dotnet restore
run: dotnet restore osu-framework-microphone.Desktop.slnf

- name: Restore inspectcode cache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/inspectcode
key: inspectcode-${{ hashFiles('.config/dotnet-tools.json', '.github/workflows/ci.yml', 'osu-framework-microphone.sln*', '.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/*') }}

- name: Dotnet code style
run: dotnet build -c Debug -warnaserror build/Desktop.proj -p:EnforceCodeStyleInBuild=true

# todo: add this test back.
# - name: CodeFileSanity
# run: |
# # TODO: Add ignore filters and GitHub Workflow Command Reporting in CFS. That way we don't have to do this workaround.
# # FIXME: Suppress warnings from templates project
# exit_code=0
# while read -r line; do
# if [[ ! -z "$line" && "$line" != *"/osu.Framework.Templates/"* ]]; then
# echo "::error::$line"
# exit_code=1
# fi
# done <<< $(dotnet codefilesanity)
# exit $exit_code

# Temporarily disabled due to test failures, but it won't work anyway until the tool is upgraded.
# - name: .NET Format (Dry Run)
# run: dotnet format --dry-run --check
run: dotnet build -c Debug -warnaserror osu-framework-microphone.Desktop.slnf -p:EnforceCodeStyleInBuild=true

- name: CodeFileSanity
run: |
# TODO: Add ignore filters and GitHub Workflow Command Reporting in CFS. That way we don't have to do this workaround.
# FIXME: Suppress warnings from templates project
exit_code=0
while read -r line; do
if [[ ! -z "$line" && "$line" != *"/osu.Framework.Templates/"* ]]; then
echo "::error::$line"
exit_code=1
fi
done <<< $(dotnet codefilesanity)
exit $exit_code
- name: InspectCode
run: dotnet jb inspectcode $(pwd)/osu-framework-microphone.Desktop.slnf --no-build --output="inspectcodereport.xml" --caches-home="inspectcode" --verbosity=WARN
Expand All @@ -70,15 +60,17 @@ jobs:
runs-on: ${{matrix.os.fullname}}
env:
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 }
- { prettyname: macOS, fullname: macos-latest }
- { prettyname: Linux, fullname: ubuntu-latest }
threadingMode: ['SingleThread', 'MultiThreaded']
timeout-minutes: 60

steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -88,20 +80,21 @@ jobs:
with:
dotnet-version: "6.0.x"

# FIXME: libavformat is not included in Ubuntu. Let's fix that.
# https://github.com/ppy/osu-framework/issues/4349
# Remove this once https://github.com/actions/virtual-environments/issues/3306 has been resolved.
- name: Install libavformat-dev
if: ${{matrix.os.fullname == 'ubuntu-latest'}}
run: |
sudo apt-get update && \
sudo apt-get -y install libavformat-dev
- name: Setup Go
uses: actions/setup-go@v3

- name: Install httpbin
run: go install github.com/mccutchen/go-httpbin/v2/cmd/go-httpbin@latest

- name: Run httpbin
run: $HOME/go/bin/go-httpbin &
shell: bash

- name: Compile
run: dotnet build -c Debug -warnaserror build/Desktop.proj
run: dotnet build -c Debug -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/Debug/*/*.Tests.dll --settings $pwd/build/vstestconfig.runsettings --logger "trx;LogFileName=TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx"
shell: pwsh

# Attempt to upload results even if test fails.
Expand All @@ -126,11 +119,11 @@ jobs:
with:
dotnet-version: "6.0.x"

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
- name: Restore .NET workloads
run: dotnet workload restore

- name: Build
run: msbuild osu-framework-microphone.Android.slnf /restore /p:Configuration=Debug
- name: Compile
run: dotnet build -c Debug osu-framework-microphone.Android.slnf

build-only-ios:
name: Build only (iOS)
Expand All @@ -145,8 +138,8 @@ jobs:
with:
dotnet-version: "6.0.x"

# Contrary to seemingly any other msbuild, msbuild running on macOS/Mono
# cannot accept .sln(f) files as arguments.
# Build just the iOS framework project for now.
- name: Build
run: msbuild osu.Framework.Microphone.iOS/osu.Framework.Microphone.iOS.csproj /restore /p:Configuration=Debug
- name: Restore .NET workloads
run: dotnet workload restore osu.Framework.Microphone.iOS/osu.Framework.Microphone.iOS.csproj

- name: Compile
run: dotnet build -c Debug osu-framework-microphone.iOS.slnf
21 changes: 16 additions & 5 deletions .github/workflows/deploy-pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ jobs:
run: |
REPOSITORY="https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}.git"
BRANCH="${GITHUB_REF/#refs\/heads\//}"
git version
git clone --no-checkout ${REPOSITORY} .
git config --local gc.auto 0
git -c protocol.version=2 fetch --no-tags --prune --progress --depth=2 origin +${GITHUB_SHA}:refs/remotes/origin/${BRANCH}
git checkout --progress --force -B $BRANCH refs/remotes/origin/$BRANCH
- name: Set Variables
id: deployment
shell: bash
Expand All @@ -31,6 +35,7 @@ jobs:
echo "fatal: no tag detected for HEAD. Workflow will now stop."
exit 128;
fi
pack-framework:
name: Pack (Framework)
runs-on: windows-latest
Expand All @@ -46,14 +51,18 @@ 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
with:
dotnet-version: "3.1.x"

- name: Install .NET 6.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x"

- name: Build (Framework)
run: dotnet build -c Release osu.Framework.Microphone /p:Version=${{needs.check-if-tag.outputs.version}} /p:GenerateDocumentationFile=true

- name: Pack (Framework)
run: dotnet pack -c Release osu.Framework.Microphone /p:Version=${{needs.check-if-tag.outputs.version}} /p:GenerateDocumentationFile=true -o ${{steps.artifactsPath.outputs.nuget_artifacts}}

Expand All @@ -66,7 +75,7 @@ jobs:
release:
name: Release
runs-on: ubuntu-latest
needs: [ check-if-tag, pack-framework ]
needs: [check-if-tag, pack-framework]
steps:
- name: Create Artifact Directory
run: mkdir ${{github.workspace}}/artifacts/
Expand All @@ -83,6 +92,8 @@ jobs:
run: |
mv -v **/*.nupkg $(pwd)
rm -rfv */
- name: Deploy
run: |
dotnet nuget push ${{github.workspace}}/artifacts/*.nupkg --skip-duplicate --source https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_AUTH_TOKEN}}
dotnet nuget add source https://api.nuget.org/v3/index.json -n authed-nuget -u ${{secrets.NUGET_USER_NAME}} -p ${{secrets.NUGET_AUTH_TOKEN}}
dotnet nuget push ${{github.workspace}}/artifacts/*.nupkg --skip-duplicate --source authed-nuget
52 changes: 6 additions & 46 deletions osu.Framework.Microphone.Android.props
Original file line number Diff line number Diff line change
@@ -1,52 +1,12 @@
<Project>
<PropertyGroup>
<LangVersion>9.0</LangVersion>
<OutputPath>bin\$(Configuration)</OutputPath>
<WarningLevel>4</WarningLevel>
<SchemaVersion>2.0</SchemaVersion>
<BundleAssemblies>false</BundleAssemblies>
<AotAssemblies>false</AotAssemblies>
<OutputType>Library</OutputType>
<FileAlignment>512</FileAlignment>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidApplication>True</AndroidApplication>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
<TargetFrameworkVersion>v10.0</TargetFrameworkVersion>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AndroidSupportedAbis>armeabi-v7a;x86;arm64-v8a</AndroidSupportedAbis>
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
<MandroidI18n>cjk,mideast,other,rare,west</MandroidI18n>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DebugSymbols>True</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>False</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AndroidManagedSymbols>false</AndroidManagedSymbols>
<AndroidUseSharedRuntime>true</AndroidUseSharedRuntime>
<EmbedAssembliesIntoApk>false</EmbedAssembliesIntoApk>
<AndroidLinkMode>None</AndroidLinkMode>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<DebugSymbols>false</DebugSymbols>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<AndroidManagedSymbols>false</AndroidManagedSymbols>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
<SupportedOSPlatformVersion>21.0</SupportedOSPlatformVersion>
<RuntimeIdentifiers>android-x86;android-arm;android-arm64</RuntimeIdentifiers>
<AndroidPackageFormat>apk</AndroidPackageFormat>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidMessageHandler</AndroidHttpClientHandlerType>
<!-- NullabilityInfoContextSupport is disabled by default for Android -->
<NullabilityInfoContextSupport>true</NullabilityInfoContextSupport>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Mono.Android" />
<Reference Include="Java.Interop" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.1204.0" />
</ItemGroup>
</Project>
7 changes: 0 additions & 7 deletions osu.Framework.Microphone.Android/global.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras/3.0.44">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Project">
<TargetFramework>monoandroid10.0</TargetFramework>
<TargetFramework>net6.0-android</TargetFramework>
<SupportedOSPlatformVersion>21.0</SupportedOSPlatformVersion>
<OutputType>Library</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyTitle>osu.Framework.Microphone.Android</AssemblyTitle>
Expand All @@ -13,16 +14,10 @@
<PackageId>osu.Framework.Microphone.Android</PackageId>
<PackageTags>osu-framework microphone andy840119</PackageTags>
</PropertyGroup>
<ItemGroup>
<Reference Include="Java.Interop" />
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\osu.Framework.Microphone\osu.Framework.Microphone.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.1204.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.1216.1" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="osu.Framework.Tests.Android" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29" />
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31" />
<application android:label="osu!framework test" />
</manifest>
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\osu.Framework.Microphone.Android.props" />
<PropertyGroup>
<LangVersion>9.0</LangVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{320089C6-A141-4D3E-BD5F-C4A6CE9E567B}</ProjectGuid>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFramework>net6.0-android</TargetFramework>
<OutputType>Exe</OutputType>
<AssemblyName>osu.Framework.Microphone.Tests.Android</AssemblyName>
<RootNamespace>osu.Framework.Tests.Android</RootNamespace>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<AndroidSupportedAbis>armeabi-v7a;x86;arm64-v8a</AndroidSupportedAbis>
<TargetFrameworkVersion>v10.0</TargetFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<Compile Include="TestGameActivity.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\AndroidManifest.xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\osu.Framework.Microphone.Tests\**\*.cs" Exclude="..\osu.Framework.Microphone.Tests\Program.cs;..\osu.Framework.Microphone.Tests\obj\**\*;..\osu.Framework.Microphone.Tests\bin\**\*">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
Expand All @@ -26,18 +14,7 @@
<Link>Resources\%(RecursiveDir)%(Filename)%(Extension)</Link>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\osu.Framework.Microphone.Android\osu.Framework.Microphone.Android.csproj">
<Project>{4d112e30-462b-4264-b44d-53b61abb185e}</Project>
<Name>osu.Framework.Microphone.Android</Name>
</ProjectReference>
<ProjectReference Include="..\osu.Framework.Microphone\osu.Framework.Microphone.csproj">
<Project>{D0F85C61-800A-4645-8633-AC59208FA732}</Project>
<Name>osu.Framework.Microphone</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Reference Include="System.Numerics" />
<ItemGroup Label="Project References">
<ProjectReference Include="..\osu.Framework.Microphone.Android\osu.Framework.Microphone.Android.csproj" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
</Project>
Loading

0 comments on commit 3ae2396

Please sign in to comment.