Skip to content

Commit

Permalink
Fix CI builds (#3484)
Browse files Browse the repository at this point in the history
* Fix CI builds

* More fix attempts

* Try using a newer .net version

* Change the SDK version again

* ..

* Upgrade analyzers, fix build warnings

* Fix the locale of a few tests

* Unignore some tests

* Expect loggedout

* adjust expectation
  • Loading branch information
nirinchev authored Dec 6, 2023
1 parent 087a4cd commit b7db4cb
Show file tree
Hide file tree
Showing 34 changed files with 170 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .github/templates/build-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
steps:
- #@ template.replace(checkoutCode())
- #@ template.replace(setupAndroid())
- #@ setupWorkloads('tvos ios maccatalyst android')
- #@ template.replace(setupWorkloads('tvos ios maccatalyst android'))
- name: Set version suffix
id: set-version-suffix
#! Build suffix is pr-1234.5 for pr builds or alpha.123 for branch builds.
Expand Down
2 changes: 1 addition & 1 deletion .github/templates/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#@ def buildPackages():
- #@ template.replace(setupAndroid())
- #@ setupWorkloads('tvos ios maccatalyst android')
- #@ template.replace(setupWorkloads('tvos ios maccatalyst android'))
- name: Add msbuild to PATH
uses: #@ actionSetupMSBuild
#@ for pkgName in nugetPackages:
Expand Down
15 changes: 13 additions & 2 deletions .github/templates/common.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#@ actionReleaseToSlack = "realm/ci-actions/release-to-slack@fa20eb972b9f018654fdb4e2c7afb52b0532f907"
#@ actionSetupXcode = "maxim-lobanov/setup-xcode@9a697e2b393340c3cacd97468baa318e4c883d98"
#@ actionSetupAndroid = "android-actions/setup-android@7c5672355aaa8fde5f97a91aa9a99616d1ace6bc"
#@ actionSetupJDK = "actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0"

#@ androidABIs = [ 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' ]
#@ windowsArchs = [ 'Win32', 'x64', 'ARM64' ]
Expand Down Expand Up @@ -230,8 +231,9 @@ with:
#@ end
---
#@ def setupWorkloads(workloads = 'maui'):
name: Setup workloads
run: #@ "dotnet workload install " + workloads
- _: #@ template.replace(setupDotnet("7.0.x"))
- name: Setup workloads
run: #@ "dotnet workload install " + workloads
#@ end
---
#@ def restoreWorkloads(workingDirectory = 'Realm/Realm.PlatformHelpers'):
Expand All @@ -245,4 +247,13 @@ working-directory: #@ "${{ github.workspace }}/" + workingDirectory
uses: #@ actionSetupAndroid
- name: Install SDK platform 21
run: sdkmanager --install "platforms;android-21"
- #@ setupJDK()
#@ end
---
#@ def setupJDK():
name: Setup JDK
uses: #@ actionSetupJDK
with:
distribution: microsoft
java-version: 11
#@ end
6 changes: 4 additions & 2 deletions .github/templates/test-android.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#@ load("@ytt:template", "template")
#@ load("common.lib.yml", "checkoutCode", "configureAWSCredentials", "fetchPackageArtifacts", "setupWorkloads")
#@ load("common.lib.yml", "checkoutCode", "configureAWSCredentials", "fetchPackageArtifacts", "setupWorkloads", "setupJDK")
#@ load("test.lib.yml", "baasTestArgs", "publishTestsResults", "testDefinition", "buildTests", "prepareTest")

---
Expand All @@ -11,6 +11,7 @@ jobs:
name: Xamarin.Android
timeout-minutes: 60
steps:
- #@ setupJDK()
- #@ template.replace(prepareTest("android"))
- #@ template.replace(buildTests("Tests/Tests.Android", target="SignAndroidPackage", AndroidUseSharedRuntime="False", EmbedAssembliesIntoApk="True"))
- #@ template.replace(configureAWSCredentials("AWS_DEVICEFARM_ACCESS_KEY_ID", "AWS_DEVICEFARM_SECRET_ACCESS_KEY", "us-west-2"))
Expand All @@ -32,7 +33,8 @@ jobs:
steps:
- #@ template.replace(checkoutCode())
- #@ template.replace(fetchPackageArtifacts())
- #@ setupWorkloads()
- #@ template.replace(setupWorkloads())
- #@ setupJDK()
- name: Build the tests
run: #@ "dotnet publish Tests/Tests.Maui -c Release -f net6.0-android -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }}"
- #@ template.replace(configureAWSCredentials("AWS_DEVICEFARM_ACCESS_KEY_ID", "AWS_DEVICEFARM_SECRET_ACCESS_KEY", "us-west-2"))
Expand Down
2 changes: 1 addition & 1 deletion .github/templates/test-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: |
sudo xcode-select -s "/Applications/Xcode_14.3.app"
echo "MD_APPLE_SDK_ROOT=/Applications/Xcode_14.3.app" >> $GITHUB_ENV
- #@ setupWorkloads()
- #@ template.replace(setupWorkloads())
- name: Build the tests
run: #@ "dotnet build Tests/Tests.Maui -c " + configuration + " -f net6.0-ios -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }}"
- name: Run the tests
Expand Down
2 changes: 1 addition & 1 deletion .github/templates/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
steps:
- #@ template.replace(checkoutCode())
- #@ template.replace(fetchPackageArtifacts())
- #@ setupWorkloads()
- #@ template.replace(setupWorkloads())
- name: Build the tests
run: #@ "dotnet build Tests/Tests.Maui -c " + configuration + " -f net6.0-maccatalyst -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }}"
- name: Run the tests
Expand Down
2 changes: 1 addition & 1 deletion .github/templates/test-source-generation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
timeout-minutes: 45
steps:
- #@ template.replace(checkoutCode())
- #@ setupWorkloads('tvos ios maccatalyst android')
- #@ template.replace(setupWorkloads('tvos ios maccatalyst android'))
- #@ template.replace(dotnetPublish("Tests/SourceGenerators/Realm.SourceGenerator.Tests", "net6.0", "win-x64"))
- name: Run the tests
run: #@ "${{ steps.dotnet-publish.outputs.executable-path }}/Realm.SourceGenerator.Tests --result=TestResults.SourceGeneration.xml"
Expand Down
2 changes: 1 addition & 1 deletion .github/templates/test-uwp-managed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: test-uwp-managed
_: #@ template.replace(testDefinition(["Base64_Encoded_Pfx", "Pfx_Password"]))
jobs:
run-tests:
runs-on: windows-2019
runs-on: windows-latest
name: UWP
timeout-minutes: 45
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/templates/test-weaver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
timeout-minutes: 30
steps:
- #@ template.replace(checkoutCode())
- #@ setupWorkloads("android ${{ (matrix.os.runner != 'ubuntu-latest' && 'tvos ios maccatalyst') || '' }}")
- #@ template.replace(setupWorkloads("android ${{ (matrix.os.runner != 'ubuntu-latest' && 'tvos ios maccatalyst') || '' }}"))
- #@ template.replace(dotnetPublish("Tests/Weaver/Realm.Fody.Tests", "net6.0", "${{ matrix.os.runtime }}"))
- name: Run Tests
run: ${{ steps.dotnet-publish.outputs.executable-path }}/Realm.Fody.Tests --result=TestResults.Weaver.xml --labels=After
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/build-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ jobs:
uses: android-actions/setup-android@7c5672355aaa8fde5f97a91aa9a99616d1ace6bc
- name: Install SDK platform 21
run: sdkmanager --install "platforms;android-21"
- name: Setup JDK
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
distribution: microsoft
java-version: 11
- name: Configure .NET
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a
with:
dotnet-version: 7.0.x
- name: Setup workloads
run: dotnet workload install tvos ios maccatalyst android
- name: Set version suffix
Expand Down Expand Up @@ -210,11 +219,11 @@ jobs:
uses: nirinchev/cache@29e8e4dd9148ea81f9e188480132072cb6cc92d8
with:
path: C:\docfx
key: docfx-2.62.1
key: docfx-2.70.4
- name: Download docfx
if: inputs.build-docs && steps.check-docfx-cache.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest -Uri https://github.com/dotnet/docfx/releases/download/v2.62.1/docfx-win-x64-v2.62.1.zip -OutFile C:\docfx.zip
Invoke-WebRequest -Uri https://github.com/dotnet/docfx/releases/download/v2.70.4/docfx-win-x64-v2.70.4.zip -OutFile C:\docfx.zip
Expand-Archive -Path C:\docfx.zip -DestinationPath C:\docfx
shell: powershell
- name: Configure .NET
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ jobs:
uses: android-actions/setup-android@7c5672355aaa8fde5f97a91aa9a99616d1ace6bc
- name: Install SDK platform 21
run: sdkmanager --install "platforms;android-21"
- name: Setup JDK
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
distribution: microsoft
java-version: 11
- name: Configure .NET
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a
with:
dotnet-version: 7.0.x
- name: Setup workloads
run: dotnet workload install tvos ios maccatalyst android
- name: Add msbuild to PATH
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/test-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ jobs:
name: Xamarin.Android
timeout-minutes: 60
steps:
- name: Setup JDK
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
distribution: microsoft
java-version: 11
- name: Checkout code
uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -123,8 +128,17 @@ jobs:
with:
name: Realm.${{ inputs.version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Configure .NET
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a
with:
dotnet-version: 7.0.x
- name: Setup workloads
run: dotnet workload install maui
- name: Setup JDK
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
distribution: microsoft
java-version: 11
- name: Build the tests
run: dotnet publish Tests/Tests.Maui -c Release -f net6.0-android -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }}
- name: Configure AWS Credentials
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ jobs:
run: |
sudo xcode-select -s "/Applications/Xcode_14.3.app"
echo "MD_APPLE_SDK_ROOT=/Applications/Xcode_14.3.app" >> $GITHUB_ENV
- name: Configure .NET
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a
with:
dotnet-version: 7.0.x
- name: Setup workloads
run: dotnet workload install maui
- name: Build the tests
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ jobs:
with:
name: Realm.${{ inputs.version }}
path: ${{ github.workspace }}/Realm/packages/
- name: Configure .NET
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a
with:
dotnet-version: 7.0.x
- name: Setup workloads
run: dotnet workload install maui
- name: Build the tests
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test-source-generation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ jobs:
run: echo "::add-matcher::.github/problem-matchers/csc.json"
- name: Register msvc problem matcher
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Configure .NET
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a
with:
dotnet-version: 7.0.x
- name: Setup workloads
run: dotnet workload install tvos ios maccatalyst android
- name: Publish Tests/SourceGenerators/Realm.SourceGenerator.Tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-uwp-managed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ env:
DOTNET_NOLOGO: true
jobs:
run-tests:
runs-on: windows-2019
runs-on: windows-latest
name: UWP
timeout-minutes: 45
steps:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test-weaver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ jobs:
run: echo "::add-matcher::.github/problem-matchers/csc.json"
- name: Register msvc problem matcher
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Configure .NET
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a
with:
dotnet-version: 7.0.x
- name: Setup workloads
run: dotnet workload install android ${{ (matrix.os.runner != 'ubuntu-latest' && 'tvos ios maccatalyst') || '' }}
- name: Publish Tests/Weaver/Realm.Fody.Tests
Expand Down
2 changes: 2 additions & 0 deletions Realm.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MI/@EntryIndexedValue">MI</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OS/@EntryIndexedValue">OS</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=abcde/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=adddefaulttypes/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Ainulindal_00EB/@EntryIndexedValue">True</s:Boolean>
Expand Down
16 changes: 8 additions & 8 deletions Realm/Realm.Fody/ModuleWeaver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,17 @@ private Config GetAnalyticsConfig(FrameworkName netFramework)

var framework = AnalyticsUtils.GetFrameworkAndVersion(ModuleDefinition);

return new()
return new(
targetOSName: AnalyticsUtils.GetTargetOsName(netFramework),
netFrameworkTarget: netFramework.Identifier,
netFrameworkTargetVersion: netFramework.Version.ToString(),
installationMethod: "Nuget",
frameworkName: framework.Name,
frameworkVersion: framework.Version,
compiler: "msbuild")
{
AnalyticsCollection = analyticsCollection,
AnalyticsLogPath = Config.Attribute("AnalyticsLogPath")?.Value,
InstallationMethod = "Nuget",
NetFrameworkTarget = netFramework.Identifier,
NetFrameworkTargetVersion = netFramework.Version.ToString(),
TargetOSName = AnalyticsUtils.GetTargetOsName(netFramework),
FrameworkName = framework.Name,
FrameworkVersion = framework.Version,
Compiler = "msbuild",
};
}

