From 16bb7506935be058055769df89398cf43b7a49a2 Mon Sep 17 00:00:00 2001 From: Lukas Kolletzki Date: Wed, 1 May 2024 19:48:32 +0200 Subject: [PATCH] Add build manifest --- .build.yml | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .build.yml diff --git a/.build.yml b/.build.yml new file mode 100644 index 0000000..03fcfe8 --- /dev/null +++ b/.build.yml @@ -0,0 +1,46 @@ +image: archlinux + +sources: +- https://git.sr.ht/~kolletzki/bashcfg + +tasks: +- test_create_default_config: | + cd bashcfg + ./bashcfg.sh + + test -f ~/.config/bashcfg/bashcfg.conf + + default_from_script="$(awk < bashcfg.sh \ + '$0 == "EOF" { in_eof = 0 } + in_eof == 1 { print $0 } + /^DEFAULT_CONFIG=".*EOF/ { in_eof = 1 }')" + test "$(cat < ~/.config/bashcfg/bashcfg.conf)" = "$default_from_script" +- test_process_example_config: | + cd bashcfg + mkdir -p ~/.config/bashcfg + + awk < README.md > ~/.config/bashcfg/bashcfg.conf \ + '$0 == "**`myscript.conf`**" { in_section = 1; next } # Find section + in_section == 0 { next } # Read until section header is found + in_block == 0 && $0 != "```" { next } # Skip all lines in section before code block + in_block == 0 && $0 == "```" { in_block = 1; next } # Code block start + in_block == 1 && $0 != "```" { print $0 } # Print contents of code block + in_block == 1 && $0 == "```" { exit } # Exit with end of code block + ' + + expected_output="$(awk < README.md \ + '$0 == "**output**" { in_section = 1; next } # Find section + in_section == 0 { next } # Read until section is found + in_block == 0 && $0 != "```" { next } # Skip all lines in section before code block + in_block == 0 && $0 == "```" { in_block = 1; next } # Code block start + in_block == 1 && $0 != "```" { print $0 } # Print contents of code block + in_block == 1 && $0 == "```" { exit } # Exit with end of code block + ' | sort)" + + actual_output="$(./bashcfg.sh | sort)" + test "$expected_output" = "$actual_output" + +triggers: +- action: email + condition: failure + to: Lukas Kolletzki -- 2.45.2