aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/workflows
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-10-07 00:29:47 +0900
committerOphestra <cat@gensokyo.uk>2026-10-07 00:49:55 +0900
commit2f70bd20d13ca699bf61cf2bb37881f029851275 (patch)
tree093d5e5348116d02efb61b6c3280204ca94fb042 /internal/workflows
parenta6334d4ff69ce0c02128256f2032617096882ee5 (diff)
internal/workflows: fetch distribution artifactHEADmasterdevelop
This is cleaner than contacting the cmd/mbf CI service on every run, although also slightly slower in some cases. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/workflows')
-rw-r--r--internal/workflows/main.go2
-rw-r--r--internal/workflows/step.go26
-rw-r--r--internal/workflows/test.go36
3 files changed, 58 insertions, 6 deletions
diff --git a/internal/workflows/main.go b/internal/workflows/main.go
index dca480a5..81b14a12 100644
--- a/internal/workflows/main.go
+++ b/internal/workflows/main.go
@@ -79,6 +79,8 @@ type Job struct {
Needs []string `json:"needs,omitempty"`
// Define the type of machine to run the job on.
On string `json:"runs-on,omitempty"`
+ // Create a map of outputs for a job.
+ Outputs Map[string] `json:"outputs,omitempty"`
// A sequence of tasks.
Steps []Step `json:"steps,omitempty"`
}
diff --git a/internal/workflows/step.go b/internal/workflows/step.go
index 17ca25e1..fc95fd69 100644
--- a/internal/workflows/step.go
+++ b/internal/workflows/step.go
@@ -52,11 +52,35 @@ func newCIRequest(display, name, id string) Step {
}
}
+// download is a step to obtain a hakurei distribution.
+var download = Step{
+ Name: "Download hakurei distribution",
+ ID: "download",
+ Uses: "actions/download-artifact@v3",
+
+ With: []KV[any]{
+ {"name", "dist-${{ needs.dist.outputs.rev }}"},
+ {"path", "result"},
+ },
+}
+
+// _download is like download, but with race instrument.
+var _download = Step{
+ Name: "Download hakurei distribution",
+ ID: "download",
+ Uses: "actions/download-artifact@v3",
+
+ With: []KV[any]{
+ {"name", "dist-${{ needs.dist-race.outputs.rev }}-race"},
+ {"path", "result"},
+ },
+}
+
// install is a step to unpack and deploy a hakurei distribution created by a
// step with identifier dist.
var install = Step{
Name: "Install hakurei",
- Run: "HAKUREI_VERSION=\"$(cat cmd/dist/VERSION)-${{ steps.dist.outputs.rev }}\" && " +
+ Run: "HAKUREI_VERSION=\"$(cat cmd/dist/VERSION)\" && " +
"tar xf result/hakurei-$HAKUREI_VERSION*-amd64.tar.gz && " +
"./hakurei-$HAKUREI_VERSION*-amd64/install.sh && " +
"sudo -u ubuntu hakurei version && " +
diff --git a/internal/workflows/test.go b/internal/workflows/test.go
index 41ed05c5..1f9bba58 100644
--- a/internal/workflows/test.go
+++ b/internal/workflows/test.go
@@ -33,6 +33,7 @@ var _ = (&Workflow{
Name: "Sandbox",
On: "rosa",
+ Needs: []string{"dist"},
Steps: []Step{
fixup,
checkout,
@@ -45,7 +46,7 @@ var _ = (&Workflow{
"pipewire",
),
- newCIRequest("distribution", "dist -o result", "dist"),
+ download,
install,
newTestsuite("hakurei/testsuite/sandbox", ""),
},
@@ -55,6 +56,7 @@ var _ = (&Workflow{
Name: "Sandbox (with race instrument)",
On: "rosa",
+ Needs: []string{"dist-race"},
Steps: []Step{
fixup,
checkout,
@@ -68,7 +70,7 @@ var _ = (&Workflow{
"pipewire",
),
- newCIRequest("distribution", "race -o result", "dist"),
+ _download,
install,
newTestsuite("hakurei/testsuite/sandbox", ""),
},
@@ -78,13 +80,14 @@ var _ = (&Workflow{
Name: "ShareFS",
On: "rosa",
+ Needs: []string{"dist"},
Steps: []Step{
fixup,
checkout,
toolchain,
newPackages(0, nil, "fuse3", "fsmark"),
- newCIRequest("distribution", "dist -o result", "dist"),
+ download,
install,
{
@@ -110,13 +113,36 @@ var _ = (&Workflow{
Name: "Create distribution",
On: "rosa",
+ Outputs: []KV[string]{
+ {"rev", "${{ steps.dist.outputs.rev }}"},
+ },
+
+ Steps: []Step{
+ fixup,
+ checkout,
+ newCIRequest("distribution", "dist -o result", "dist"),
+ newUploadArtifact(
+ "distribution",
+ "dist-${{ steps.dist.outputs.rev }}",
+ ),
+ },
+ }},
+
+ {"dist-race", Job{
+ Name: "Create distribution (with race instrument)",
+ On: "rosa",
+
+ Outputs: []KV[string]{
+ {"rev", "${{ steps.dist.outputs.rev }}"},
+ },
+
Steps: []Step{
fixup,
checkout,
- newCIRequest("distribution", "dist -o result", "dist-test"),
+ newCIRequest("distribution", "race -o result", "dist"),
newUploadArtifact(
"distribution",
- "dist-${{ steps.dist-test.outputs.rev }}",
+ "dist-${{ steps.dist.outputs.rev }}-race",
),
},
}},