Skip to content

Commit 3976598

Browse files
committed
Merge branch 'feature/natives-3.0' into feature/windowing-3.0
2 parents 19b3f80 + eccb9a6 commit 3976598

File tree

105 files changed

+4577
-13800
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+4577
-13800
lines changed

.github/workflows/dotnet.yml

Lines changed: 69 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,20 @@ on:
33
push:
44
pull_request:
55
merge_group:
6+
workflow_dispatch:
7+
inputs:
8+
release:
9+
description: "Release to NuGet"
10+
required: false
11+
type: boolean
12+
default: false
613
permissions:
714
statuses: write
815
checks: write
916
contents: write
1017
pull-requests: write
1118
actions: write
19+
packages: write
1220
jobs:
1321
Build:
1422
runs-on: macos-latest
@@ -17,12 +25,31 @@ jobs:
1725
- name: Setup .NET
1826
uses: actions/setup-dotnet@v3
1927
with:
20-
dotnet-version: '8.0.x'
28+
dotnet-version: '9.0.x'
2129
dotnet-quality: 'preview'
22-
- name: Restore
23-
run: dotnet restore
30+
- name: Install Workloads
31+
run: dotnet workload restore
2432
- name: Pack
25-
run: dotnet pack -c Release
33+
# TODO decide whether we want experimental builds to use Debug or Release - using Release for now...
34+
run: >-
35+
dotnet run --project eng/build/Silk.NET.NUKE.csproj -c Release --
36+
Pack
37+
--configuration Release
38+
--msbuild-properties
39+
${{ 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) }}
40+
- name: Upload Unsigned Artifacts to Actions
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: unsigned_nupkgs
44+
path: "artifacts/**/*nupkg"
45+
if-no-files-found: warn
46+
retention-days: 1
47+
- name: Push to Experimental Feed
48+
if: ${{ github.repository == 'dotnet/Silk.NET' }}
49+
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 }}
50+
- name: Push to GitHub Packages
51+
if: ${{ github.repository == 'dotnet/Silk.NET' }}
52+
run: ./build.sh PushToNuGet --skip Clean Compile Pack --nuget-feed https://nuget.pkg.github.com/dotnet/index.json --nuget-api-key ${{ secrets.GITHUB_TOKEN }}
2653
Test:
2754
strategy:
2855
fail-fast: false
@@ -45,6 +72,8 @@ jobs:
4572
with:
4673
dotnet-version: '8.0.x'
4774
dotnet-quality: 'preview'
75+
- name: Install Workloads
76+
run: dotnet workload restore
4877
- name: Restore
4978
run: dotnet restore --runtime ${{ matrix.rid }}
5079
- name: Test
@@ -57,18 +86,19 @@ jobs:
5786
path: ./coverage/**/*.trx
5887
reporter: dotnet-trx
5988
- name: Upload Coverage Results
60-
uses: actions/upload-artifact@v3
89+
uses: actions/upload-artifact@v4
6190
with:
6291
name: coverage-${{ matrix.name }}
6392
path: ./coverage/**/coverage.cobertura.xml
6493
Report-Coverage:
94+
name: "Report Coverage"
6595
runs-on: ubuntu-latest
6696
needs: Test
6797
permissions:
6898
pull-requests: write
6999
checks: write
70100
steps:
71-
- uses: actions/download-artifact@v3
101+
- uses: actions/download-artifact@v4
72102
with:
73103
path: ./coverage
74104
- name: Setup .NET Core
@@ -88,3 +118,36 @@ jobs:
88118
with:
89119
path: coveragereport/Cobertura.xml
90120
minimum_coverage: 0
121+
Release:
122+
runs-on: windows-latest
123+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.release }}
124+
needs: [Build, Test]
125+
environment: Release
126+
steps:
127+
- uses: actions/checkout@v3
128+
with:
129+
ssh-key: ${{ secrets.SILK_ACTIONS_DEPLOY_KEY }}
130+
- uses: actions/download-artifact@v4
131+
with:
132+
name: unsigned_nupkgs
133+
path: artifacts
134+
- name: Push to NuGet
135+
if: ${{ github.repository == 'dotnet/Silk.NET' }}
136+
run: >-
137+
.\build.cmd SignPackages PushToNuGet FinishRelease --skip Clean Compile Pack
138+
--nuget-api-key ${{ secrets.NUGET_TOKEN }}
139+
--akv-certificate ${{ secrets.AKV_CERTIFICATE }}
140+
--akv-client-id ${{ secrets.AKV_CLIENT_ID }}
141+
--akv-client-secret ${{ secrets.AKV_CLIENT_SECRET }}
142+
--akv-tenant ${{ secrets.AKV_TENANT }}
143+
--akv-vault-url ${{ secrets.AKV_VAULT_URL }}
144+
--discord-webhook ${{ secrets.DISCORD_ANNOUNCEMENT_WEBHOOK }}
145+
env:
146+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
147+
- name: Upload Signed Artifacts to Actions
148+
uses: actions/upload-artifact@v4
149+
with:
150+
name: signed_nupkgs
151+
path: "artifacts/**/*nupkg"
152+
if-no-files-found: warn
153+
retention-days: 30

