diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-09-30 16:16:00 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-09-30 16:53:33 +0900 |
| commit | 6fbfb07993b727edd95ac2578e36d8c13523cff2 (patch) | |
| tree | 8b6f71613238975abd6eb74ac15a6f73bf99d316 | |
| parent | 5cea2de52c53331984df91813556e9944173655e (diff) | |
internal/workflows: request dist via cmd/mbfwip-ci
This replaces the nix-based dist step.
Signed-off-by: Ophestra <cat@gensokyo.uk>
| -rw-r--r-- | .gitea/workflows/test.yml | 2 | ||||
| -rw-r--r-- | internal/workflows/step.go | 21 | ||||
| -rw-r--r-- | internal/workflows/test.go | 22 |
3 files changed, 27 insertions, 18 deletions
diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 0c29eb9e..85b54abe 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -1 +1 @@ -{"name":"Test","on":["push"],"jobs":{"hakurei":{"name":"Hakurei","runs-on":"nix","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Run NixOS test","run":"nix build --out-link result --print-out-paths --print-build-logs ./test#checks.x86_64-linux.hakurei"},{"name":"Upload test output","uses":"actions/upload-artifact@v3","with":{"name":"hakurei-vm-output","path":"result/*","retention-days":1}}]},"race":{"name":"Hakurei (race detector)","runs-on":"nix","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Run NixOS test","run":"nix build --out-link result --print-out-paths --print-build-logs ./test#checks.x86_64-linux.race"},{"name":"Upload test output","uses":"actions/upload-artifact@v3","with":{"name":"hakurei-race-vm-output","path":"result/*","retention-days":1}}]},"sandbox":{"name":"Sandbox","runs-on":"nix","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Run NixOS test","run":"nix build --out-link result --print-out-paths --print-build-logs ./test#checks.x86_64-linux.sandbox"},{"name":"Upload test output","uses":"actions/upload-artifact@v3","with":{"name":"sandbox-vm-output","path":"result/*","retention-days":1}}]},"sandbox-race":{"name":"Sandbox (race detector)","runs-on":"nix","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Run NixOS test","run":"nix build --out-link result --print-out-paths --print-build-logs ./test#checks.x86_64-linux.sandbox-race"},{"name":"Upload test output","uses":"actions/upload-artifact@v3","with":{"name":"sandbox-race-vm-output","path":"result/*","retention-days":1}}]},"sharefs":{"name":"ShareFS","runs-on":"nix","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Run NixOS test","run":"nix build --out-link result --print-out-paths --print-build-logs ./test#checks.x86_64-linux.sharefs"},{"name":"Upload test output","uses":"actions/upload-artifact@v3","with":{"name":"sharefs-vm-output","path":"result/*","retention-days":1}}]},"check":{"name":"Flake checks","needs":["hakurei","race","sandbox","sandbox-race","sharefs"],"runs-on":"nix","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Run checks","run":"nix --print-build-logs --experimental-features 'nix-command flakes' flake check ./test"}]},"dist":{"name":"Create distribution","runs-on":"nix","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Build for test","id":"build-test","run":"export HAKUREI_REV=\"$(git rev-parse --short HEAD)\" \u0026\u0026 sed -i.old 's/version = /version = \"0.0.0-'$HAKUREI_REV'\"; # version = /' test/package.nix \u0026\u0026 nix build --print-out-paths --print-build-logs ./test#dist \u0026\u0026 mv test/{package.nix.old,package.nix} \u0026\u0026 echo \"rev=$HAKUREI_REV\" \u003e\u003e $GITHUB_OUTPUT"},{"name":"Upload test build","uses":"actions/upload-artifact@v3","with":{"name":"hakurei-${{ steps.build-test.outputs.rev }}","path":"result/*","retention-days":1}}]}}} +{"name":"Test","on":["push"],"jobs":{"hakurei":{"name":"Hakurei","runs-on":"nix","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Run NixOS test","run":"nix build --out-link result --print-out-paths --print-build-logs ./test#checks.x86_64-linux.hakurei"},{"name":"Upload test output","uses":"actions/upload-artifact@v3","with":{"name":"hakurei-vm-output","path":"result/*","retention-days":1}}]},"race":{"name":"Hakurei (race detector)","runs-on":"nix","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Run NixOS test","run":"nix build --out-link result --print-out-paths --print-build-logs ./test#checks.x86_64-linux.race"},{"name":"Upload test output","uses":"actions/upload-artifact@v3","with":{"name":"hakurei-race-vm-output","path":"result/*","retention-days":1}}]},"sandbox":{"name":"Sandbox","runs-on":"nix","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Run NixOS test","run":"nix build --out-link result --print-out-paths --print-build-logs ./test#checks.x86_64-linux.sandbox"},{"name":"Upload test output","uses":"actions/upload-artifact@v3","with":{"name":"sandbox-vm-output","path":"result/*","retention-days":1}}]},"sandbox-race":{"name":"Sandbox (race detector)","runs-on":"nix","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Run NixOS test","run":"nix build --out-link result --print-out-paths --print-build-logs ./test#checks.x86_64-linux.sandbox-race"},{"name":"Upload test output","uses":"actions/upload-artifact@v3","with":{"name":"sandbox-race-vm-output","path":"result/*","retention-days":1}}]},"sharefs":{"name":"ShareFS","runs-on":"nix","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Run NixOS test","run":"nix build --out-link result --print-out-paths --print-build-logs ./test#checks.x86_64-linux.sharefs"},{"name":"Upload test output","uses":"actions/upload-artifact@v3","with":{"name":"sharefs-vm-output","path":"result/*","retention-days":1}}]},"check":{"name":"Flake checks","needs":["hakurei","race","sandbox","sandbox-race","sharefs"],"runs-on":"nix","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Run checks","run":"nix --print-build-logs --experimental-features 'nix-command flakes' flake check ./test"}]},"dist":{"name":"Create distribution","runs-on":"rosa","steps":[{"name":"Checkout","run":"git clone -c advice.detachedHead=0 --rev='${{ github.sha }}' '${{ github.server_url }}/${{ github.repository }}.git' . \u0026\u0026 git fetch --tags"},{"name":"Request distribution","id":"dist-test","run":"export HAKUREI_VERSION=\"$(git describe --dirty)\" \u0026\u0026 /rosa/bin/mbf ci dist -o result . \"$HAKUREI_VERSION\" \u0026\u0026 echo \"version=$HAKUREI_VERSION\" \u003e\u003e \"$GITHUB_OUTPUT\""},{"name":"Upload distribution","uses":"actions/upload-artifact@v3","with":{"name":"hakurei-${{ steps.dist-test.outputs.version }}","path":"result/*","retention-days":1}}]}}} 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 }}", ), }, }}, |
