aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/workflows/step.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-09-30 14:09:09 +0900
committerOphestra <cat@gensokyo.uk>2026-09-30 14:09:09 +0900
commit5cea2de52c53331984df91813556e9944173655e (patch)
treeca6ab14885a506ad349092180949e8abfc38cb43 /internal/workflows/step.go
parentb94e6faa9d20dab9b179ee40b5f749c7f13d3f9a (diff)
internal/workflows: template common stepsstaging
This removes duplicate code and significantly eases maintenance. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/workflows/step.go')
-rw-r--r--internal/workflows/step.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/internal/workflows/step.go b/internal/workflows/step.go
new file mode 100644
index 00000000..d09e047e
--- /dev/null
+++ b/internal/workflows/step.go
@@ -0,0 +1,34 @@
+//go:build workflows
+
+package main
+
+// checkout is the standard actions/checkout step.
+var checkout = Step{Name: "Checkout", Uses: "actions/checkout@v4"}
+
+// newUploadArtifact returns an actions/upload-artifact step uploading
+// everything in the result directory as the specified name.
+func newUploadArtifact(display, name string) Step {
+ return Step{
+ Name: "Upload " + display,
+ Uses: "actions/upload-artifact@v3",
+
+ With: Map[any]{
+ {K: "name", V: name},
+ {K: "path", V: "result/*"},
+
+ {K: "retention-days", V: 1},
+ },
+ }
+}
+
+// newNixOSTest returns a step for running the named NixOS test.
+func newNixOSTest(name string) Step {
+ return Step{
+ Name: "Run NixOS test",
+ Run: "nix build " +
+ "--out-link result " +
+ "--print-out-paths " +
+ "--print-build-logs " +
+ "./test#checks.x86_64-linux." + name,
+ }
+}