-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate tasks in make-release.sh
to CI actions
#216
Comments
Instead of making a complex Bash script (or many Bash scripts to run together), we can use Python: it's still a scripting language, but has the benefit of scaling better (we can always break a script in functions, then modules, and eventually a tiny package, while bash stops at functions). Moreover, we have more expertise in Python than Bash, and definitely more than Perl: Line 89 in 2c5fee4
(just to prove that Bash alone is not sufficient, and for semver there are existing packages https://github.com/python-semver/python-semver to simplify the code).
I'd also suggest collecting in a single folder the utility scripts we're using. So, not only |
I don't particularly like this idea because if we do that we suddenly end up with with a huge dependency chain that breaks on some computers because pip is too old and takes very long to run. I'm also not convinced the Python scripts will be shorter. My point is: Python isn't a panacea. It has its uses when BASH scripts become more complicated, but I don't we've reached that point yet. |
So, you can decide that you don't want to add And I also agree that Python is not a panacea. It is just Bash that is bad. Bash is optimal to work with files, for as long as your scripts are 5 lines long, and not much more. After a certain threshold, you see all its limits, since it is designed to be good as a shell (i.e. interactive mode), rather than a programming language. One example: it definitely encourages old-style imperative programming, with near-zero modularity and string manipulation everywhere, instead of function calls (not by chance Python and JS are transitioning to types, since they are useful to maintain scripts as well). Moreover, Bash is a further "language" people should know to contribute. It is very well-known at basic level, i.e. using commands and pipes, but when you come to |
I disagree with the premise that Bash is bad, I think it's often a very good choice because the scripts a very succinct. But when it comes to the choice of scripting languages I admit that I'm partial to Bash. There have been many times where I solved a problem with it extremely quickly and efficiently for which other languages would probably have been a worse choice. I say that because I think Bash isn't really much of a language on its own but rather a way to combine many languages together:
I agree that I definitely have a much larger threshold 😄, which I admit isn't entirely good.
I really don't care about that when writing Bash scripts, they're supposed to solve a problem, so anything that works is fine. However, you could argue argue that using pipes is very similar to functional programming, which is considered 'modern' these days.
Bash is one further language, that's true, but so is any other language that would replace it. We're using many programming languages in PineAPPL: Bash, C, C++, Fortran, Python and Rust, and they're all unavoidable, including Bash which is used inside the CI. For instance the I'd argue that one should treat Bash like any other language, and https://tldp.org/LDP/abs/html/ is a good place to learn it properly. But many things can be learned on-the-fly, like the difference between single- and double-brackets. However, often I find this difference to be completely irrelevant. As for the extension, stackoverflow seems to agree that But that all being said: look at my original comment, where I argue basically the same point as you are arguing: |
So, the statement "Bash is bad" without any context is for sure false, as it would be for any other language or tool (I'm sure even Cobol might have its own perfect applications...).
I care about every single line of code that is going to survive, since it will have to be understood and maintained. E.g. the following: pineappl/.github/workflows/rust.yml Lines 53 to 69 in ef97872
it is clearly much better as a for loop, and this one:pineappl/.github/workflows/rust.yml Lines 84 to 88 in ef97872
would be much clearer splitting the list of folders on their own, and giving them a telling name. Pipes are not necessarily functional-like, but they usually are, and there is a good reason why people now care about functional: especially in UI there were a lot of people happily manipulating things in a single global scope (that is exactly what JS was about), but then it was a mess for debugging, since the state was incredibly hard to reproduce for complex applications.
True that PineAPPL is mainly Rust, and I'd not script in Rust...
This can be limited arbitrarily, invoking external scripts (that is usually what you do in Bash, and you do want a simple CI workflow, not the ideal place to define complex tasks).
Bash is good at manipulating files, but it is not the only good one. Python has been used for system scripting since long, but definitely it also keeps improving. |
However, getting more to the point: Python pros:
All the Bash pros:
I'd add one more candidate: JS (Node) pros:
The JS proposal is only interesting if you are positive about automating the task and delegate to GitHub (and we solve the problem about the not uniform environment and very old computers). If you prefer to do it manually, better to avoid (but I doubt, since the script is even automatically pushing and releasing). |
The publish commands have been move into the newly-added workflow |
The container has been changed in commit 8cf40df. |
The script
make-release.sh
has become quite complicated and we should simplify it by breaking it up into smaller tasks, some of which can be CI actions:cargo publish
section can be a CI action similar to our Python wheels action. For thisThe text was updated successfully, but these errors were encountered: