aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/workflows/test.go
blob: 6cea78423445a58cec82311c14d3cf8354d9161a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//go:build workflows

package main

var _ = (&Workflow{
	Name: "Test",
	On:   []any{"push"},

	Jobs: Map[Job]{
		{"hakurei-legacy", Job{
			Name: "Hakurei (legacy)",
			On:   "nix",

			Steps: []Step{
				checkout,
				newNixOSTest("hakurei"),
				newUploadArtifact("test output", "hakurei-vm-output"),
			},
		}},

		{"hakurei-race-legacy", Job{
			Name: "Hakurei (legacy with race instrument)",
			On:   "nix",

			Steps: []Step{
				checkout,
				newNixOSTest("race"),
				newUploadArtifact("test output", "hakurei-race-vm-output"),
			},
		}},

		{"sandbox", Job{
			Name: "Sandbox",
			On:   "rosa",

			Needs: []string{"dist"},
			Steps: []Step{
				checkout,
				download,
				install,
				newTestsuite("hakurei/testsuite/sandbox", "unshare -n "),
			},
		}},

		{"sandbox-race", Job{
			Name: "Sandbox (with race instrument)",
			On:   "rosa",

			Needs: []string{"dist-race"},
			Steps: []Step{
				checkout,
				_download,
				install,
				newTestsuite("hakurei/testsuite/sandbox", "unshare -n "),
			},
		}},

		{"sharefs", Job{
			Name: "ShareFS",
			On:   "rosa",

			Needs: []string{"dist"},
			Steps: []Step{
				checkout,
				download,
				install,

				{
					Name: "Mount sharefs",
					Run: "useradd " +
						"-ru 1023 " +
						"-md /var/lib/sdcard " +
						"-k /var/empty " +
						"-s /sbin/nologin " +
						"media_rw && install -dm0 /sdcard && " +
						"sharefs " +
						"-o rw,noexec,nosuid,nodev,noatime," +
						"allow_other,mkdir,source=/var/lib/sdcard," +
						"setuid=1023,setgid=1023 /sdcard",
				},

				newTestsuite("sharefs/testsuite", "sharefs -V && "),
				newUploadArtifact("test output", "fs_mark"),
			},
		}},

		{"dist", Job{
			Name: "Create distribution",
			On:   "rosa",

			Outputs: []KV[string]{
				{"rev", "${{ steps.dist.outputs.rev }}"},
			},

			Steps: []Step{
				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{
				checkout,
				newCIRequest("distribution", "race -o result", "dist"),
				newUploadArtifact(
					"distribution",
					"dist-${{ steps.dist.outputs.rev }}-race",
				),
			},
		}},
	},
}).mustWriteFile("test")