From 9014e3b249ca8f5c51310346599b7bbdfc10c385 Mon Sep 17 00:00:00 2001 From: Dylan Perks <11160611+Perksey@users.noreply.github.com> Date: Mon, 9 Oct 2023 19:53:09 -0500 Subject: [PATCH] Evaluate Apple Silicon for CI (#1693) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- .github/workflows/build.yml | 51 +++++++++---------- build/nuke/Build.Support.cs | 2 +- build/nuke/Silk.NET.NUKE.csproj | 3 +- build/props/common.props | 1 + .../Silk.NET.Maths.Tests.csproj | 2 +- .../Silk.NET.Maths/Silk.NET.Maths.csproj | 6 +-- .../Silk.NET.Vulkan.Tests.csproj | 2 +- .../Silk.NET.Vulkan.Tests/TestChains.cs | 8 ++- .../Silk.NET.Vulkan.Tests/TestChainsAny.cs | 4 +- 9 files changed, 42 insertions(+), 37 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1a24046b81..1d2fc1082a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: @@ -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: @@ -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 @@ -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 }} diff --git a/build/nuke/Build.Support.cs b/build/nuke/Build.Support.cs index a13dbb6293..2d13394232 100644 --- a/build/nuke/Build.Support.cs +++ b/build/nuke/Build.Support.cs @@ -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 diff --git a/build/nuke/Silk.NET.NUKE.csproj b/build/nuke/Silk.NET.NUKE.csproj index fec4abc2a5..f44a75e1a9 100644 --- a/build/nuke/Silk.NET.NUKE.csproj +++ b/build/nuke/Silk.NET.NUKE.csproj @@ -2,13 +2,14 @@ Exe - net6.0 + net7.0 CS0649;CS0169 ..\.. ..\.. preview 1 + true diff --git a/build/props/common.props b/build/props/common.props index a929255bb7..97d706d945 100644 --- a/build/props/common.props +++ b/build/props/common.props @@ -24,6 +24,7 @@ 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. + false true diff --git a/src/Maths/Silk.NET.Maths.Tests/Silk.NET.Maths.Tests.csproj b/src/Maths/Silk.NET.Maths.Tests/Silk.NET.Maths.Tests.csproj index 2cace41400..f5b8a1b5f2 100644 --- a/src/Maths/Silk.NET.Maths.Tests/Silk.NET.Maths.Tests.csproj +++ b/src/Maths/Silk.NET.Maths.Tests/Silk.NET.Maths.Tests.csproj @@ -1,7 +1,7 @@ - net5.0;netcoreapp3.1;netframework4.8 + net6.0 9.0 false diff --git a/src/Maths/Silk.NET.Maths/Silk.NET.Maths.csproj b/src/Maths/Silk.NET.Maths/Silk.NET.Maths.csproj index aea46edee2..32d4af7f16 100644 --- a/src/Maths/Silk.NET.Maths/Silk.NET.Maths.csproj +++ b/src/Maths/Silk.NET.Maths/Silk.NET.Maths.csproj @@ -8,9 +8,9 @@ true 9.0 - $(DefineConstants);SSE - $(DefineConstants);BTEC_INTRINSICS;MATHF - $(DefineConstants);POH;AdvSIMD + $(DefineConstants);SSE + $(DefineConstants);BTEC_INTRINSICS;MATHF + $(DefineConstants);POH;AdvSIMD true true diff --git a/src/Vulkan/Silk.NET.Vulkan.Tests/Silk.NET.Vulkan.Tests.csproj b/src/Vulkan/Silk.NET.Vulkan.Tests/Silk.NET.Vulkan.Tests.csproj index 5c8f696be6..c7c7cc1f3d 100644 --- a/src/Vulkan/Silk.NET.Vulkan.Tests/Silk.NET.Vulkan.Tests.csproj +++ b/src/Vulkan/Silk.NET.Vulkan.Tests/Silk.NET.Vulkan.Tests.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1;net5.0 + net6.0 true preview enable diff --git a/src/Vulkan/Silk.NET.Vulkan.Tests/TestChains.cs b/src/Vulkan/Silk.NET.Vulkan.Tests/TestChains.cs index f36a09e58a..1c2b65e8b4 100644 --- a/src/Vulkan/Silk.NET.Vulkan.Tests/TestChains.cs +++ b/src/Vulkan/Silk.NET.Vulkan.Tests/TestChains.cs @@ -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 @@ -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(); diff --git a/src/Vulkan/Silk.NET.Vulkan.Tests/TestChainsAny.cs b/src/Vulkan/Silk.NET.Vulkan.Tests/TestChainsAny.cs index 000299643b..ee9aede5f7 100644 --- a/src/Vulkan/Silk.NET.Vulkan.Tests/TestChainsAny.cs +++ b/src/Vulkan/Silk.NET.Vulkan.Tests/TestChainsAny.cs @@ -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); }