//go:build workflows package main var _ = (&Workflow{ Name: "Test", On: []any{"push"}, Jobs: Map[Job]{ {K: "hakurei", V: Job{ Name: "Hakurei", On: "nix", Steps: []Step{ { 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: Map[any]{ {K: "name", V: "hakurei-vm-output"}, {K: "path", V: "result/*"}, {K: "retention-days", V: 1}, }, }, }, }}, {K: "race", V: Job{ Name: "Hakurei (race detector)", On: "nix", Steps: []Step{ {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: Map[any]{ {K: "name", V: "hakurei-race-vm-output"}, {K: "path", V: "result/*"}, {K: "retention-days", V: 1}, }, }, }, }}, {K: "sandbox", V: Job{ Name: "Sandbox", On: "nix", Steps: []Step{ {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: Map[any]{ {K: "name", V: "sandbox-vm-output"}, {K: "path", V: "result/*"}, {K: "retention-days", V: 1}, }, }, }, }}, {K: "sandbox-race", V: Job{ Name: "Sandbox (race detector)", On: "nix", Steps: []Step{ {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: Map[any]{ {K: "name", V: "sandbox-race-vm-output"}, {K: "path", V: "result/*"}, {K: "retention-days", V: 1}, }, }, }, }}, {K: "sharefs", V: Job{ Name: "ShareFS", On: "nix", Steps: []Step{ {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: Map[any]{ {K: "name", V: "sharefs-vm-output"}, {K: "path", V: "result/*"}, {K: "retention-days", V: 1}, }, }, }, }}, {K: "check", V: Job{ Name: "Flake checks", On: "nix", Needs: []string{ "hakurei", "race", "sandbox", "sandbox-race", "sharefs", }, Steps: []Step{ { Name: "Checkout", Uses: "actions/checkout@v4", }, { Name: "Run checks", Run: "nix " + "--print-build-logs " + "--experimental-features 'nix-command flakes' " + "flake check ./test", }, }, }}, {K: "dist", V: Job{ Name: "Create distribution", On: "nix", Steps: []Step{ { Name: "Checkout", Uses: "actions/checkout@v4", }, { 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", }, { Name: "Upload test build", Uses: "actions/upload-artifact@v3", With: Map[any]{ {K: "name", V: "hakurei-${{ steps.build-test.outputs.rev }}"}, {K: "path", V: "result/*"}, {K: "retention-days", V: 1}, }, }, }, }}, }, }).mustWriteFile("test")