aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/workflows/step.go21
-rw-r--r--internal/workflows/test.go22
2 files changed, 26 insertions, 17 deletions
diff --git a/internal/workflows/step.go b/internal/workflows/step.go
index d09e047e..2f283a46 100644
--- a/internal/workflows/step.go
+++ b/internal/workflows/step.go
@@ -5,6 +5,16 @@ package main
// checkout is the standard actions/checkout step.
var checkout = Step{Name: "Checkout", Uses: "actions/checkout@v4"}
+// clone is a simple actions/checkout replacement.
+var clone = Step{
+ Name: "Checkout",
+ Run: "git clone " +
+ "-c advice.detachedHead=0 " +
+ "--rev='${{ github.sha }}' " +
+ "'${{ github.server_url }}/${{ github.repository }}.git' . && " +
+ "git fetch --tags",
+}
+
// newUploadArtifact returns an actions/upload-artifact step uploading
// everything in the result directory as the specified name.
func newUploadArtifact(display, name string) Step {
@@ -21,6 +31,17 @@ func newUploadArtifact(display, name string) Step {
}
}
+// newCIRequest returns a step for requesting a mbf CI task.
+func newCIRequest(display, name, id string) Step {
+ return Step{
+ Name: "Request " + display,
+ ID: id,
+ Run: "export HAKUREI_VERSION=\"$(git describe --dirty)\" && " +
+ "/rosa/bin/mbf ci " + name + " . \"$HAKUREI_VERSION\" && " +
+ "echo \"version=$HAKUREI_VERSION\" >> \"$GITHUB_OUTPUT\"",
+ }
+}
+
// newNixOSTest returns a step for running the named NixOS test.
func newNixOSTest(name string) Step {
return Step{
diff --git a/internal/workflows/test.go b/internal/workflows/test.go
index a6a2abc9..0a3065ea 100644
--- a/internal/workflows/test.go
+++ b/internal/workflows/test.go
@@ -89,26 +89,14 @@ var _ = (&Workflow{
{K: "dist", V: Job{
Name: "Create distribution",
- On: "nix",
+ On: "rosa",
Steps: []Step{
- checkout,
-
- {
- Name: "Build for test",
- ID: "build-test",
- Run: "export HAKUREI_REV=\"$(git rev-parse --short HEAD)\" && " +
- "sed -i.old " +
- "'s/version = /version = \"0.0.0-'$HAKUREI_REV'\"; # version = /' " +
- "test/package.nix && " +
- "nix build --print-out-paths --print-build-logs ./test#dist && " +
- "mv test/{package.nix.old,package.nix} && " +
- "echo \"rev=$HAKUREI_REV\" >> $GITHUB_OUTPUT",
- },
-
+ clone,
+ newCIRequest("distribution", "dist -o result", "dist-test"),
newUploadArtifact(
- "test build",
- "hakurei-${{ steps.build-test.outputs.rev }}",
+ "distribution",
+ "hakurei-${{ steps.dist-test.outputs.version }}",
),
},
}},