Blob .ayllu-build.jsonnet
-rw-r--r-- 1.2 KiB
1local build_image = 'ayllu-arch';
2local cargo_target_dir = '/home/ayllu/cargo-target';
3
4local cargo_cache = {
5 name: 'cargo-cache',
6 path: '/home/ayllu/.cargo/registry',
7};
8
9local build_cache = {
10 name: 'build-cache',
11 path: cargo_target_dir,
12 transient: true,
13};
14
15local short_step(name, input) = {
16 name: name,
17 input: input,
18 environment: {
19 CARGO_TARGET_DIR: cargo_target_dir,
20 },
21};
22
23{
24 workflows: [
25 {
26 name: 'Lint',
27 image: build_image,
28 steps: [
29 short_step('Cargo Lint', 'cargo fmt --check'),
30 ],
31 cache: [cargo_cache, build_cache],
32 },
33 {
34 name: 'Metadata',
35 image: build_image,
36 networking: true,
37 steps: [
38 short_step('Fetch', 'cargo fetch --locked'),
39 short_step('Metadata', 'cargo metadata > metadata.json'),
40 ],
41 cache: [cargo_cache, build_cache],
42 outputs: [{
43 path: 'metadata.json',
44 sha256sum: null,
45 }],
46 depends_on: ['Lint'],
47 },
48 {
49 name: 'Test',
50 image: build_image,
51 steps: [
52 short_step('Cargo Test', 'cargo test --frozen --release'),
53 ],
54 cache: [cargo_cache, build_cache],
55 depends_on: ['Lint', 'Metadata'],
56 },
57 ],
58}