ci: build musl only for arm64 and reuse toolchain cache [CI]
This commit is contained in:
1 parent
490b008a57
commit
a6f9759238
22 files changed
+62
-73
No files matched your search
+1
-6
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# 发布一个节点程序:scripts/publish.sh <agent|backend|fleet-enroll> <rid>
|
||||
# 输出到 backend/artifacts/publish/<project>/<rid>/。linux-musl-x64(Alpine)和 linux-x64(Ubuntu noble,glibc)在 NativeAOT SDK 容器里构建(任何主机都可以,包括 Windows),
|
||||
# 输出到 backend/artifacts/publish/<project>/<rid>/。linux-x64(Ubuntu noble,glibc)在 NativeAOT SDK 容器里构建(任何主机都可以,包括 Windows),
|
||||
# 其他 rid 用本机的 dotnet(NativeAOT 不能交叉编译到别的操作系统,所以 win-x64 要在 Windows 上、linux-x64 要在 glibc 的 Linux 上构建)。
|
||||
set -euo pipefail
|
||||
|
||||
@@ -29,11 +29,6 @@ fi
|
||||
args=(publish "$csproj" -c Release -r "$rid" -p:PublishAot=true -p:DebugType=none -p:DebugSymbols=false "${publish_options[@]}" -o "/src/$out" --artifacts-path /artifacts -nologo -v q)
|
||||
|
||||
case "$rid" in
|
||||
linux-musl-x64)
|
||||
# SDK 镜像的版本可以比 global.json 新(rollForward = latestFeature)
|
||||
docker run --rm "${build_env[@]}" -v "$root:/src" -v moshiro-nuget:/root/.nuget -v "moshiro-artifacts-$rid:/artifacts" -w /src \
|
||||
mcr.microsoft.com/dotnet/sdk:10.0-alpine-aot dotnet "${args[@]}"
|
||||
;;
|
||||
linux-x64)
|
||||
docker run --rm "${build_env[@]}" -v "$root:/src" -v moshiro-nuget:/root/.nuget -v "moshiro-artifacts-$rid:/artifacts" -w /src mcr.microsoft.com/dotnet/sdk:10.0-noble-aot dotnet "${args[@]}"
|
||||
;;
|
||||
|
||||
@@ -80,7 +80,7 @@ esac
|
||||
OLD_TIME=str(int(time.time()) - 8 * 86400), RECENT_TIME=str(int(time.time())),
|
||||
CONTAINERS_STORAGE_CONF=str(base / 'moshiro-storage.conf'))
|
||||
subprocess.run(['bash', str(ROOT / 'ci/cleanup-build-cache.sh')], env=env, check=True, capture_output=True)
|
||||
self.assertEqual((base / 'removed').read_text(), 'rmi old\nrmi version\n')
|
||||
self.assertEqual((base / 'removed').read_text(), 'rmi localhost/moshiro-agent-binaries:linux-musl-x64\nrmi old\nrmi version\n')
|
||||
|
||||
def test_export_requires_one_unshare_session_and_cleans_up_on_copy_failure(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
@@ -122,7 +122,7 @@ esac
|
||||
self.assertEqual((base / 'output/moshiro-agent').read_bytes(), b'agent')
|
||||
self.assertEqual((base / 'output/fleet-enroll').read_bytes(), b'enroll')
|
||||
|
||||
def test_four_linux_packages_preserve_installers_and_shared_library_payloads(self):
|
||||
def test_linux_packages_preserve_installers_and_shared_library_payloads(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
base = Path(directory)
|
||||
binaries = base / 'binaries'
|
||||
@@ -130,7 +130,7 @@ esac
|
||||
for name in ('moshiro-agent', 'fleet-enroll', 'libmsquic.so.2'):
|
||||
(binaries / name).write_bytes(name.encode())
|
||||
for rid, suffix in [('linux-x64', 'amd64'), ('linux-arm64', 'arm64'),
|
||||
('linux-musl-x64', 'musl-amd64'), ('linux-musl-arm64', 'musl-arm64')]:
|
||||
('linux-musl-arm64', 'musl-arm64')]:
|
||||
with self.subTest(rid=rid):
|
||||
output = base / rid
|
||||
env = dict(os.environ, CI_COMMIT_TAG='v1.2.3')
|
||||
|
||||
Reference in new issue
Block a user