2 ms·
I wish people would stop trying to write programs for which there are no interpreters, compilers, or linters: name: Install dependencies run: >
by nanis 5y ago
I wish people would stop trying to write programs for which there are no interpreters, compilers, or linters:
name: Install dependencies
run:
> python -m pip install --upgrade pip
> pip install pytest
> if [ -f 'requirements.txt' ]; then pip install -r requirements.txt; fi
That is a program that is hiding in the bowels of a "nestedtext" document ... It is no better than a program that is hiding in the bowels a JSON or YAML document.
We all have to deal with this, but it is beyond stupid.
[Install Dependencies]
run=/path/to/install-script
Then, write `install-script` in whatever language you want ... verify it works. It should have tests. etc etc etc.
- theamk 5y agoI don't think it matters much if this is inline or in separate file. If you want to test your tests, "yq -r .run input.yaml | sh -e" works as well. In fact, if I really wanted to test my tests, I'd say that directly testing the corresponding clause is the more comprehensive approach. For example, what if someone accidentally changes the line to read: run=/path/to/install-scriptq ? then your test of "install-script" will not catch anything. But if your test runs "yq -r .run | sh -e", then it will catch that error. And you can still forward to a script if you wanted to. So let's keep inline scripts, they are very reasonable methods for just a few commands.
- galkk 5y agoDepending on the source control tool you may lose syntax highlightning, you, most likely, lose linters and even copying those multi-line commands to shell becomes cumbersome. I consider inlining example from GP's comment awful
- kitd 5y agoV minor point: new yq versions use 'e' instead of '-r'.