Skip to content

Commit

Permalink
Evaluate Apple Silicon for CI (#1693)
Browse files Browse the repository at this point in the history
* Evaluate Apple Silicon for CI

* Let's see what happens if we don't install old .NET versions

* sus error message on .NET 6

* BinaryFormatter 🤮🤮🤮

* Work around some deficiencies in the RC1 SDK (dotnet/sdk#35811)

* oops

* github.dev find+replace does not work

* Maths unit tests are now .NET 8

* Vulkan unit tests are now .NET 8

* Ok let's just disable tests for now

* Don't forget the public API!

* Attempt to fix android, as well as cache to make faster maybe

* Install Android platforms

* Reenable .NET 6?

* Install workloads for .NET 6 and .NET 8

* Comical hack

* ANNIHILATE .NET 8

* Install Android 31

* Maybe the tests are fine on .NET 6?

* they were not fine

* Forgo Apple Silicon for now

* Apparently caching is slower than JUST DOING IT

* Fix a very sus unit test failure

* Just testing something...

* Update build.yml

* attempt 2

* Tinker with Apple Silicon again

* Detailed verbosity, will probably regret this

* Update .NET 6

* Update build/nuke/Build.Support.cs
  • Loading branch information
Perksey authored Oct 10, 2023
1 parent 346b380 commit 9014e3b
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 37 deletions.
51 changes: 24 additions & 27 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,7 @@ permissions:
packages: write
jobs:
Build:
# This will:
# - use windows-quick (self-hosted only) for release tags on this repo
# - use windows-2022 (self-hosted or GitHub-hosted depending on what's available) for development in this repo
# - use windows-latest (GitHub-hosted only) in all other cases (i.e. community contributions)
# Note: the reason we use windows-2022 instead of windows-latest is so that both the self-hosted runner
# (which has the windows-2022 label but NOT the windows-latest label) and the GitHub hosted runner are
# treated as candidates. We will never have a windows-latest self-hosted runner even if it is the latest.
runs-on: ${{ github.repository == 'dotnet/Silk.NET' && startsWith(github.ref, 'refs/tags/') && 'windows-quick' || github.repository == 'dotnet/Silk.NET' && 'windows-2022' || 'windows-latest' }}
runs-on: macos-13-xlarge
steps:
- uses: actions/checkout@v3.5.2
with:
Expand All @@ -33,42 +26,46 @@ jobs:
with:
java-version: 11
distribution: "temurin"
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.102
- name: Setup Android Environment
uses: android-actions/setup-android@v2
env:
ANDROID_SDK_ROOT: /Users/runner/Library/Android/sdk
- name: Install Android Platforms
run: |
sdkmanager --install "build-tools;32.0.0"
sdkmanager --install "platform-tools"
sdkmanager --install "platforms;android-31"
sdkmanager --install "platforms;android-33"
sdkmanager --install "platforms;android-34"
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.201
- name: Setup .NET 5.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.201
- name: Setup .NET Core 3.1
dotnet-version: 6.0.414
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.404
dotnet-version: 7.0.102
- name: Install Workloads
# TODO: This is slow. Maybe we can make a docker container with this already done?
run: dotnet workload install android ios maccatalyst maui
- name: Test
if: ${{ github.repository != 'dotnet/Silk.NET' || !startsWith(github.ref, 'refs/tags/') }}
# skip Clean, Restore, and Compile as this will build the affect the whole solution.
# dotnet test will compile the necessary projects for testing only.
run: .\build.cmd Test --skip Clean Restore Compile
run: ./build.sh Test --skip Clean Restore Compile
- name: Validation Checks
if: ${{ github.repository != 'dotnet/Silk.NET' || !startsWith(github.ref, 'refs/tags/') }}
run: .\build.cmd ValidateSolution
run: ./build.sh ValidateSolution
- name: Pack (CI)
if: ${{ github.repository != 'dotnet/Silk.NET' || !startsWith(github.ref, 'refs/tags/') }}
# TODO build native mixins such as BuildLibSilkDroid
# Use a release NUKE so it doesn't interfere with the debug build
run: dotnet run --project build/nuke/Silk.NET.NUKE.csproj -c Release -- Pack --configuration Debug --msbuild-properties VersionSuffix=build${{ github.run_number }}.0 ContinuousIntegrationBuild=true
env:
ANDROID_HOME: /Users/runner/Library/Android/sdk
- name: Pack (CD)
if: ${{ github.repository == 'dotnet/Silk.NET' && startsWith(github.ref, 'refs/tags/') }}
# TODO build native mixins such as BuildLibSilkDroid
run: .\build.cmd Pack --configuration Release --msbuild-properties ContinuousIntegrationBuild=true
run: ./build.sh Pack --configuration Release --msbuild-properties ContinuousIntegrationBuild=true
- name: Upload Unsigned Artifacts to Actions
uses: actions/upload-artifact@v2.2.4
with:
Expand All @@ -78,13 +75,13 @@ jobs:
retention-days: 1
- name: Sign Packages
if: ${{ github.repository == 'dotnet/Silk.NET' && startsWith(github.ref, 'refs/tags/') }}
run: .\build.cmd SignPackages --akv-certificate ${{ secrets.AKV_CERTIFICATE }} --akv-client-id ${{ secrets.AKV_CLIENT_ID }} --akv-client-secret ${{ secrets.AKV_CLIENT_SECRET }} --akv-tenant ${{ secrets.AKV_TENANT }} --akv-vault-url ${{ secrets.AKV_VAULT_URL }}
run: ./build.sh SignPackages --akv-certificate ${{ secrets.AKV_CERTIFICATE }} --akv-client-id ${{ secrets.AKV_CLIENT_ID }} --akv-client-secret ${{ secrets.AKV_CLIENT_SECRET }} --akv-tenant ${{ secrets.AKV_TENANT }} --akv-vault-url ${{ secrets.AKV_VAULT_URL }}
- name: Push to Experimental Feed
if: ${{ github.repository == 'dotnet/Silk.NET' && github.event_name != 'pull_request' }}
run: .\build.cmd PushToNuGet --skip Clean Restore Compile Pack --nuget-feed https://dotnet.github.io/Silk.NET/nuget/experimental/index.json --nuget-username ${{ secrets.EXP_NUGET_USERNAME }} --nuget-password ${{ secrets.EXP_NUGET_PASSWORD }} --nuget-api-key ${{ secrets.EXP_NUGET_PASSWORD }}
run: ./build.sh PushToNuGet --skip Clean Restore Compile Pack --nuget-feed https://dotnet.github.io/Silk.NET/nuget/experimental/index.json --nuget-username ${{ secrets.EXP_NUGET_USERNAME }} --nuget-password ${{ secrets.EXP_NUGET_PASSWORD }} --nuget-api-key ${{ secrets.EXP_NUGET_PASSWORD }}
- name: Push to GitHub Packages
if: ${{ github.repository == 'dotnet/Silk.NET' && github.event_name != 'pull_request' }}
run: .\build.cmd PushToNuGet --skip Clean Restore Compile Pack --nuget-feed https://nuget.pkg.github.com/dotnet/index.json --nuget-api-key ${{ secrets.GITHUB_TOKEN }}
run: ./build.sh PushToNuGet --skip Clean Restore Compile Pack --nuget-feed https://nuget.pkg.github.com/dotnet/index.json --nuget-api-key ${{ secrets.GITHUB_TOKEN }}
- name: Upload Signed Artifacts to Actions
if: ${{ github.repository == 'dotnet/Silk.NET' && startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v2.2.4
Expand All @@ -94,5 +91,5 @@ jobs:
if-no-files-found: warn
- name: Push to NuGet
if: ${{ github.repository == 'dotnet/Silk.NET' && startsWith(github.ref, 'refs/tags/') }}
run: .\build.cmd PushToNuGet --skip Clean Restore Pack --nuget-api-key ${{ secrets.NUGET_TOKEN }}
run: ./build.sh PushToNuGet --skip Clean Restore Pack --nuget-api-key ${{ secrets.NUGET_TOKEN }}

2 changes: 1 addition & 1 deletion build/nuke/Build.Support.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ async Task AddOrUpdatePrComment(string type, string file, bool editOnly = false,
var finalArgs = arguments.RenderForExecution();
if (!Warnings)
{
finalArgs += " /clp:ErrorsOnly";
finalArgs += " /clp:errorsonly";
}

using var proc = StartProcess
Expand Down
3 changes: 2 additions & 1 deletion build/nuke/Silk.NET.NUKE.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<RootNamespace></RootNamespace>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>..\..</NukeRootDirectory>
<NukeScriptDirectory>..\..</NukeScriptDirectory>
<LangVersion>preview</LangVersion>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions build/props/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<Description Condition="'$(Description)' == ''">
Silk.NET is a high-speed, advanced library, providing bindings to popular low-level APIs such as OpenGL, OpenCL, OpenAL, OpenXR, GLFW, SDL, Vulkan, Assimp, and DirectX.
</Description>
<CheckEolWorkloads>false</CheckEolWorkloads>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6')) or $(TargetFramework.StartsWith('net7')) or $(TargetFramework.StartsWith('net8'))">
<IsTrimmable>true</IsTrimmable>
Expand Down
2 changes: 1 addition & 1 deletion src/Maths/Silk.NET.Maths.Tests/Silk.NET.Maths.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net5.0;netcoreapp3.1;netframework4.8</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<LangVersion>9.0</LangVersion>
<IsPackable>false</IsPackable>

Expand Down
6 changes: 3 additions & 3 deletions src/Maths/Silk.NET.Maths/Silk.NET.Maths.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<WarningsAsErrors>true</WarningsAsErrors>
<LangVersion>9.0</LangVersion>

<DefineConstants Condition="'$(TargetFramework)' == 'netcoreapp3.1' Or '$(TargetFramework)' == 'net5.0'">$(DefineConstants);SSE</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'netcoreapp3.1' Or '$(TargetFramework)' == 'net5.0' Or '$(TargetFramework)' == 'netstandard2.1'">$(DefineConstants);BTEC_INTRINSICS;MATHF</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net5.0'">$(DefineConstants);POH;AdvSIMD</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'netcoreapp3.1' Or '$(TargetFramework)' == 'net5.0' Or '$(TargetFramework)' == 'net6.0-android' Or '$(TargetFramework)' == 'net6.0-ios'">$(DefineConstants);SSE</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'netcoreapp3.1' Or '$(TargetFramework)' == 'net5.0' Or '$(TargetFramework)' == 'net6.0-android' Or '$(TargetFramework)' == 'net6.0-ios' Or '$(TargetFramework)' == 'netstandard2.1'">$(DefineConstants);BTEC_INTRINSICS;MATHF</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net5.0' Or '$(TargetFramework)' == 'net6.0-android' Or '$(TargetFramework)' == 'net6.0-ios'">$(DefineConstants);POH;AdvSIMD</DefineConstants>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
Expand Down
8 changes: 6 additions & 2 deletions src/Vulkan/Silk.NET.Vulkan.Tests/TestChains.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ public unsafe void TestChainDuplicate()
Assert.NotEqual((nint) chain.Item1Ptr, (nint) newChain.Item1Ptr);

// Test equality
Assert.Equal(chain, newChain);
Assert.Equal(chain.Head with {PNext = null}, newChain.Head with {PNext = null});
Assert.Equal(chain.Item1, newChain.Item1);
Assert.Equal((nint)chain.Head.PNext, (nint)chain.Item1Ptr);
Assert.True(chain == newChain);

// Modify second chain
Expand Down Expand Up @@ -433,7 +435,9 @@ public unsafe void TestChainGetHashCode()
Assert.NotEqual((nint) chain.Item1Ptr, (nint) newChain.Item1Ptr);

// Test equality
Assert.Equal(chain, newChain);
Assert.Equal(chain.Head with {PNext = null}, newChain.Head with {PNext = null});
Assert.Equal(chain.Item1, newChain.Item1);
Assert.Equal((nint)chain.Head.PNext, (nint)chain.Item1Ptr);
Assert.True(chain == newChain);
var hashCode = chain.GetHashCode();
var newHashCode = newChain.GetHashCode();
Expand Down
4 changes: 3 additions & 1 deletion src/Vulkan/Silk.NET.Vulkan.Tests/TestChainsAny.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ public unsafe void TestChainDuplicateAny()
Assert.NotEqual((nint) chain.Item1Ptr, (nint) newChain.Item1Ptr);

// Test equality
Assert.Equal(chain, newChain);
Assert.Equal(chain.Head with {PNext = null}, newChain.Head with {PNext = null});
Assert.Equal(chain.Item1, newChain.Item1);
Assert.Equal((nint)chain.Head.PNext, (nint)chain.Item1Ptr);
Assert.True(chain == newChain);
}

Expand Down

0 comments on commit 9014e3b

Please sign in to comment.