Skip to content

Commit 6507b36

Browse files
committed
Build tag
1 parent e7ec554 commit 6507b36

File tree

2 files changed

+288
-2
lines changed

2 files changed

+288
-2
lines changed

.github/workflows/build.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: Build RISC-V runner
22

3-
on: [workflow_dispatch]
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Runner tag'
8+
required: true
9+
type: string
410

511
jobs:
612
build:
@@ -10,7 +16,8 @@ jobs:
1016
- name: Clone repositories
1117
run: |
1218
rm -rf runner
13-
git clone -b dkurt/riscv64_runner_2.321.0 https://github.com/dkurt/runner --depth 1
19+
git clone -b ${{ inputs.version }} https://github.com/actions/runner --depth 1
20+
git apply patches/runner.patch
1421
1522
- name: Download .NET
1623
run: |

patches/runner.patch

Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
1+
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
2+
index 9db5fac..ef1dfd9 100644
3+
--- a/src/Directory.Build.props
4+
+++ b/src/Directory.Build.props
5+
@@ -44,6 +44,9 @@
6+
<PropertyGroup Condition="'$(BUILD_OS)' == 'Linux' AND '$(PackageRuntime)' == 'linux-arm64'">
7+
<DefineConstants>$(DefineConstants);ARM64</DefineConstants>
8+
</PropertyGroup>
9+
+ <PropertyGroup Condition="'$(BUILD_OS)' == 'Linux' AND '$(PackageRuntime)' == 'linux-riscv64'">
10+
+ <DefineConstants>$(DefineConstants);RISCV64</DefineConstants>
11+
+ </PropertyGroup>
12+
13+
<!-- Set TRACE/DEBUG vars -->
14+
<PropertyGroup>
15+
@@ -56,5 +59,6 @@
16+
<!-- Set Treat tarnings as errors -->
17+
<PropertyGroup>
18+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
19+
+ <WarningsNotAsErrors>NU1902;SYSLIB0050;SYSLIB0051;CS0672;NU1903</WarningsNotAsErrors>
20+
</PropertyGroup>
21+
</Project>
22+
diff --git a/src/Misc/externals.sh b/src/Misc/externals.sh
23+
index 2a0db24..2b30115 100755
24+
--- a/src/Misc/externals.sh
25+
+++ b/src/Misc/externals.sh
26+
@@ -3,10 +3,11 @@ PACKAGERUNTIME=$1
27+
PRECACHE=$2
28+
29+
NODE_URL=https://nodejs.org/dist
30+
+UNOFFICIAL_NODE_URL=https://unofficial-builds.nodejs.org/download/release
31+
NODE_ALPINE_URL=https://github.com/actions/alpine_nodejs/releases/download
32+
# When you update Node versions you must also create a new release of alpine_nodejs at that updated version.
33+
# Follow the instructions here: https://github.com/actions/alpine_nodejs?tab=readme-ov-file#getting-started
34+
-NODE20_VERSION="20.18.0"
35+
+NODE20_VERSION="20.18.1"
36+
37+
get_abs_path() {
38+
# exploits the fact that pwd will print abs path when no args
39+
@@ -177,3 +178,7 @@ fi
40+
if [[ "$PACKAGERUNTIME" == "linux-arm" ]]; then
41+
acquireExternalTool "$NODE_URL/v${NODE20_VERSION}/node-v${NODE20_VERSION}-linux-armv7l.tar.gz" node20 fix_nested_dir
42+
fi
43+
+
44+
+if [[ "$PACKAGERUNTIME" == "linux-riscv64" ]]; then
45+
+ acquireExternalTool "$UNOFFICIAL_NODE_URL/v${NODE20_VERSION}/node-v${NODE20_VERSION}-linux-riscv64.tar.gz" node20 fix_nested_dir
46+
+fi
47+
diff --git a/src/NuGet.Config b/src/NuGet.Config
48+
index 95143bd..afc93a3 100644
49+
--- a/src/NuGet.Config
50+
+++ b/src/NuGet.Config
51+
@@ -3,6 +3,7 @@
52+
<packageSources>
53+
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
54+
<clear />
55+
+ <add key='local' value='/home/ubuntu/packages' />
56+
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
57+
</packageSources>
58+
</configuration>
59+
diff --git a/src/Runner.Common/Constants.cs b/src/Runner.Common/Constants.cs
60+
index 2c20d1b..f078d02 100644
61+
--- a/src/Runner.Common/Constants.cs
62+
+++ b/src/Runner.Common/Constants.cs
63+
@@ -58,7 +58,8 @@ namespace GitHub.Runner.Common
64+
X86,
65+
X64,
66+
Arm,
67+
- Arm64
68+
+ Arm64,
69+
+ RiscV64
70+
}
71+
72+
public static class Runner
73+
@@ -81,6 +82,8 @@ namespace GitHub.Runner.Common
74+
public static readonly Architecture PlatformArchitecture = Architecture.Arm;
75+
#elif ARM64
76+
public static readonly Architecture PlatformArchitecture = Architecture.Arm64;
77+
+#elif RISCV64
78+
+ public static readonly Architecture PlatformArchitecture = Architecture.RiscV64;
79+
#else
80+
public static readonly Architecture PlatformArchitecture = Architecture.X64;
81+
#endif
82+
diff --git a/src/Runner.Common/Runner.Common.csproj b/src/Runner.Common/Runner.Common.csproj
83+
index 6c46356..b24bfe1 100644
84+
--- a/src/Runner.Common/Runner.Common.csproj
85+
+++ b/src/Runner.Common/Runner.Common.csproj
86+
@@ -3,7 +3,7 @@
87+
<PropertyGroup>
88+
<TargetFramework>net8.0</TargetFramework>
89+
<OutputType>Library</OutputType>
90+
- <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64</RuntimeIdentifiers>
91+
+ <RuntimeIdentifiers>linux-riscv64</RuntimeIdentifiers>
92+
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
93+
<NoWarn>NU1701;NU1603;SYSLIB0050;SYSLIB0051</NoWarn>
94+
<Version>$(Version)</Version>
95+
diff --git a/src/Runner.Common/Util/VarUtil.cs b/src/Runner.Common/Util/VarUtil.cs
96+
index 97273a1..766015f 100644
97+
--- a/src/Runner.Common/Util/VarUtil.cs
98+
+++ b/src/Runner.Common/Util/VarUtil.cs
99+
@@ -53,6 +53,8 @@ namespace GitHub.Runner.Common.Util
100+
return "ARM";
101+
case Constants.Architecture.Arm64:
102+
return "ARM64";
103+
+ case Constants.Architecture.RiscV64:
104+
+ return "RISCV64";
105+
default:
106+
throw new NotSupportedException(); // Should never reach here.
107+
}
108+
diff --git a/src/Runner.Listener/Runner.Listener.csproj b/src/Runner.Listener/Runner.Listener.csproj
109+
index afd5281..f9e51d3 100644
110+
--- a/src/Runner.Listener/Runner.Listener.csproj
111+
+++ b/src/Runner.Listener/Runner.Listener.csproj
112+
@@ -3,7 +3,7 @@
113+
<PropertyGroup>
114+
<TargetFramework>net8.0</TargetFramework>
115+
<OutputType>Exe</OutputType>
116+
- <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64</RuntimeIdentifiers>
117+
+ <RuntimeIdentifiers>linux-riscv64</RuntimeIdentifiers>
118+
<SelfContained>true</SelfContained>
119+
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
120+
<NoWarn>NU1701;NU1603;SYSLIB0050;SYSLIB0051</NoWarn>
121+
diff --git a/src/Runner.PluginHost/Runner.PluginHost.csproj b/src/Runner.PluginHost/Runner.PluginHost.csproj
122+
index 81a8d2e..c52b7de 100644
123+
--- a/src/Runner.PluginHost/Runner.PluginHost.csproj
124+
+++ b/src/Runner.PluginHost/Runner.PluginHost.csproj
125+
@@ -3,7 +3,7 @@
126+
<PropertyGroup>
127+
<TargetFramework>net8.0</TargetFramework>
128+
<OutputType>Exe</OutputType>
129+
- <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64</RuntimeIdentifiers>
130+
+ <RuntimeIdentifiers>linux-riscv64</RuntimeIdentifiers>
131+
<SelfContained>true</SelfContained>
132+
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
133+
<NoWarn>NU1701;NU1603;SYSLIB0050;SYSLIB0051</NoWarn>
134+
diff --git a/src/Runner.Plugins/Runner.Plugins.csproj b/src/Runner.Plugins/Runner.Plugins.csproj
135+
index a786cf1..2633c64 100644
136+
--- a/src/Runner.Plugins/Runner.Plugins.csproj
137+
+++ b/src/Runner.Plugins/Runner.Plugins.csproj
138+
@@ -3,7 +3,7 @@
139+
<PropertyGroup>
140+
<TargetFramework>net8.0</TargetFramework>
141+
<OutputType>Library</OutputType>
142+
- <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64</RuntimeIdentifiers>
143+
+ <RuntimeIdentifiers>linux-riscv64</RuntimeIdentifiers>
144+
<SelfContained>true</SelfContained>
145+
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
146+
<NoWarn>NU1701;NU1603;SYSLIB0050;SYSLIB0051</NoWarn>
147+
diff --git a/src/Runner.Sdk/Runner.Sdk.csproj b/src/Runner.Sdk/Runner.Sdk.csproj
148+
index 55dbf12..b03b07b 100644
149+
--- a/src/Runner.Sdk/Runner.Sdk.csproj
150+
+++ b/src/Runner.Sdk/Runner.Sdk.csproj
151+
@@ -3,7 +3,7 @@
152+
<PropertyGroup>
153+
<TargetFramework>net8.0</TargetFramework>
154+
<OutputType>Library</OutputType>
155+
- <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64</RuntimeIdentifiers>
156+
+ <RuntimeIdentifiers>linux-riscv64</RuntimeIdentifiers>
157+
<SelfContained>true</SelfContained>
158+
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
159+
<NoWarn>NU1701;NU1603;SYSLIB0050;SYSLIB0051</NoWarn>
160+
diff --git a/src/Runner.Worker/Runner.Worker.csproj b/src/Runner.Worker/Runner.Worker.csproj
161+
index 53c1610..5299ff2 100644
162+
--- a/src/Runner.Worker/Runner.Worker.csproj
163+
+++ b/src/Runner.Worker/Runner.Worker.csproj
164+
@@ -3,7 +3,7 @@
165+
<PropertyGroup>
166+
<TargetFramework>net8.0</TargetFramework>
167+
<OutputType>Exe</OutputType>
168+
- <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64</RuntimeIdentifiers>
169+
+ <RuntimeIdentifiers>linux-riscv64</RuntimeIdentifiers>
170+
<SelfContained>true</SelfContained>
171+
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
172+
<NoWarn>NU1701;NU1603;SYSLIB0050;SYSLIB0051</NoWarn>
173+
diff --git a/src/Sdk/Sdk.csproj b/src/Sdk/Sdk.csproj
174+
index ce7f97c..e24a2df 100644
175+
--- a/src/Sdk/Sdk.csproj
176+
+++ b/src/Sdk/Sdk.csproj
177+
@@ -3,7 +3,7 @@
178+
<PropertyGroup>
179+
<TargetFramework>net8.0</TargetFramework>
180+
<OutputType>Library</OutputType>
181+
- <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64</RuntimeIdentifiers>
182+
+ <RuntimeIdentifiers>linux-riscv64</RuntimeIdentifiers>
183+
<!-- <SelfContained>true</SelfContained> -->
184+
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
185+
<NoWarn>NU1701;NU1603;SYSLIB0050;SYSLIB0051</NoWarn>
186+
diff --git a/src/dev.sh b/src/dev.sh
187+
index 8e23366..f38c507 100755
188+
--- a/src/dev.sh
189+
+++ b/src/dev.sh
190+
@@ -17,7 +17,7 @@ LAYOUT_DIR="$SCRIPT_DIR/../_layout"
191+
DOWNLOAD_DIR="$SCRIPT_DIR/../_downloads/netcore2x"
192+
PACKAGE_DIR="$SCRIPT_DIR/../_package"
193+
DOTNETSDK_ROOT="$SCRIPT_DIR/../_dotnetsdk"
194+
-DOTNETSDK_VERSION="8.0.404"
195+
+DOTNETSDK_VERSION="8.0.101"
196+
DOTNETSDK_INSTALLDIR="$DOTNETSDK_ROOT/$DOTNETSDK_VERSION"
197+
RUNNER_VERSION=$(cat runnerversion)
198+
199+
@@ -54,6 +54,7 @@ elif [[ "$CURRENT_PLATFORM" == 'linux' ]]; then
200+
case $CPU_NAME in
201+
armv7l) RUNTIME_ID="linux-arm";;
202+
aarch64) RUNTIME_ID="linux-arm64";;
203+
+ riscv64) RUNTIME_ID="linux-riscv64";;
204+
esac
205+
fi
206+
elif [[ "$CURRENT_PLATFORM" == 'darwin' ]]; then
207+
@@ -80,7 +81,7 @@ if [[ "$CURRENT_PLATFORM" == 'windows' ]]; then
208+
exit 1
209+
fi
210+
elif [[ "$CURRENT_PLATFORM" == 'linux' ]]; then
211+
- if [[ ("$RUNTIME_ID" != 'linux-x64') && ("$RUNTIME_ID" != 'linux-x86') && ("$RUNTIME_ID" != 'linux-arm64') && ("$RUNTIME_ID" != 'linux-arm') ]]; then
212+
+ if [[ ("$RUNTIME_ID" != 'linux-x64') && ("$RUNTIME_ID" != 'linux-x86') && ("$RUNTIME_ID" != 'linux-arm64') && ("$RUNTIME_ID" != 'linux-arm') && ("$RUNTIME_ID" != 'linux-riscv64') ]]; then
213+
echo "Failed: Can't build $RUNTIME_ID package $CURRENT_PLATFORM" >&2
214+
exit 1
215+
fi
216+
@@ -124,7 +125,7 @@ function heading()
217+
function build ()
218+
{
219+
heading "Building ..."
220+
- dotnet msbuild -t:Build -p:PackageRuntime="${RUNTIME_ID}" -p:BUILDCONFIG="${BUILD_CONFIG}" -p:RunnerVersion="${RUNNER_VERSION}" ./dir.proj || failed build
221+
+ dotnet msbuild -t:Build -p:PackageRuntime="${RUNTIME_ID}" -p:BUILDCONFIG="${BUILD_CONFIG}" -p:RunnerVersion="${RUNNER_VERSION}" ./dir.proj
222+
}
223+
224+
function layout ()
225+
@@ -219,7 +220,8 @@ if [[ (! -d "${DOTNETSDK_INSTALLDIR}") || (! -e "${DOTNETSDK_INSTALLDIR}/.${DOTN
226+
sdkinstallwindow_path=${sdkinstallwindow_path:0:1}:${sdkinstallwindow_path:1}
227+
$POWERSHELL -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "& \"./Misc/dotnet-install.ps1\" -Version ${DOTNETSDK_VERSION} -InstallDir \"${sdkinstallwindow_path}\" -NoPath; exit \$LastExitCode;" || checkRC dotnet-install.ps1
228+
else
229+
- bash ./Misc/dotnet-install.sh --version ${DOTNETSDK_VERSION} --install-dir "${DOTNETSDK_INSTALLDIR}" --no-path || checkRC dotnet-install.sh
230+
+ echo 1
231+
+ # bash ./Misc/dotnet-install.sh --version ${DOTNETSDK_VERSION} --install-dir "${DOTNETSDK_INSTALLDIR}" --no-path || checkRC dotnet-install.sh
232+
fi
233+
234+
echo "${DOTNETSDK_VERSION}" > "${DOTNETSDK_INSTALLDIR}/.${DOTNETSDK_VERSION}"
235+
diff --git a/src/dir.proj b/src/dir.proj
236+
index 056a312..4682cd0 100644
237+
--- a/src/dir.proj
238+
+++ b/src/dir.proj
239+
@@ -2,10 +2,7 @@
240+
<Project ToolsVersion="14.0" DefaultTargets="Build"
241+
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
242+
<Target Name="GenerateConstant">
243+
- <Exec Command="git rev-parse HEAD" ConsoleToMSBuild="true">
244+
- <Output TaskParameter="ConsoleOutput" PropertyName="GitInfoCommitHash" />
245+
- </Exec>
246+
- <Message Text="Building $(Product): $(GitInfoCommitHash) --- $(PackageRuntime)" Importance="high"/>
247+
+ <Message Text="Building $(Product): bcf1c0729358ad80363c79bd41bf5287c34845b61 --- $(PackageRuntime)" Importance="high"/>
248+
249+
<ItemGroup>
250+
<BuildConstants Include="namespace GitHub.Runner.Sdk"/>
251+
@@ -14,7 +11,7 @@
252+
<BuildConstants Include="%20%20%20%20{"/>
253+
<BuildConstants Include="%20%20%20%20%20%20%20%20public static class Source"/>
254+
<BuildConstants Include="%20%20%20%20%20%20%20%20{"/>
255+
- <BuildConstants Include="%20%20%20%20%20%20%20%20%20%20%20%20public static readonly string CommitHash = %22$(GitInfoCommitHash)%22%3B"/>
256+
+ <BuildConstants Include="%20%20%20%20%20%20%20%20%20%20%20%20public static readonly string CommitHash = %22bcf1c0729358ad80363c79bd41bf5287c34845b61%22%3B"/>
257+
<BuildConstants Include="%20%20%20%20%20%20%20%20}%0A"/>
258+
<BuildConstants Include="%20%20%20%20%20%20%20%20public static class RunnerPackage"/>
259+
<BuildConstants Include="%20%20%20%20%20%20%20%20{"/>
260+
@@ -26,8 +23,6 @@
261+
</ItemGroup>
262+
263+
<WriteLinesToFile File="Runner.Sdk/BuildConstants.cs" Lines="@(BuildConstants)" Overwrite="true" />
264+
-
265+
- <Exec Command="git update-index --assume-unchanged ./Runner.Sdk/BuildConstants.cs" ConsoleToMSBuild="true" />
266+
</Target>
267+
268+
<ItemGroup>
269+
diff --git a/src/global.json b/src/global.json
270+
index 8c70738..d54915e 100644
271+
--- a/src/global.json
272+
+++ b/src/global.json
273+
@@ -1,5 +1,5 @@
274+
{
275+
"sdk": {
276+
- "version": "8.0.404"
277+
+ "version": "8.0.101"
278+
}
279+
}

0 commit comments

Comments
 (0)