Skip to content

Commit

Permalink
[3.0] Bring back some of the build infrastructure (#2386)
Browse files Browse the repository at this point in the history
* Bring back some of the build infrastructure

* Add experimental feed to the workflow?

* Revert to non-xlarge for now, we'll need this later though

* Add missing scope for GitHub Packages

* Central Package Management

* Add metapackage, add Release job to workflow, more changes

* Prepare for a release dry run

* Fix bad usage of download-artifact

* Fix artifact usage again and use SSH for push

* Configure SSH key in checkout action instead

* Fix incorrect VersionSuffix, workaround strange NUKE bug

* Normalize markdown for announcement, update changelog for next release

* Fix compilation error

* Fix token-related errors

* Update public API and changelog for next release

* Revert "Update public API and changelog for next release"

This reverts commit c0663f0.

* Confident this is working now

* Document!

* Delete old SignService file

---------

Co-authored-by: The Silk.NET Automaton <[email protected]>
  • Loading branch information
Perksey and dotnet-bot authored Dec 18, 2024
1 parent 800bf83 commit 3f39401
Show file tree
Hide file tree
Showing 48 changed files with 3,341 additions and 13,788 deletions.
71 changes: 65 additions & 6 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@ on:
push:
pull_request:
merge_group:
workflow_dispatch:
inputs:
release:
description: "Release to NuGet"
required: false
type: boolean
default: false
permissions:
statuses: write
checks: write
contents: write
pull-requests: write
actions: write
packages: write
jobs:
Build:
runs-on: macos-latest
Expand All @@ -17,12 +25,29 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'
dotnet-quality: 'preview'
- name: Restore
run: dotnet restore
- name: Pack
run: dotnet pack -c Release
# TODO decide whether we want experimental builds to use Debug or Release - using Release for now...
run: >-
dotnet run --project eng/build/Silk.NET.NUKE.csproj -c Release --
Pack
--configuration Release
--msbuild-properties
${{ github.event_name == 'workflow_dispatch' && inputs.release && 'ContinuousIntegrationBuild=true' || github.event_name != 'pull_request' && format('ContinuousIntegrationBuild=true VersionSuffix=build{0}.0', github.run_number) || format('ContinuousIntegrationBuild=true VersionSuffix=pr{0}.{1}', github.event.number, github.run_number) }}
- name: Upload Unsigned Artifacts to Actions
uses: actions/upload-artifact@v4
with:
name: unsigned_nupkgs
path: "artifacts/**/*nupkg"
if-no-files-found: warn
retention-days: 1
- name: Push to Experimental Feed
if: ${{ github.repository == 'dotnet/Silk.NET' }}
run: ./build.sh PushToNuGet --skip Clean 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' }}
run: ./build.sh PushToNuGet --skip Clean Compile Pack --nuget-feed https://nuget.pkg.github.com/dotnet/index.json --nuget-api-key ${{ secrets.GITHUB_TOKEN }}
Test:
strategy:
fail-fast: false
Expand Down Expand Up @@ -57,18 +82,19 @@ jobs:
path: ./coverage/**/*.trx
reporter: dotnet-trx
- name: Upload Coverage Results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.name }}
path: ./coverage/**/coverage.cobertura.xml
Report-Coverage:
name: "Report Coverage"
runs-on: ubuntu-latest
needs: Test
permissions:
pull-requests: write
checks: write
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
path: ./coverage
- name: Setup .NET Core
Expand All @@ -88,3 +114,36 @@ jobs:
with:
path: coveragereport/Cobertura.xml
minimum_coverage: 0
Release:
runs-on: windows-latest
if: ${{ github.event_name == 'workflow_dispatch' && inputs.release }}
needs: [Build, Test]
environment: Release
steps:
- uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.SILK_ACTIONS_DEPLOY_KEY }}
- uses: actions/download-artifact@v4
with:
name: unsigned_nupkgs
path: artifacts
- name: Push to NuGet
if: ${{ github.repository == 'dotnet/Silk.NET' }}
run: >-
.\build.cmd SignPackages PushToNuGet FinishRelease --skip Clean Compile Pack
--nuget-api-key ${{ secrets.NUGET_TOKEN }}
--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 }}
--discord-webhook ${{ secrets.DISCORD_ANNOUNCEMENT_WEBHOOK }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Signed Artifacts to Actions
uses: actions/upload-artifact@v4
with:
name: signed_nupkgs
path: "artifacts/**/*nupkg"
if-no-files-found: warn
retention-days: 30
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ src/**/build/
*.gen.txt

# Silk.NET Website Generation Output
/docs/
#/docs/
src/Website/Silk.NET.Statiq/temp
src/Website/Silk.NET.Statiq/cache

Expand Down
181 changes: 181 additions & 0 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"Host": {
"type": "string",
"enum": [
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitbucket",
"Bitrise",
"GitHubActions",
"GitLab",
"Jenkins",
"Rider",
"SpaceAutomation",
"TeamCity",
"Terminal",
"TravisCI",
"VisualStudio",
"VSCode"
]
},
"ExecutableTarget": {
"type": "string",
"enum": [
"Clean",
"Compile",
"DeclareApi",
"Pack",
"Prerequisites",
"PushToNuGet",
"RegenerateBindings",
"ShipApi",
"SignPackages"
]
},
"Verbosity": {
"type": "string",
"description": "",
"enum": [
"Verbose",
"Normal",
"Minimal",
"Quiet"
]
},
"NukeBuild": {
"properties": {
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
},
"Help": {
"type": "boolean",
"description": "Shows the help text for this build assembly"
},
"Host": {
"description": "Host for execution. Default is 'automatic'",
"$ref": "#/definitions/Host"
},
"NoLogo": {
"type": "boolean",
"description": "Disables displaying the NUKE logo"
},
"Partition": {
"type": "string",
"description": "Partition to use on CI"
},
"Plan": {
"type": "boolean",
"description": "Shows the execution plan (HTML)"
},
"Profile": {
"type": "array",
"description": "Defines the profiles to load",
"items": {
"type": "string"
}
},
"Root": {
"type": "string",
"description": "Root directory during build execution"
},
"Skip": {
"type": "array",
"description": "List of targets to be skipped. Empty list skips all dependencies",
"items": {
"$ref": "#/definitions/ExecutableTarget"
}
},
"Target": {
"type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'",
"items": {
"$ref": "#/definitions/ExecutableTarget"
}
},
"Verbosity": {
"description": "Logging verbosity during build execution. Default is 'Normal'",
"$ref": "#/definitions/Verbosity"
}
}
}
},
"allOf": [
{
"properties": {
"AkvCertificate": {
"type": "string",
"description": "Code-signing service Azure Key Vault certificate"
},
"AkvClientId": {
"type": "string",
"description": "Code-signing service Azure Key Vault client ID"
},
"AkvClientSecret": {
"type": "string",
"description": "Code-signing service Azure Key Vault client secret"
},
"AkvTenant": {
"type": "string",
"description": "Code-signing service Azure Key Vault tenant ID"
},
"AkvVaultUrl": {
"type": "string",
"description": "Code-signing service Azure Key Vault URL"
},
"Configuration": {
"type": "string",
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
"enum": [
"Debug",
"Release"
]
},
"MsbuildProperties": {
"type": "array",
"description": "Extra properties passed to MSBuild commands",
"items": {
"type": "string"
}
},
"NugetApiKey": {
"type": "string",
"description": "The API key used to push packages and symbols packages to NuGet"
},
"NugetFeed": {
"type": "string",
"description": "NuGet feed"
},
"NugetNoServiceEndpoint": {
"type": "boolean",
"description": "NuGet -NoServiceEndpoint"
},
"NugetPassword": {
"type": "string",
"description": "NuGet password"
},
"NugetUsername": {
"type": "string",
"description": "NuGet username"
},
"SilkTouchAdditionalArgs": {
"type": "array",
"description": "Additional arguments to prepend to SilkTouch invocations",
"items": {
"type": "string"
}
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
}
}
},
{
"$ref": "#/definitions/NukeBuild"
}
]
}
4 changes: 4 additions & 0 deletions .nuke/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "build.schema.json",
"Solution": "Silk.NET.sln"
}
18 changes: 15 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<SignAssembly>true</SignAssembly>
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
Expand All @@ -41,14 +43,12 @@
<Company>.NET Foundation</Company>
<PackageOutputPath>$(BaseArtifactsPath)pkg/$(BaseArtifactsPathSuffix)/$(Configuration)/</PackageOutputPath>
<Product>Silk.NET</Product>
<VersionPrefix>3.0.0</VersionPrefix>
<VersionSuffix>alpha</VersionSuffix>
</PropertyGroup>

