Merge pull request #202035 from veehaitch/github-runner-darwin

github-runner: support Darwin
This commit is contained in:
Domen Kožar 2022-11-20 14:47:07 +00:00 committed by GitHub
commit 9e69c9c351
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 9 deletions

View file

@ -1,4 +1,5 @@
{ autoPatchelfHook
, autoSignDarwinBinariesHook
, coreutils
, curl
, dotnetCorePackages
@ -6,7 +7,6 @@
, fetchFromGitHub
, fetchurl
, git
, glibc
, icu
, libkrb5
, lib
@ -40,6 +40,8 @@ let
runtimeIds = {
"x86_64-linux" = "linux-x64";
"aarch64-linux" = "linux-arm64";
"x86_64-darwin" = "osx-x64";
"aarch64-darwin" = "osx-arm64";
};
runtimeId = runtimeIds.${stdenv.system};
fakeSha1 = "0000000000000000000000000000000000000000";
@ -61,16 +63,20 @@ stdenv.mkDerivation rec {
dotnetSdk
dotnetPackages.Nuget
makeWrapper
] ++ lib.optionals stdenv.isLinux [
autoPatchelfHook
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
autoSignDarwinBinariesHook
];
buildInputs = [
curl # libcurl.so.4
libkrb5 # libgssapi_krb5.so.2
lttng-ust # liblttng-ust.so.0
stdenv.cc.cc.lib # libstdc++.so.6
zlib # libz.so.1
icu
] ++ lib.optionals stdenv.isLinux [
lttng-ust # liblttng-ust.so.0
];
patches = [
@ -104,6 +110,8 @@ stdenv.mkDerivation rec {
--replace '/bin/ln' '${coreutils}/bin/ln'
'';
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT = stdenv.isDarwin;
configurePhase = ''
runHook preConfigure
@ -137,6 +145,8 @@ stdenv.mkDerivation rec {
doCheck = true;
__darwinAllowLocalNetworking = true;
# Fully qualified name of disabled tests
disabledTests =
[ "GitHub.Runner.Common.Tests.Listener.SelfUpdaterL0.TestSelfUpdateAsync" ]
@ -195,6 +205,13 @@ stdenv.mkDerivation rec {
++ lib.optionals (stdenv.hostPlatform.system == "aarch64-linux") [
# "JavaScript Actions in Alpine containers are only supported on x64 Linux runners. Detected Linux Arm64"
"GitHub.Runner.Common.Tests.Worker.StepHostL0.DetermineNodeRuntimeVersionInAlpineContainerAsync"
]
++ lib.optionals DOTNET_SYSTEM_GLOBALIZATION_INVARIANT [
"GitHub.Runner.Common.Tests.ProcessExtensionL0.SuccessReadProcessEnv"
"GitHub.Runner.Common.Tests.Util.StringUtilL0.FormatUsesInvariantCulture"
"GitHub.Runner.Common.Tests.Worker.VariablesL0.Constructor_SetsOrdinalIgnoreCaseComparer"
"GitHub.Runner.Common.Tests.Worker.WorkerL0.DispatchCancellation"
"GitHub.Runner.Common.Tests.Worker.WorkerL0.DispatchRunNewJob"
];
checkInputs = [ git ];
@ -269,7 +286,7 @@ stdenv.mkDerivation rec {
# Stripping breaks the binaries
dontStrip = true;
preFixup = ''
preFixup = lib.optionalString stdenv.isLinux ''
patchelf --replace-needed liblttng-ust.so.0 liblttng-ust.so $out/lib/libcoreclrtraceptprovider.so
'';
@ -277,17 +294,16 @@ stdenv.mkDerivation rec {
fix_rpath() {
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/lib/$1
}
wrap() {
makeWrapper $out/lib/$1 $out/bin/$1 \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath (buildInputs ++ [ openssl ])} \
"''${@:2}"
}
'' + lib.optionalString stdenv.isLinux ''
fix_rpath Runner.Listener
fix_rpath Runner.PluginHost
fix_rpath Runner.Worker
'' + ''
wrap Runner.Listener
wrap Runner.PluginHost
wrap Runner.Worker
@ -296,7 +312,7 @@ stdenv.mkDerivation rec {
wrap config.sh --run 'export RUNNER_ROOT=''${RUNNER_ROOT:-$HOME/.github-runner}' \
--run 'mkdir -p $RUNNER_ROOT' \
--prefix PATH : ${lib.makeBinPath [ glibc.bin ]} \
--prefix PATH : ${lib.makeBinPath [ stdenv.cc ]} \
--chdir $out
'';
@ -308,7 +324,7 @@ stdenv.mkDerivation rec {
# Inspired by passthru.fetch-deps in pkgs/build-support/build-dotnet-module/default.nix
passthru.createDepsFile = writeShellApplication {
name = "create-deps-file";
runtimeInputs = [ dotnetSdk (nuget-to-nix.override { dotnet-sdk = dotnetSdk; }) ];
runtimeInputs = [ coreutils dotnetSdk (nuget-to-nix.override { dotnet-sdk = dotnetSdk; }) ];
text = ''
# Disable telemetry data
export DOTNET_CLI_TELEMETRY_OPTOUT=1

View file

@ -7199,7 +7199,9 @@ with pkgs;
github-backup = callPackage ../tools/misc/github-backup { };
github-runner = callPackage ../development/tools/continuous-integration/github-runner { };
github-runner = callPackage ../development/tools/continuous-integration/github-runner {
inherit (darwin) autoSignDarwinBinariesHook;
};
gitkraken = callPackage ../applications/version-management/gitkraken { };