Skip to content

Commit 7fd4781

Browse files
committed
Add GitHub Actions workflow for NuGet release
1 parent 2ec9764 commit 7fd4781

File tree

5 files changed

+285
-6
lines changed

5 files changed

+285
-6
lines changed

.github/workflows/nuget.yml

Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
name: NuGet Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- 2.6.x
8+
workflow_dispatch: {}
9+
10+
concurrency:
11+
group: nuget-${{github.ref}}
12+
cancel-in-progress: true
13+
14+
env:
15+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
16+
17+
jobs:
18+
windows:
19+
name: Windows VS2022
20+
runs-on: windows-2022
21+
22+
steps:
23+
- name: Checkout CSFML
24+
uses: actions/checkout@v4
25+
with:
26+
path: CSFML
27+
28+
- name: Build x86
29+
shell: pwsh
30+
run: |
31+
cd CSFML/tools/nuget
32+
./build.win.ps1 "win-x86"
33+
34+
- name: Build x64
35+
shell: pwsh
36+
run: |
37+
cd CSFML/tools/nuget
38+
./build.win.ps1 "win-x64"
39+
40+
- name: Upload Artifact
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: CSFML-win-x86-x64
44+
path: CSFML/tools/nuget/CSFML/runtimes
45+
46+
linux-x64:
47+
name: Linux x64
48+
runs-on: ubuntu-22.04
49+
container:
50+
image: ubuntu:22.04
51+
52+
steps:
53+
- name: Checkout CSFML
54+
uses: actions/checkout@v4
55+
with:
56+
path: CSFML
57+
58+
- name: Build
59+
shell: bash
60+
run: |
61+
cd ./CSFML/tools/nuget
62+
chmod +x ./docker.linux-x64.sh
63+
./docker.linux-x64.sh
64+
65+
- name: Upload Artifact
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: CSFML-linux-x64
69+
path: CSFML/tools/nuget/CSFML/runtimes
70+
71+
linux-arm:
72+
name: Linux ARM
73+
runs-on: ubuntu-22.04
74+
75+
steps:
76+
- name: Checkout CSFML
77+
uses: actions/checkout@v4
78+
with:
79+
path: CSFML
80+
81+
- name: Build in an ARM container
82+
uses: uraimo/[email protected]
83+
with:
84+
arch: armv7
85+
distro: ubuntu22.04
86+
githubToken: ${{ github.token }}
87+
dockerRunArgs: |
88+
--volume "${PWD}/CSFML:/CSFML"
89+
install: |
90+
apt-get update -y
91+
apt-get install -y git libfreetype6-dev xorg-dev libxrandr-dev libxcursor-dev libudev-dev libgl1-mesa-dev libflac-dev libogg-dev libvorbis-dev libopenal-dev cmake g++
92+
run: |
93+
cd /CSFML/tools/nuget
94+
chmod +x ./build.linux.sh
95+
./build.linux.sh linux-arm
96+
97+
- name: Upload Artifact
98+
uses: actions/upload-artifact@v4
99+
with:
100+
name: CSFML-linux-arm
101+
path: CSFML/tools/nuget/CSFML/runtimes
102+
103+
linux-arm64:
104+
name: Linux ARM64
105+
runs-on: ubuntu-22.04
106+
107+
steps:
108+
- name: Checkout CSFML
109+
uses: actions/checkout@v4
110+
with:
111+
path: CSFML
112+
113+
- name: Build in an ARM64 container
114+
uses: uraimo/[email protected]
115+
with:
116+
arch: aarch64
117+
distro: ubuntu22.04
118+
githubToken: ${{ github.token }}
119+
dockerRunArgs: |
120+
--volume "${PWD}/CSFML:/CSFML"
121+
install: |
122+
apt-get update -y
123+
apt-get install -y git libfreetype6-dev xorg-dev libxrandr-dev libxcursor-dev libudev-dev libgl1-mesa-dev libflac-dev libogg-dev libvorbis-dev libopenal-dev cmake g++
124+
run: |
125+
cd /CSFML/tools/nuget
126+
chmod +x ./build.linux.sh
127+
./build.linux.sh linux-arm64
128+
129+
- name: Upload Artifact
130+
uses: actions/upload-artifact@v4
131+
with:
132+
name: CSFML-linux-arm64
133+
path: CSFML/tools/nuget/CSFML/runtimes
134+
135+
linux-musl-x64:
136+
name: Linux MUSL x64
137+
runs-on: ubuntu-22.04
138+
container:
139+
image: alpine:3.15
140+
141+
steps:
142+
- name: Checkout CSFML
143+
uses: actions/checkout@v4
144+
with:
145+
path: CSFML
146+
147+
- name: Build
148+
shell: sh
149+
run: |
150+
cd ./CSFML/tools/nuget
151+
chmod +x ./docker.linux-musl-x64.sh
152+
./docker.linux-musl-x64.sh
153+
154+
- name: Upload Artifact
155+
uses: actions/upload-artifact@v4
156+
with:
157+
name: CSFML-linux-musl-x64
158+
path: CSFML/tools/nuget/CSFML/runtimes
159+
160+
fedora-x64:
161+
name: Fedora x64
162+
runs-on: ubuntu-22.04
163+
container:
164+
image: fedora:37
165+
166+
steps:
167+
- name: Checkout CSFML
168+
uses: actions/checkout@v4
169+
with:
170+
path: CSFML
171+
172+
- name: Build
173+
shell: bash
174+
run: |
175+
cd ./CSFML/tools/nuget
176+
chmod +x ./docker.fedora-x64.sh
177+
./docker.fedora-x64.sh
178+
179+
- name: Upload Artifact
180+
uses: actions/upload-artifact@v4
181+
with:
182+
name: CSFML-fedora-x64
183+
path: CSFML/tools/nuget/CSFML/runtimes
184+
185+
macos:
186+
name: macOS
187+
runs-on: macos-14
188+
189+
steps:
190+
- name: Checkout CSFML
191+
uses: actions/checkout@v4
192+
with:
193+
path: CSFML
194+
195+
- name: Install necessary tooling
196+
run: brew install coreutils
197+
198+
- name: Build x64
199+
run: |
200+
cd CSFML/tools/nuget
201+
./build.macos.sh "osx-x64"
202+
203+
- name: Build ARM64
204+
run: |
205+
cd CSFML/tools/nuget
206+
./build.macos.sh "osx-arm64"
207+
208+
- name: Upload Artifact
209+
uses: actions/upload-artifact@v4
210+
with:
211+
name: CSFML-macOS-x64-arm64
212+
path: CSFML/tools/nuget/CSFML/runtimes
213+
214+
package:
215+
name: Package Builds
216+
runs-on: ubuntu-22.04
217+
needs:
218+
- windows
219+
- linux-x64
220+
- linux-arm
221+
- linux-arm64
222+
- linux-musl-x64
223+
- fedora-x64
224+
- macos
225+
steps:
226+
- name: Checkout CSFML
227+
uses: actions/checkout@v4
228+
with:
229+
path: CSFML
230+
- name: Download Artifacts
231+
uses: actions/download-artifact@v4
232+
with:
233+
path: CSFML/tools/nuget/CSFML/runtimes
234+
merge-multiple: true
235+
- name: Setup .NET 8 SDK
236+
id: setup-dotnet
237+
uses: actions/setup-dotnet@v4
238+
with:
239+
dotnet-version: 8.0.x
240+
- name: Enforce SDK Version
241+
run: dotnet new globaljson --sdk-version ${{ steps.setup-dotnet.outputs.dotnet-version }} --force
242+
- name: Verify SDK Installation
243+
run: dotnet --info
244+
- name: Build NuGet Package
245+
run: |
246+
cd CSFML/tools/nuget
247+
dotnet build --configuration Release --verbosity detailed
248+
- name: Upload NuGet Package
249+
uses: actions/upload-artifact@v4
250+
with:
251+
name: CSFML-NuGet-Package
252+
path: CSFML/tools/nuget/CSFML/bin/Release/*.nupkg

tools/nuget/build.docker.sh

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ set -e
55

66
if [[ -z "$1" ]]; then
77
echo 'No Runtime Identifier specified, running all known RIDs'
8-
./build.docker.sh "alpine-x64"
9-
./build.docker.sh "debian-x64"
10-
./build.docker.sh "fedora-x64"
8+
./build.docker.sh "linux-x64"
9+
./build.docker.sh "linux-musl-x64"
10+
./build.docker.sh "linux-arm"
11+
./build.docker.sh "linux-arm64"
1112
exit 0
1213
fi
1314

@@ -30,6 +31,26 @@ case "$RID" in
3031
Shell='/bin/bash'
3132
;;
3233

34+
'linux-x64')
35+
Image='ubuntu:22.04'
36+
Shell='/bin/bash'
37+
;;
38+
39+
'linux-musl-x64')
40+
Image='alpine:3.15'
41+
Shell='/bin/sh'
42+
;;
43+
44+
'linux-arm')
45+
Image='arm32v7/ubuntu:22.04'
46+
Shell='/bin/bash'
47+
;;
48+
49+
'linux-arm64')
50+
Image='arm64v8/ubuntu:22.04'
51+
Shell='/bin/bash'
52+
;;
53+
3354
*)
3455
echo "Unknown Runtime Identifier $RID"
3556
exit 1

tools/nuget/build.linux.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ echo "Please note that all SFML dependencies must be installed and available to
4343
RID="$1"
4444

4545
SFMLBranch="2.6.1" # The branch or tag of the SFML repository to be cloned
46-
CSFMLDir="$(realpath "$(git rev-parse --show-toplevel)")" # The directory of the source code of CSFML
46+
CSFMLDir="$(realpath ../../)" # The directory of the source code of CSFML
4747

4848
OutDir="./CSFML/runtimes/$RID/native" # The base directory of all CSFML modules, used to copy the final libraries
4949
mkdir -p "$OutDir"
@@ -93,6 +93,7 @@ cmake -E env LDFLAGS="-z origin" \
9393
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$SFMLLibDir" \
9494
'-DCMAKE_BUILD_WITH_INSTALL_RPATH=1' \
9595
'-DCMAKE_INSTALL_RPATH=$ORIGIN' \
96+
'-DSFML_BUILD_NETWORK=0' \
9697
"$SFMLDir"
9798

9899
cmake --build . --config Release
@@ -118,6 +119,7 @@ cmake -E env LDFLAGS="-z origin" \
118119
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$CSFMLLibDir" \
119120
'-DCMAKE_BUILD_WITH_INSTALL_RPATH=1' \
120121
'-DCMAKE_INSTALL_RPATH=$ORIGIN' \
122+
'-DCSFML_BUILD_NETWORK=0' \
121123
"$CSFMLDir"
122124
cmake --build . --config Release
123125

tools/nuget/build.macos.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ cmake -E env \
113113
-D "CMAKE_INSTALL_PREFIX=$SFMLLibDir" \
114114
-D "SFML_DEPENDENCIES_INSTALL_PREFIX=$SFMLLibDir" \
115115
-D "SFML_MISC_INSTALL_PREFIX=$SFMLLibDir" \
116+
-D "SFML_BUILD_NETWORK=0" \
116117
"$SFMLDir"
117118

118119
cmake --build . --config Release --target install
@@ -141,6 +142,7 @@ cmake -E env \
141142
-D 'CMAKE_INSTALL_RPATH=@loader_path' \
142143
-D "CMAKE_INSTALL_PREFIX=$CSFMLLibDir" \
143144
-D "INSTALL_MISC_DIR=$CSFMLLibDir" \
145+
-D "CSFML_BUILD_NETWORK=0" \
144146
"$CSFMLDir"
145147
cmake --build . --config Release --target install
146148

@@ -211,7 +213,7 @@ copymodule graphics
211213
copymodule system
212214
copymodule window
213215

214-
cp -R "$SFMLLibDir/"*.framework "$OutDir"
216+
cp -R "$SFMLLibDir/lib/"*.framework "$OutDir"
215217

216218
popd # Pop CSFML
217219
popd # Pop $RID

tools/nuget/build.win.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Ensures that the last command run was a success, checking its exit code.
4848
#>
4949
function Ensure-Success() {
5050
if ($LastExitCode -ne 0) {
51-
exit
51+
exit -1
5252
}
5353
}
5454

@@ -119,6 +119,7 @@ cmake `
119119
'-DCMAKE_BUILD_TYPE=Release' `
120120
'-DCMAKE_SYSTEM_VERSION=8.1' `
121121
'-DSFML_USE_STATIC_STD_LIBS=1' `
122+
'-DSFML_BUILD_NETWORK=0' `
122123
"-G$Generator" `
123124
"-A$Architecture" `
124125
$SFMLDir
@@ -158,6 +159,7 @@ cmake `
158159
`
159160
"-DBUILD_SHARED_LIBS=1" `
160161
'-DCMAKE_BUILD_TYPE=Release' `
162+
'-DCSFML_BUILD_NETWORK=0' `
161163
`
162164
"-G$generator" `
163165
"-A$Architecture" `

0 commit comments

Comments
 (0)