.github/workflows/native.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Native Builds
2+
on:
3+
pull_request:
4+
types: [opened, edited, synchronize]
5+
permissions:
6+
pull-requests: write
7+
contents: write
8+
env:
9+
# A space-separated list of paths to native libraries to build.
10+
NATIVE_LIBRARY_PATHS: "sources/SDL/Native"
11+
# A space-separated list of submodule paths for each native library path. Use _ if a submodule is not used - this must
12+
# match the number of spaces in NATIVE_LIBRARY_PATHS.
13+
NATIVE_LIBRARY_SUBMODULE_PATHS: "eng/submodules/sdl"
14+
# A space-separated list of shorthands to the native library paths that will build the native library for each native
15+
# library path. This must match the number of spaces in NATIVE_LIBRARY_PATHS. If a shorthand builds multiple native
16+
# binary paths, these will be deduplicated.
17+
NATIVE_LIBRARY_SHORTHANDS: "SDL"
18+
jobs:
19+
prerequisites:
20+
name: PR Check
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v3
24+
- id: parse
25+
name: Determine which native libraries the user has asked to build, and where to look for changes.
26+
run: ./workflow-stage1.sh
27+
working-directory: eng/native/buildsystem
28+
env:
29+
PR_COMMENT: ${{ github.event.pull_request.body }}
30+
- uses: dorny/paths-filter@v3
31+
id: filter
32+
name: Determine which natives need to be rebuilt.
33+
with:
34+
filters: ${{ steps.parse.outputs.workflow_filters }}
35+
- name: Find a warning message from a previous run, if applicable.
36+
uses: peter-evans/find-comment@v3
37+
id: fc
38+
with:
39+
issue-number: ${{ github.event.number }}
40+
comment-author: "github-actions[bot]"
41+
body-includes: "Some of the native library builds modified in this PR were not referenced in the PR description."
42+
- id: strat
43+
name: Create the matrix strategy for the native builds.
44+
run: ./workflow-stage2.sh
45+
working-directory: eng/native/buildsystem
46+
env:
47+
NATIVE_LIBRARY_APPLICABLE_SHORTHANDS: ${{ join(fromJSON(steps.filter.outputs.changes), ' ') }}
48+
NATIVE_LIBRARY_USER_REFERENCED_SHORTHANDS: ${{ steps.parse.outputs.targets_referenced }}
49+
PR_EXISTING_NOTICE_ID: ${{ steps.fc.outputs.comment-id }}
50+
- name: Write a comment if needed.
51+
if: ${{ steps.strat.outputs.comment_to_write }}
52+
uses: peter-evans/create-or-update-comment@v4
53+
with:
54+
comment-id: ${{ steps.fc.outputs.comment-id }}
55+
issue-number: ${{ github.event.number }}
56+
body: ${{ steps.strat.outputs.comment_to_write }}
57+
edit-mode: replace
58+
outputs:
59+
matrix_strategy: ${{ steps.strat.outputs.matrix_strategy }}
60+
targets_referenced: ${{ steps.parse.outputs.targets_referenced }}
61+
build:
62+
needs: [prerequisites]
63+
strategy:
64+
matrix:
65+
flat: ${{ fromJSON(needs.prerequisites.outputs.matrix_strategy) }}
66+
runs-on: ${{ (startsWith(matrix.flat.runtime, 'osx') || startsWith(matrix.flat.runtime, 'ios') || startsWith(matrix.flat.runtime, 'tvos')) && 'macos-latest' || startsWith(matrix.flat.runtime, 'win') && 'windows-latest' || 'ubuntu-latest' }}
67+
name: ${{ matrix.flat.target }} / ${{ matrix.flat.runtime }}
68+
steps:
69+
- uses: actions/checkout@v3
70+
- run: |
71+
echo "https://github.com/actions/upload-artifact/issues/174" > .workaround-${{ matrix.flat.target }}-${{ matrix.flat.runtime }}.txt
72+
${{ format('.{0}{1}', startsWith(matrix.flat.runtime, 'win') && '\' || '/', matrix.flat.exec) }}
73+
working-directory: ${{ matrix.flat.dir }}
74+
- uses: actions/upload-artifact@v4
75+
with:
76+
name: natives-${{ matrix.flat.target }}-${{ matrix.flat.runtime }}
77+
path: |
78+
./.workaround-*.txt
79+
./${{ matrix.flat.dir }}/runtimes/${{ format('{0}{1}', matrix.flat.runtime, !contains(matrix.flat.runtime, '-') && '*' || '') }}/**/*
80+
./${{ matrix.flat.dir }}/lib/*${{ matrix.flat.runtime }}*/**/*
81+
./${{ matrix.flat.dir }}/*${{ matrix.flat.runtime }}*/**/*
82+
commit:
83+
name: Commit Binaries
84+
needs: [prerequisites, build]
85+
runs-on: ubuntu-latest
86+
if: ${{ needs.prerequisites.outputs.targets_referenced }}
87+
steps:
88+
- uses: actions/checkout@v4
89+
with:
90+
ref: ${{ github.head_ref }}
91+
- name: Download All Artifacts
92+
uses: actions/download-artifact@v4
93+
with:
94+
pattern: natives-*
95+
merge-multiple: true
96+
- name: Commit Artifacts
97+
run: |
98+
git config --local user.email "9011267+dotnet-bot@users.noreply.github.com"
99+
git config --local user.name "The Silk.NET Automaton"
100+
git add .
101+
git commit -m "Update native binaries for $(git rev-parse HEAD)"
102+
git push

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,3 +484,12 @@ src/**/build/
484484

485485
# Verify
486486
*.received.*
487+
488+
# Native Binaries
489+
!**/runtimes/*/native/*.dylib
490+
!**/runtimes/*/native/*.so
491+
!**/runtimes/*/native/*.dll
492+
!**/lib/**/*.aar
493+
build/
494+
!eng/build/
495+
.workaround*

0 commit comments

Comments
 (0)