From aeb0ac9a329a253baf516be6ecfbdc4a750c6df6 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sat, 3 Oct 2026 15:51:56 +0900 Subject: internal/workflows: cache installed packages This avoids re-downloading packages on every run. Signed-off-by: Ophestra --- internal/workflows/step.go | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'internal/workflows/step.go') 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. -- cgit v1.3.1