Merge rust-bitcoin/rust-bitcoin#2818: CI: Remove shebang from non-executable scripts

60ab3d26e5 CI: Remove shebang from non-executable scripts (Tobin C. Harding)

Pull request description:

  Some of our CI shell scripts are meant only to be sourced and not run directly however they include an initial shebang line, implying that they should be run.

  Remove the shebang line from `crates.sh` and the various `test_vars.sh` scripts. Add a `shellcheck` directive to inhibit the no-shebang warning.

  Please note, the issue mentions the following in the discussion thread and it is _not_ implemented here.

  > It would be good also to find a way to detect whether the script is being run directly, and to print an error message. I'm sure this is a common thing and we can find a stackexchange post telling us how to do it.

  I don't see an immediate way to do this because CI is run using `run_task.sh` which is not in this repo. And since one can still run a script without the shebang (by doing eg, `bash script.sh`) the lack of shebang is only an indicator of how we are using the script.

  Fix: #2764

ACKs for top commit:
  apoelstra:
    ACK 60ab3d26e5

Tree-SHA512: fe829226fb50e88bb84a2bbe324fbf977b7d5abc3637e9b7f8148e74a45a995b526bbe8c7263d903fd03f4563cdf95887433daa76f81faa7cd88d830bf6e0205
This commit is contained in:
Andrew Poelstra 2024-05-31 18:06:11 +00:00
commit 21cd53a1c8
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
8 changed files with 24 additions and 8 deletions

View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash
# No shebang, this file should not be executed.
# shellcheck disable=SC2148
#
# disable verify unused vars, despite the fact that they are used when sourced
# shellcheck disable=SC2034

View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash
# No shebang, this file should not be executed.
# shellcheck disable=SC2148
#
# disable verify unused vars, despite the fact that they are used when sourced
# shellcheck disable=SC2034

4
contrib/crates.sh Executable file → Normal file
View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash
# No shebang, this file should not be executed.
# shellcheck disable=SC2148
#
# disable verify unused vars, despite the fact that they are used when sourced
# shellcheck disable=SC2034

View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash
# No shebang, this file should not be executed.
# shellcheck disable=SC2148
#
#
# Used by labeler.yaml
#

View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash
# No shebang, this file should not be executed.
# shellcheck disable=SC2148
#
# disable verify unused vars, despite the fact that they are used when sourced
# shellcheck disable=SC2034

View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash
# No shebang, this file should not be executed.
# shellcheck disable=SC2148
#
# disable verify unused vars, despite the fact that they are used when sourced
# shellcheck disable=SC2034

View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash
# No shebang, this file should not be executed.
# shellcheck disable=SC2148
#
# disable verify unused vars, despite the fact that they are used when sourced
# shellcheck disable=SC2034

View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash
# No shebang, this file should not be executed.
# shellcheck disable=SC2148
#
# disable verify unused vars, despite the fact that they are used when sourced
# shellcheck disable=SC2034