<!-- Default settings that are otherwise undefined -->
<PropertyGroup>
<Copyright>Copyright © .NET Foundation and Contributors</Copyright>
<Description>An experimental rewrite of Silk.NET and by extension SilkTouch - this is by no means 3.0 and if that is no longer the case this repo shall be merged with the main Silk.NET repo.</Description>
<Description>Silk.NET is your one-stop-shop for high-speed .NET multimedia, graphics, and compute; providing bindings to popular low-level APIs such as OpenGL, OpenCL, OpenAL, OpenXR, SDL, Vulkan, Assimp, WebGPU, DirectX, and more!</Description>
<Features>strict</Features>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<HighEntropyVA>true</HighEntropyVA>
Expand All @@ -60,6 +60,18 @@
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
<RepositoryType>git</RepositoryType>
<UseSharedCompilation>true</UseSharedCompilation>
<CheckEolWorkloads>false</CheckEolWorkloads>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<VersionDependsOn>SilkShippingControl;$(VersionDependsOn)</VersionDependsOn>
<PackageVersionDependsOn>SilkShippingControl;$(PackageVersionDependsOn)</PackageVersionDependsOn>
</PropertyGroup>

<!-- SourceLink -->
<PropertyGroup Condition="'$(SilkSourceLinkExempt)' == ''">
<DebugType>portable</DebugType>
<EmbedAllSources>true</EmbedAllSources>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
</Project>
Loading

0 comments on commit 3f39401

Please sign in to comment.