aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/workflows
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-10-03 15:51:56 +0900
committerOphestra <cat@gensokyo.uk>2026-10-03 18:00:30 +0900
commitaeb0ac9a329a253baf516be6ecfbdc4a750c6df6 (patch)
tree275f7fd39936dfb65ee56e58163d1a2d816a7c36 /internal/workflows
parent4b19686109b0962ea68dfe58feafffe3bac9c202 (diff)
internal/workflows: cache installed packages
This avoids re-downloading packages on every run. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/workflows')
-rw-r--r--internal/workflows/step.go34
-rw-r--r--internal/workflows/test.go13
2 files changed, 33 insertions, 14 deletions
diff --git a/internal/workflows/step.go b/internal/workflows/step.go
index 219ed78b..83d9c5f3 100644
--- a/internal/workflows/step.go
+++ b/internal/workflows/step.go
@@ -2,6 +2,8 @@
package main
+import "strings"
+
// fixup is a step to work around a Podman regression introduced by a bad
// container escape mitigation.
var fixup = Step{
@@ -55,9 +57,35 @@ func newCIRequest(display, name, id string) Step {
var install = Step{
Name: "Install hakurei",
Run: "HAKUREI_VERSION=\"$(cat cmd/dist/VERSION)-${{ steps.dist.outputs.rev }}\" && " +
- "tar xf \"result/hakurei-$HAKUREI_VERSION-amd64.tar.gz\" && " +
- "\"./hakurei-$HAKUREI_VERSION-amd64/install.sh\" && " +
- "sudo -u ubuntu hakurei version",
+ "tar xf result/hakurei-$HAKUREI_VERSION*-amd64.tar.gz && " +
+ "./hakurei-$HAKUREI_VERSION*-amd64/install.sh && " +
+ "sudo -u ubuntu hakurei version && " +
+ "echo 'Defaults closefrom_override' > " +
+ "/etc/sudoers.d/closefrom_override && " +
+ "mkdir /var/empty",
+}
+
+// newTestsuite returns a step for running an integration test suite.
+func newTestsuite(name, prefix string) Step {
+ return Step{
+ Name: "Compile and run test suite",
+ Run: prefix + "rm -rf result && " +
+ "go run -tags=testsuite ./test/" + name,
+ }
+}
+
+// newPackages returns a job for installing the specified packages with
+// best-effort caching. Package names must not contain spaces.
+func newPackages(rev int, packages ...string) Step {
+ return Step{
+ Name: "Install packages",
+ Uses: "awalsh128/cache-apt-pkgs-action@v1",
+ With: []KV[any]{
+ {"packages", strings.Join(packages, " ")},
+ {"version", rev},
+ {"execute_install_scripts", true},
+ },
+ }
}
// newNixOSTest returns a step for running the named NixOS test.
diff --git a/internal/workflows/test.go b/internal/workflows/test.go
index d3290f16..40e1a076 100644
--- a/internal/workflows/test.go
+++ b/internal/workflows/test.go
@@ -59,11 +59,7 @@ var _ = (&Workflow{
fixup,
checkout,
toolchain,
-
- {
- Name: "install fuse and fs_mark",
- Run: "apt-get update && apt-get install -y fuse3 fsmark",
- },
+ newPackages(0, "fuse3", "fsmark"),
newCIRequest("distribution", "dist -o result", "dist"),
install,
@@ -82,12 +78,7 @@ var _ = (&Workflow{
"setuid=1023,setgid=1023 /sdcard",
},
- {
- Name: "Compile and run test suite",
- Run: "sharefs -V && rm -rf result && " +
- "go run -tags=testsuite ./test/sharefs ubuntu",
- },
-
+ newTestsuite("sharefs", "sharefs -V && "),
newUploadArtifact("test output", "fs_mark"),
},
}},