Expand Down
7 changes: 4 additions & 3 deletions Realm/Realm.Fody/Realm.Fody.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@
<BuildOutputTargetFolder>weaver</BuildOutputTargetFolder>
<DevelopmentDependency>true</DevelopmentDependency>
<Title>Realm.Fody</Title>
<Description>Realm.Fody is a Fody weaver used to replace the property setters and getters of your Realm models with Realm-backed ones.</Description>
<Description>Realm.Fody is a Fody weaver used to replace the property setters and getters of
your Realm models with Realm-backed ones.</Description>
<CodeAnalysisRuleSet>$(ProjectDir)..\..\global.ruleset</CodeAnalysisRuleSet>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn),1591, NU5100, NU5128, CA1050</NoWarn>
<LangVersion>11.0</LangVersion>
<LangVersion>10.0</LangVersion>
<IncludeSymbols>False</IncludeSymbols>
<DefineConstants>$(DefineConstants);PRIVATE_INDEXTYPE</DefineConstants>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup Label="References">
<PackageReference Include="FodyHelpers" Version="6.*" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.1">
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions Realm/Realm.PlatformHelpers/Realm.PlatformHelpers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

<TargetFrameworks>netstandard2.0</TargetFrameworks>
<!-- Mono MSBuild (16.0) on macOS cannot target .NET 6 so we can only add the .NET 6 tfms for dotnet build/Windows MSBuild -->
<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows')) OR (!$([MSBuild]::IsOsPlatform('Linux')) AND '$(MSBuildVersion)' &gt;= '17.0')">
<TargetFrameworks Condition="($([MSBuild]::IsOsPlatform('Windows')) AND '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'X64') OR ($([MSBuild]::IsOsPlatform('macOS')) AND '$(MSBuildVersion)' &gt;= '17.0')">
$(TargetFrameworks);net6.0-ios;net6.0-android;net6.0-maccatalyst;net6.0-tvos
</TargetFrameworks>
<!-- dotnet build on macOS cannot target Xamarin.XYZ -->
<!-- Additionally, the Xamarin targets are not available on Arm64 Windows -->
<TargetFrameworks Condition="($([MSBuild]::IsOsPlatform('Windows')) AND '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'X64') OR (!$([MSBuild]::IsOsPlatform('Linux')) AND '$(MSBuildVersion)' &lt; '17.0')">
<TargetFrameworks Condition="($([MSBuild]::IsOsPlatform('Windows')) AND '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'X64') OR ($([MSBuild]::IsOsPlatform('macOS')) AND '$(MSBuildVersion)' &lt; '17.0')">
$(TargetFrameworks);MonoAndroid5;Xamarin.iOS10;Xamarin.TVOS10;Xamarin.Mac20
</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);uap10.0.19041;</TargetFrameworks>
Expand Down
2 changes: 1 addition & 1 deletion Realm/Realm.SourceGenerator/Realm.SourceGenerator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<RootNamespace>Realms.SourceGenerator</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.1">
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion Realm/Realm.UnityWeaver/Realm.UnityWeaver.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.1">
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Loading

0 comments on commit b7db4cb

Please sign in to comment.