~kolletzki/bashcfg

16bb7506935be058055769df89398cf43b7a49a2 — Lukas Kolletzki 4 months ago b1a5e41 main
Add build manifest
1 files changed, 46 insertions(+), 0 deletions(-)

A .build.yml
A .build.yml => .build.yml +46 -0
@@ 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 <mail@lukaskolletzki.com>