-
Notifications
You must be signed in to change notification settings - Fork 33
/
Taskfile.yml
150 lines (133 loc) · 3.75 KB
/
Taskfile.yml
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
version: '3'
# Set to false to see all commands being run
silent: true
# See https://taskfile.dev/#/usage?id=output-syntax
output: prefixed
# Set our target variable by reading TARGET
# Not great but at least works reliably
env:
__TARGET:
sh: grep -v '#' TARGET
vars:
CPUS:
sh: echo $(($(grep -c processor /proc/cpuinfo) / 2))
dotenv: ['platform/{{.__TARGET}}/config.env', 'kernel.env']
# Include all nested Taskfiles here
includes:
platform: taskfiles/Platform.yml
core: taskfiles/Core.yml
proto: taskfiles/Proto.yml
config: taskfiles/Config.yml
image: taskfiles/Image.yml
initramfs: taskfiles/Initramfs.yml
devtree: taskfiles/Devtree.yml
kernel: taskfiles/Linux.yml
kmod: taskfiles/Module.yml
tests: taskfiles/Tests.yml
ovmf: taskfiles/Ovmf.yml
docs: taskfiles/Docs.yml
qemu: taskfiles/Qemu.yml
# Declaration of all available tasks.
# This file only contains tasks that are meant
# to be called directly by the user.
# To check the Taskfile boilerplate look into
# the folder taskfiles.
tasks:
# Build a u-bmc image for the selected target in TARGET
build:
desc: Build a u-bmc image for a selected platform
cmds:
- echo "Building u-bmc image for $__TARGET"
- mkdir -p build
- task: platform:build-{{.__TARGET}}
- echo "Done!"
# Remove compiled files
clean:
desc: Cleans up compiled files
cmds:
- echo "Wiping build artifacts..."
- rm -rf build/boot
- rm -rf build/kmod
- rm -rf build/linux/zImage.*
- rm -rf build/root
- rm -rf build/*img
- rm -rf build/rootfs
- rm -f build/u-bmc
- echo "Done!"
# Removes the whole build folder
purge:
desc: Cleans up compiled and downloaded files
cmds:
- echo "Wiping the whole build directory and config files!"
- rm -rf build/
- rm -f config/acme.go
- rm -f config/version.go
- rm -f config/sim_pebble.go
- rm -f config/sim-pebble.crt
- rm -f config/sim-pebble.key
- rm -f config/ssh_keys.go
- rm -f config/ssh_keys.pub
- rm -f i_agree_to_the_acme_terms
- rm -f TARGET
- echo "Done!"
# Invoke protogen
protogen:
desc: Regenerate gRPC definitons using protobuf-gen-go
cmds:
- echo "Regenerating gRPC definitions"
- task: proto:protogen
- echo "Done!"
# Run pebble
pebble:
desc: Runs LetsEncrypt Pebble to simulate a CA
deps:
- config:generate
cmds:
- echo "Starting pebble server..."
- |
go run github.com/letsencrypt/pebble/cmd/pebble \
-dnsserver 127.0.0.1:6053 \
-config config/sim-pebble.json
- echo "Stopped pebble server"
# Invoke all tests
test:
desc: Run all tests
cmds:
- echo "Running all unit tests..."
- task: tests:all
- echo "Done!"
# Invoke coverage tests
coverage:
desc: Run all tests with coverage
cmds:
- echo "Running tests with coverage..."
- task: tests:coverage
- echo "Done!"
# Invoke race detector
race:
desc: Run race condition tests
cmds:
- echo "Running race condition detector..."
- task: tests:race
- echo "Done!"
# Invoke integration tests
integration:
desc: Run integration tests
cmds:
- echo "Running integration tests..."
- task: tests:integration
- echo "Done!"
# Compile OVMF and run qemu-x86
virtual-host:
desc: Launch Qemu with OVMF to simulate a host for the BMC
cmds:
- echo "Launching Qemu to simulate a host..."
- task: qemu:host
- echo "Stopped virtual host"
# Run BMC qemu
virtual-bmc:
desc: Launch Qemu to simulate a BMC
cmds:
- echo "Running u-bmc simulator in Qemu..."
- task: qemu:bmc-{{.CLI_ARGS}}
- echo "Finished the u-bmc simulator"