internal/rosa/hakurei: dist tarball
All checks were successful
Test / Create distribution (push) Successful in 1m0s
Test / Sandbox (push) Successful in 2m47s
Test / Hakurei (push) Successful in 3m53s
Test / ShareFS (push) Successful in 4m1s
Test / Hpkg (push) Successful in 4m38s
Test / Sandbox (race detector) (push) Successful in 4m59s
Test / Hakurei (race detector) (push) Successful in 5m53s
Test / Flake checks (push) Successful in 1m42s
All checks were successful
Test / Create distribution (push) Successful in 1m0s
Test / Sandbox (push) Successful in 2m47s
Test / Hakurei (push) Successful in 3m53s
Test / ShareFS (push) Successful in 4m1s
Test / Hpkg (push) Successful in 4m38s
Test / Sandbox (race detector) (push) Successful in 4m59s
Test / Hakurei (race detector) (push) Successful in 5m53s
Test / Flake checks (push) Successful in 1m42s
The patch will be removed in the next release. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -41,12 +41,137 @@ chmod -R +w /usr/src/hakurei
|
||||
cd /usr/src/hakurei
|
||||
|
||||
HAKUREI_VERSION='v`+version+`'
|
||||
`+script, pkg.Path(AbsUsrSrc.Append("hakurei"), true, pkg.NewHTTPGetTar(
|
||||
`+script, pkg.Path(AbsUsrSrc.Append("hakurei"), true, t.NewPatchedSource("hakurei", version, pkg.NewHTTPGetTar(
|
||||
nil, "https://git.gensokyo.uk/security/hakurei/archive/"+
|
||||
"v"+version+".tar.gz",
|
||||
mustDecode(checksum),
|
||||
pkg.TarGzip,
|
||||
)), pkg.Path(AbsUsrSrc.Append("hostname", "main.go"), false, pkg.NewFile(
|
||||
), true, [2]string{"dist", `From 67e453f5c4de915de23ecbe5980e595758f0f2fb Mon Sep 17 00:00:00 2001
|
||||
From: Ophestra <cat@gensokyo.uk>
|
||||
Date: Tue, 27 Jan 2026 06:49:48 +0900
|
||||
Subject: [PATCH] dist: run tests
|
||||
|
||||
This used to be impossible due to nix jank which has been addressed.
|
||||
|
||||
Signed-off-by: Ophestra <cat@gensokyo.uk>
|
||||
---
|
||||
dist/release.sh | 21 ++++++++++++++++-----
|
||||
flake.nix | 32 ++++++++++++++++++++------------
|
||||
internal/acl/acl_test.go | 2 +-
|
||||
package.nix | 2 +-
|
||||
4 files changed, 38 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/dist/release.sh b/dist/release.sh
|
||||
index 4dcb278..0ba9104 100755
|
||||
--- a/dist/release.sh
|
||||
+++ b/dist/release.sh
|
||||
@@ -2,19 +2,30 @@
|
||||
cd "$(dirname -- "$0")/.."
|
||||
VERSION="${HAKUREI_VERSION:-untagged}"
|
||||
pname="hakurei-${VERSION}"
|
||||
-out="dist/${pname}"
|
||||
+out="${DESTDIR:-dist}/${pname}"
|
||||
|
||||
+echo '# Preparing distribution files.'
|
||||
mkdir -p "${out}"
|
||||
cp -v "README.md" "dist/hsurc.default" "dist/install.sh" "${out}"
|
||||
cp -rv "dist/comp" "${out}"
|
||||
+echo
|
||||
|
||||
+echo '# Building hakurei.'
|
||||
go generate ./...
|
||||
-go build -trimpath -v -o "${out}/bin/" -ldflags "-s -w -buildid= -extldflags '-static'
|
||||
+go build -trimpath -v -o "${out}/bin/" -ldflags "-s -w
|
||||
+ -buildid= -extldflags '-static'
|
||||
-X hakurei.app/internal/info.buildVersion=${VERSION}
|
||||
-X hakurei.app/internal/info.hakureiPath=/usr/bin/hakurei
|
||||
-X hakurei.app/internal/info.hsuPath=/usr/bin/hsu
|
||||
-X main.hakureiPath=/usr/bin/hakurei" ./...
|
||||
+echo
|
||||
|
||||
-rm -f "./${out}.tar.gz" && tar -C dist -czf "${out}.tar.gz" "${pname}"
|
||||
-rm -rf "./${out}"
|
||||
-(cd dist && sha512sum "${pname}.tar.gz" > "${pname}.tar.gz.sha512")
|
||||
+echo '# Testing hakurei.'
|
||||
+go test -ldflags='-buildid= -extldflags=-static' ./...
|
||||
+echo
|
||||
+
|
||||
+echo '# Creating distribution.'
|
||||
+rm -f "${out}.tar.gz" && tar -C "${out}/.." -vczf "${out}.tar.gz" "${pname}"
|
||||
+rm -rf "${out}"
|
||||
+(cd "${out}/.." && sha512sum "${pname}.tar.gz" > "${pname}.tar.gz.sha512")
|
||||
+echo
|
||||
diff --git a/flake.nix b/flake.nix
|
||||
index 9e09c61..2340b92 100644
|
||||
--- a/flake.nix
|
||||
+++ b/flake.nix
|
||||
@@ -143,19 +143,27 @@
|
||||
"bin/mount.fuse.sharefs" = "${hakurei}/libexec/sharefs";
|
||||
};
|
||||
|
||||
- dist = pkgs.runCommand "${hakurei.name}-dist" { buildInputs = hakurei.targetPkgs ++ [ pkgs.pkgsStatic.musl ]; } ''
|
||||
- # go requires XDG_CACHE_HOME for the build cache
|
||||
- export XDG_CACHE_HOME="$(mktemp -d)"
|
||||
+ dist =
|
||||
+ pkgs.runCommand "${hakurei.name}-dist"
|
||||
+ {
|
||||
+ buildInputs = hakurei.targetPkgs ++ [
|
||||
+ pkgs.pkgsStatic.musl
|
||||
+ ];
|
||||
+ }
|
||||
+ ''
|
||||
+ cd $(mktemp -d) \
|
||||
+ && cp -r ${hakurei.src}/. . \
|
||||
+ && chmod +w cmd && cp -r ${hsu.src}/. cmd/hsu/ \
|
||||
+ && chmod -R +w .
|
||||
|
||||
- # get a different workdir as go does not like /build
|
||||
- cd $(mktemp -d) \
|
||||
- && cp -r ${hakurei.src}/. . \
|
||||
- && chmod +w cmd && cp -r ${hsu.src}/. cmd/hsu/ \
|
||||
- && chmod -R +w .
|
||||
-
|
||||
- export HAKUREI_VERSION="v${hakurei.version}"
|
||||
- CC="clang -O3 -Werror" ./dist/release.sh && mkdir $out && cp -v "dist/hakurei-$HAKUREI_VERSION.tar.gz"* $out
|
||||
- '';
|
||||
+ CC="musl-clang -O3 -Werror -Qunused-arguments" \
|
||||
+ GOCACHE="$(mktemp -d)" \
|
||||
+ HAKUREI_TEST_SKIP_ACL=1 \
|
||||
+ PATH="${pkgs.pkgsStatic.musl.bin}/bin:$PATH" \
|
||||
+ DESTDIR="$out" \
|
||||
+ HAKUREI_VERSION="v${hakurei.version}" \
|
||||
+ ./dist/release.sh
|
||||
+ '';
|
||||
}
|
||||
);
|
||||
|
||||
diff --git a/internal/acl/acl_test.go b/internal/acl/acl_test.go
|
||||
index af6da55..19ce45a 100644
|
||||
--- a/internal/acl/acl_test.go
|
||||
+++ b/internal/acl/acl_test.go
|
||||
@@ -24,7 +24,7 @@ var (
|
||||
)
|
||||
|
||||
func TestUpdate(t *testing.T) {
|
||||
- if os.Getenv("GO_TEST_SKIP_ACL") == "1" {
|
||||
+ if os.Getenv("HAKUREI_TEST_SKIP_ACL") == "1" {
|
||||
t.Skip("acl test skipped")
|
||||
}
|
||||
|
||||
diff --git a/package.nix b/package.nix
|
||||
index 00c4401..2eaa2ec 100644
|
||||
--- a/package.nix
|
||||
+++ b/package.nix
|
||||
@@ -89,7 +89,7 @@ buildGoModule rec {
|
||||
CC = "clang -O3 -Werror";
|
||||
|
||||
# nix build environment does not allow acls
|
||||
- GO_TEST_SKIP_ACL = 1;
|
||||
+ HAKUREI_TEST_SKIP_ACL = 1;
|
||||
};
|
||||
|
||||
buildInputs = [`}),
|
||||
), pkg.Path(AbsUsrSrc.Append("hostname", "main.go"), false, pkg.NewFile(
|
||||
"hostname.go",
|
||||
[]byte(`
|
||||
package main
|
||||
@@ -86,6 +211,12 @@ echo
|
||||
mv \
|
||||
/work/system/libexec/hakurei/{hakurei,sharefs} \
|
||||
/work/system/bin
|
||||
`)
|
||||
}
|
||||
artifactsF[HakureiDist] = func(t Toolchain) pkg.Artifact {
|
||||
return t.newHakurei(`
|
||||
export HAKUREI_VERSION
|
||||
DESTDIR=/work /usr/src/hakurei/dist/release.sh
|
||||
`)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user