-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
66 lines (58 loc) · 1.73 KB
/
Taskfile.yml
File metadata and controls
66 lines (58 loc) · 1.73 KB
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
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
vars:
SYSTEMD_PATH: tmp/systemd
env:
PIP: .venv/bin/pip
PYTHON: .venv/bin/python3
tasks:
default:
desc: Compile example HCL and compare with expected output
cmds:
- mkdir -p tmp/test-output
- defer: rm -rf tmp/test-output
- go run . ./example/src/services.hcl ./tmp/test-output
- |
for f in example/transplied/*.service; do
name=$(basename "$f")
diff -u "$f" "tmp/test-output/$name"
done
echo "PASS: all outputs match expected"
clone-or-pull-systemd:
desc: Clone systemd repo if it doesn't exist, otherwise pull latest changes
cmds:
- |
if [ -d "{{.SYSTEMD_PATH}}" ]; then
cd {{.SYSTEMD_PATH}} && git pull
else
git clone https://github.com/systemd/systemd {{.SYSTEMD_PATH}}
fi
gen:
desc: Generate all Go config files from systemd source
deps:
- setup-python
- clone-or-pull-systemd
cmds:
- $PYTHON -m scripts.gen
test-gen:
desc: Verify that scripts/gen produces identical output for the current systemd version
deps:
- clone-or-pull-systemd
cmds:
- mkdir -p tmp/test-gen
- defer: rm -rf tmp/test-gen
- cp configs/systemd.*.go configs/known_units.go tmp/test-gen/
- $PYTHON -m scripts.gen
- |
for f in tmp/test-gen/*.go; do
name=$(basename "$f")
diff -u "tmp/test-gen/$name" "configs/$name"
done
setup-python:
desc: Set up Python venv in .venv and install dependencies
cmds:
- python3 -m venv .venv
- $PIP install --upgrade pip
- $PIP install -r requirements.txt
sources:
- requirements.txt