| 1 | local target = 'x86_64-alpine-linux-musl'; |
| 2 | local build_image = 'localhost/ayllu-build:latest'; |
| 3 | |
| 4 | local binaries = [ |
| 5 | 'ayllu-init', |
| 6 | 'ayllu-build', |
| 7 | 'ayllu-keys', |
| 8 | 'ayllu-migrate', |
| 9 | 'ayllu-web', |
| 10 | 'quipu', |
| 11 | ]; |
| 12 | |
| 13 | local subcommands = [ |
| 14 | 'ayllu-shell-evaluate', |
| 15 | 'ayllu-shell-git-receive-pack', |
| 16 | 'ayllu-shell-git-upload-pack', |
| 17 | ]; |
| 18 | |
| 19 | local compile_binary(name) = { |
| 20 | name: 'Cargo Build ' + name, |
| 21 | input: 'cargo build --release --bin=' + name, |
| 22 | outputs: [ |
| 23 | { |
| 24 | path: 'target/release/' + name, |
| 25 | sha256sum: null, |
| 26 | }, |
| 27 | ], |
| 28 | }; |
| 29 | |
| 30 | local zsh_complete(name) = { |
| 31 | path: 'target/dist/completion/' + '_' + name, |
| 32 | sha256sum: null, |
| 33 | }; |
| 34 | |
| 35 | local bash_complete(name) = { |
| 36 | path: 'target/dist/completion/' + name + '.bash', |
| 37 | sha256sum: null, |
| 38 | }; |
| 39 | |
| 40 | local man_page(name, section) = { |
| 41 | path: 'target/dist/man/' + name + '.' + section, |
| 42 | sha256sum: null, |
| 43 | }; |
| 44 | |
| 45 | local short_step(name, input) = { |
| 46 | name: name, |
| 47 | input: input, |
| 48 | }; |
| 49 | |
| 50 | { |
| 51 | workflows: [ |
| 52 | { |
| 53 | name: 'Lint', |
| 54 | image: build_image, |
| 55 | steps: [short_step('Cargo Lint', 'cargo fmt --check')], |
| 56 | }, |
| 57 | { |
| 58 | name: 'Test', |
| 59 | image: build_image, |
| 60 | depends_on: ['Lint'], |
| 61 | steps: [ |
| 62 | short_step('Cargo Test', 'cargo test'), |
| 63 | short_step('Cargo Clippy', 'cargo clippy'), |
| 64 | ], |
| 65 | }, |
| 66 | { |
| 67 | name: 'Distribution', |
| 68 | depends_on: ['Lint'], |
| 69 | image: build_image, |
| 70 | steps: [ |
| 71 | { |
| 72 | name: 'Man', |
| 73 | input: 'cargo run --package xtask -- gen_man', |
| 74 | outputs: std.flattenArrays([ |
| 75 | [man_page(name, '1') for name in binaries], |
| 76 | [man_page('ayllu', '7')], // Misc ayllu documentation |
| 77 | ]), |
| 78 | }, |
| 79 | { |
| 80 | name: 'Completion', |
| 81 | input: 'cargo run --package xtask -- complete', |
| 82 | outputs: std.flattenArrays([ |
| 83 | [zsh_complete(name) for name in binaries], |
| 84 | [bash_complete(name) for name in binaries], |
| 85 | ]), |
| 86 | }, |
| 87 | ], |
| 88 | }, |
| 89 | { |
| 90 | name: 'Compile Binaries', |
| 91 | depends_on: ['Test', 'Distribution'], |
| 92 | image: build_image, |
| 93 | steps: [ |
| 94 | compile_binary(binary) for binary in binaries |
| 95 | ], |
| 96 | } |
| 97 | ], |
| 98 | } |