summaryrefslogtreecommitdiff
path: root/yarns/building.yarn
blob: fd4bdcb2746ccff613139aefa41b6e02a3ec345f (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
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
Morph Building Tests
======================

    SCENARIO building a system morphology
    GIVEN a git server
    WHEN the user clones definitions
    AND the user attempts to build the system systems/test-system.morph in branch master
    THEN morph succeeded
    AND the system artifact for test-system is in the cache
    FINALLY the git server is shut down

    SCENARIO attempting to build a system morphology which has never been committed
    GIVEN a git server
    WHEN the user clones definitions
    AND the user creates an uncommitted system morphology called systems/base-system.morph for our architecture in branch master
    AND the user attempts to build the system systems/base-system.morph in branch master
    THEN morph succeeded
    FINALLY the git server is shut down

    SCENARIO build system with relative path
    GIVEN a git server
    WHEN the user clones definitions
    AND the user creates an uncommitted system morphology called systems/base-system.morph for our architecture in branch master
    AND from the directory definitions/systems the user attempts to morph build the system base-system.morph
    THEN morph succeeded
    FINALLY the git server is shut down

    SCENARIO build system with relative path (second variant)
    GIVEN a git server
    WHEN the user clones definitions
    AND the user creates an uncommitted system morphology called systems/base-system.morph for our architecture in branch master
    AND from the directory definitions/systems the user attempts to morph build the system ../systems/base-system.morph
    THEN morph succeeded
    FINALLY the git server is shut down

    SCENARIO build system with absolute path
    GIVEN a git server
    WHEN the user clones definitions
    AND the user creates an uncommitted system morphology called systems/base-system.morph for our architecture in branch master
    AND from the directory definitions/systems the user attempts to morph build the system using the absolute path to base-system.morph
    THEN morph succeeded
    FINALLY the git server is shut down

    SCENARIO build a chunk with build commands that will fail
    GIVEN a git server
    WHEN the user clones definitions
    AND the user defines build commands for chunk test-chunk that will fail, in branch master
    AND the user attempts to build the system systems/test-system.morph in branch master
    THEN morph failed
    AND the build error message includes the string "build failed (exit_code=1)"
    FINALLY the git server is shut down

    SCENARIO build log is saved when a chunk is built
    GIVEN a git server
    WHEN the user clones definitions
    AND the user attempts to build the system systems/test-system.morph in branch master
    THEN morph succeeded
    AND the build logs for the chunks were saved to the artifact cache
    FINALLY the git server is shut down

    SCENARIO building a chunk containing submodules
    GIVEN a git server
    AND a chunk with submodules
    WHEN the user clones definitions
    AND the user adds the chunk with submodules to an existing stratum in branch master
    AND the user attempts to build the system systems/test-system.morph in branch master
    THEN morph succeeded
    FINALLY the git server is shut down

    SCENARIO building a chunk using a custom prefix
    GIVEN a git server
    WHEN the user clones definitions
    AND the user adds the chunk with custom prefixes to an existing stratum in branch master
    AND the user attempts to build the system systems/test-system.morph in branch master
    THEN morph succeeded
    THEN the build log for chunk xyzzy contains /plover
    THEN the build log for chunk plugh contains /usr
    THEN the build log for chunk plugh contains /plover/bin
    FINALLY the git server is shut down

    SCENARIO modifying chunk causes its stratum to be rebuilt
    GIVEN a git server
    WHEN the user clones definitions
    AND the user attempts to build the system systems/test-system.morph in branch master
    THEN morph succeeded
    WHEN the user changes the build commands for chunk test-chunk in branch master
    AND the user attempts to build the system systems/test-system.morph in branch master
    THEN morph succeeded
    AND there are 2 artifacts named core-runtime in the cache
    FINALLY the git server is shut down

    SCENARIO test recursive sources for a chunk
    GIVEN a git server
    GIVEN a chunk with dependencies
    WHEN the user clones definitions
    WHEN the user attempts to build the system systems/test-system.morph in branch master
    THEN morph succeeded
    FINALLY the git server is shut down

    SCENARIO test recursive sources with non-empty path
    GIVEN a git server
    GIVEN a chunk with recursive sources with non-empty paths
    WHEN the user clones definitions
    WHEN the user attempts to build the system systems/test-system.morph in branch master
    THEN morph failed
    FINALLY the git server is shut down

System integrations
-------------------

`system-integration` is a field in chunk morphologies that allows you to
have some scripts run at system artifact construction time, because some
things need to be done after every chunk is built, such as `ldconfig`,
so every library path in `/etc/ld.so.conf` can be found, and it can look
up libraries more quickly.

    SCENARIO using system integrations
    GIVEN a git server
    WHEN the user clones definitions
    AND the user attempts to build the system systems/test-system.morph in branch master
    THEN morph succeeded

In our example, we have a system integration that creates /etc/passwd,
so when we deploy the system, we can check whether it exists.

    GIVEN a cluster called clusters/test-cluster.morph in branch master
    AND a system in cluster clusters/test-cluster.morph in branch master called test-system
    AND system test-system in cluster clusters/test-cluster.morph in branch master builds systems/test-system.morph
    AND system test-system in cluster clusters/test-cluster.morph in branch master has deployment type: tar
    WHEN the user attempts to deploy the cluster clusters/test-cluster.morph in branch master with options test-system.location="$DATADIR/test.tar"
    THEN morph succeeded
    AND tarball test.tar contains etc/passwd
    FINALLY the git server is shut down

Distbuilding
------------

    SCENARIO distbuilding
    ASSUMING the morph-cache-server can be run
    GIVEN a git server
    AND a communal cache server
    AND a distbuild worker
    AND a distbuild controller

Distbuilding works much the same way as regular building.

    WHEN the user clones definitions
    AND the user creates an uncommitted system morphology called systems/base-system.morph for our architecture in branch master
    THEN morph distbuild the system systems/base-system.morph of the branch master

Distbuilt systems can be deployed locally, since the building process
lets you download the artifacts for local use.

Note: Currently broken. It's currently complaining about not having
repos cached locally.

>   GIVEN a cluster called test-cluster.morph in branch master
>   AND a system in cluster test-cluster.morph in branch master called test-system
>   AND system test-system in cluster test-cluster.morph in branch master builds systems/base-system.morph
>   AND system test-system in cluster test-cluster.morph in branch master has deployment type: sysroot
>   AND system test-system in cluster test-cluster.morph in branch master has deployment location: test-system
>   WHEN the user attempts to deploy the cluster test-cluster.morph in branch master
>   THEN morph succeeded
>   AND file definitions/test-system exists

    FINALLY the distbuild controller is terminated
    AND the distbuild worker is terminated
    AND the communal cache server is terminated
    AND the git server is shut down

Empty strata don't build
------------------------

    SCENARIO empty-strata
    GIVEN a git server
    WHEN the user clones definitions
    AND the user attempts to build the system systems/empty-stratum-system.morph in branch empty-stratum
    THEN morph failed
    FINALLY the git server is shut down

Partial building
----------------

    SCENARIO partial building
    GIVEN a git server
    WHEN the user clones definitions
    AND the user attempts to build build-essential from the system systems/test-system.morph in branch master
    THEN morph succeeded
    FINALLY the git server is shut down