travis: move script sections to files in .travis/ subject to shellcheck #13863

pull scravy wants to merge 7 commits into bitcoin:master from scravy:travis-extract-scripts changing 10 files +218 −63
  1. scravy commented at 2:00 pm on August 3, 2018: contributor

    This PR is extracted from #13816 to make that one easier to review. It follows on #13849 and #13851

    In here the shell script parts from travis.yml are extracted into .travis/before_install.sh, .travis/install.sh, .travis/before_script.sh, .travis/script.sh, and .travis/lint.sh.

    This has the benefit that test/lint/lint-shell.sh will also shellcheck these parts. Also it makes the individual script parts more readable.

  2. scravy renamed this:
    Travis extract scripts
    travis: move script sections to files in `.travis/` subject to shellcheck
    on Aug 3, 2018
  3. Empact commented at 2:19 pm on August 3, 2018: member
    Concept ACK
  4. practicalswift commented at 2:28 pm on August 3, 2018: contributor

    Concept ACK

    Very good idea!

  5. MarcoFalke commented at 2:37 pm on August 3, 2018: member
    ACK, this way we could also reset old travis pull request runs, since it is less likely that the travis.yml changed in the meantime.
  6. fanquake added the label Tests on Aug 3, 2018
  7. Empact commented at 2:52 pm on August 3, 2018: member
    Could squash d3d19e39111f5a2b7318b8e80a1fbf61f3bb4f99 and d913a4b into 67eee3cc56e6b8014b73c07d8a064b5731a8239e
  8. in .travis/before_install.sh:3 in d913a4bb01 outdated
    0@@ -0,0 +1,25 @@
    1+#!/usr/bin/env bash
    2+#
    3+# Copyright (c) 2017 The Bitcoin Core developers
    


    ken2812221 commented at 3:03 pm on August 3, 2018:
    2018?

    scravy commented at 3:17 pm on August 3, 2018:
    fixed
  9. ken2812221 changes_requested
  10. ken2812221 commented at 3:05 pm on August 3, 2018: contributor
    Concept ACK
  11. scravy force-pushed on Aug 3, 2018
  12. MarcoFalke commented at 3:09 pm on August 3, 2018: member
    I wonder if it helps to prefix the scripts with two digits to clarify the order in which they are run (03_before_install, 04_…) https://docs.travis-ci.com/user/customizing-the-build/#the-build-lifecycle
  13. scravy force-pushed on Aug 3, 2018
  14. scravy commented at 3:18 pm on August 3, 2018: contributor
    @Empact squashed and reordered the commits a bit
  15. scravy commented at 3:29 pm on August 3, 2018: contributor
    @MarcoFalke I’ve changed the names of the files according to your suggestion and added a README with the rationale/link to the travis documentation in d55d49c0f9c672327c4eea87aaa7b0f03381eebb
  16. scravy force-pushed on Aug 3, 2018
  17. scravy commented at 3:36 pm on August 3, 2018: contributor
    Now with the build steps numbered I moved the remaining steps too in a8803bd9e64e6416e6012c22eee849a20a64f633
  18. Empact commented at 3:40 pm on August 3, 2018: member

    Big issue with this PR: Travis - sections check the return code on a per-command basis. The newly sourced files do not, so failures are not detected unless you detect them in the script and propagate them to Travis.

    E.g. see https://travis-ci.org/Empact/bitcoin/jobs/411794591 where I deleted a file to force the test/lint/git-subtree-check.sh src/secp256k1 lint to fail

  19. scravy commented at 4:06 pm on August 3, 2018: contributor
    @Empact great catch, I added set -e before the source step. WDYT?
  20. in .travis.yml:30 in d7ed3452f2 outdated
    26@@ -27,15 +27,15 @@ env:
    27     - WINEDEBUG=fixme-all
    28     - DOCKER_PACKAGES="build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git ca-certificates ccache"
    29 before_install:
    30-  - source .travis/test_03_before_install.sh
    31+  - set -e; source .travis/test_03_before_install.sh
    


    Empact commented at 4:08 pm on August 3, 2018:
    nit: How about set -o errexit as more self-documenting?
  21. scravy force-pushed on Aug 3, 2018
  22. scravy force-pushed on Aug 3, 2018
  23. DrahtBot commented at 4:39 pm on August 3, 2018: member
    • #13954 (lint: Check for common misspellings using codespell. Fix typos reported by codespell. by practicalswift)
    • #13845 (Include tinyformat as a subtree by Empact)
    • #13728 (Scripts and tools: Run the CI lint stage on mac and linux both by Empact)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  24. scravy force-pushed on Aug 6, 2018
  25. scravy force-pushed on Aug 6, 2018
  26. scravy force-pushed on Aug 6, 2018
  27. scravy force-pushed on Aug 6, 2018
  28. scravy force-pushed on Aug 6, 2018
  29. scravy force-pushed on Aug 6, 2018
  30. scravy force-pushed on Aug 6, 2018
  31. scravy force-pushed on Aug 6, 2018
  32. scravy force-pushed on Aug 6, 2018
  33. scravy commented at 6:46 pm on August 6, 2018: contributor

    rebased.

    in between #13859 was merged, I’m now invoking python with LC_ALL=C.UTF_8 in a31bdfcb918469c9d0400a2bd8433fbfddcc411b as it requires that to interpret the emoji correctly. or parse the source file in the first place. Otherwise nothing changed.

  34. in .travis/test_04_install.sh:10 in a31bdfcb91 outdated
     5+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
     6+
     7+export LC_ALL=C
     8+
     9+travis_retry docker pull "$DOCKER_NAME_TAG"
    10+env | grep -E '^(CCACHE_|WINEDEBUG|LC_ALL|BOOST_TEST_RANDOM|CONFIG_SHELL)' | tee /tmp/env
    


    MarcoFalke commented at 6:58 pm on August 6, 2018:
    It is somewhat confusing to set LC_ALL=C.UTF-8 in the travis yaml, then set it to LC_ALL=C here, save it into a file, read that by docker, but then overwrite it again with LC_ALL=C.UTF-8 for the test runner.

    scravy commented at 7:31 pm on August 6, 2018:
    The lint-shell-locale.sh requires scripts to set LC_ALL=C. I could change it to also accept LC_ALL=C.UTF-8.
  35. scravy force-pushed on Aug 6, 2018
  36. scravy force-pushed on Aug 6, 2018
  37. scravy force-pushed on Aug 6, 2018
  38. scravy force-pushed on Aug 6, 2018
  39. scravy commented at 8:25 pm on August 6, 2018: contributor
    @MarcoFalke I’ve changed the scripts to export LC_ALL=C.UTF-8 and allowed that in lint-shell-locale in 50a51061fd04549625dedeed02bdf890548e3506 (rebased, now 54949499c1fdb860a6019d0b213b187e51a0a1b6)
  40. scravy force-pushed on Aug 7, 2018
  41. scravy force-pushed on Aug 7, 2018
  42. scravy force-pushed on Aug 7, 2018
  43. Gnappuraz commented at 1:10 pm on August 7, 2018: contributor
    utACK
  44. scravy force-pushed on Aug 7, 2018
  45. scravy force-pushed on Aug 7, 2018
  46. in test/lint/lint-shell-locale.sh:20 in a8bf3c5a70 outdated
    16@@ -16,7 +17,7 @@ for SHELL_SCRIPT in $(git ls-files -- "*.sh" | grep -vE "src/(secp256k1|univalue
    17         continue
    18     fi
    19     FIRST_NON_COMMENT_LINE=$(grep -vE '^(#.*|)$' "${SHELL_SCRIPT}" | head -1)
    20-    if [[ ${FIRST_NON_COMMENT_LINE} != "export LC_ALL=C" ]]; then
    21+    if [[ ${FIRST_NON_COMMENT_LINE} != "export LC_ALL=C" && ${FIRST_NON_COMMENT_LINE} != "export LC_ALL=C.UTF-8" ]]; then
    


    ken2812221 commented at 7:26 am on August 8, 2018:
    nit: if [[ ! ${FIRST_NON_COMMENT_LINE} =~ "export LC_ALL=C"(|\.UTF-8)$ ]]; then

    practicalswift commented at 7:34 am on August 8, 2018:
    I prefer the current version. It allows for copy and paste.

    scravy commented at 8:43 am on August 8, 2018:

    @ken2812221 @practicalswift

    what about

    0    case "${FIRST_NON_COMMENT_LINE}" in
    1      "export LC_ALL=C");;
    2      "export LC_ALL=C.UTF-8");;
    3      *)
    4        echo "Missing \"export LC_ALL=C\" (to avoid locale dependence) as first non-comment non-empty line in ${SHELL_SCRIPT}"
    5        EXIT_CODE=1
    6    esac
    

    ken2812221 commented at 8:49 am on August 8, 2018:
    LGTM

    scravy commented at 8:55 am on August 8, 2018:
    pushed 336b9ae61511275570bebf4797343f6973c5e9a3

    practicalswift commented at 9:02 am on August 8, 2018:
    @scravy Oh, I think a simple if-statement is much clearer than the suggested case construction. I suggest reverting back to the original version which was perfectly fine and simple :-)

    scravy commented at 9:07 am on August 8, 2018:
    🧐removed the commit again.

    practicalswift commented at 9:17 am on August 8, 2018:
    @scravy Looks good now! Keep it that way :-)
  47. scravy force-pushed on Aug 8, 2018
  48. ken2812221 approved
  49. ken2812221 commented at 4:40 am on August 9, 2018: contributor
    utACK a8bf3c5a70e9924fd967d62a25915b68d2a6b0bc
  50. scravy force-pushed on Aug 9, 2018
  51. scravy force-pushed on Aug 10, 2018
  52. scravy commented at 9:04 am on August 10, 2018: contributor

    About conflicting pull requests:

    • #13845 will be part of 0.18 and won’t be merged soon
    • #13728 is fine and AFAICS ready to go and is perfectly reconcilable with this one (in deed this PR has it’s origin in #13816 which has very much the same spirit - running tests on os x natively)
    • #13515 has untackled review comments and an outstanding requested review

    This one I just rebased.

  53. scravy force-pushed on Aug 15, 2018
  54. scravy force-pushed on Aug 15, 2018
  55. scravy commented at 12:56 pm on August 15, 2018: contributor
    Can this be merged or are there any more remarks/suggestions?
  56. MarcoFalke commented at 1:06 pm on August 15, 2018: member
    @scravy It needs review and testing
  57. scravy commented at 1:30 pm on August 15, 2018: contributor

    @MarcoFalke

    So I was wondering about that. If something touches the travis-definitions only – what is the difference between ACK and utACK here, what could I do to test it? I am rebasing this PR every day and the travis build works splendidly every time (except for this one time where everything in travis failed as it did not at all have any network connectivity).

    Because I do not see what more I could do (as a reviewer) but look at travis whether it worked or not. Possibly I could imagine forking and pushing it in my own github-space and looking at travis for my repo, seeing if I can make it fail in the way it should fail (again, as a reviewer; obviously I did that but I’m the author).

    I’m mostly asking out of curiosity.

  58. MarcoFalke commented at 3:09 pm on August 15, 2018: member
    Travis is completely useless when it passes every time. It must also detect any issues that are present and report them correctly.
  59. scravy commented at 3:30 pm on August 15, 2018: contributor

    Obviously it passes every time because there is no other development happening on this branch, and I’m rebasing against things which passed the CI check before. While reacting to change requests in the discussion in here it very well failed a few times.

    For easier verification would it make sense to link these failing builds?

    Again though, what is a reviewer supposed to do in order to test this? The only thing I can imagine is push it from your own repository to trigger a travis build for that and try to make it break there, right?

  60. practicalswift commented at 3:50 pm on August 15, 2018: contributor
    @scravy Yes, a good start would be your idea to try to cause each script to fail individually and verify that the build fails as expected. For the linting script - introduce a linting violation that should make it fail, etc :-)
  61. DrahtBot added the label Needs rebase on Aug 27, 2018
  62. move script sections info individual files and comply with shellcheck 4f2f88c7b0
  63. abort script in END_FOLD on non-zero exit code 86d34f0e65
  64. move lint stage up to resemble travis build ui
    adjust indentation to 2 spaces
    519e2739cf
  65. number .travis/ script according to build lifecycle and add README to explain 272306ea57
  66. move remaining travis build steps into individual files 506890b24d
  67. make script exit if a command fails 728c82d029
  68. use export LC_ALL=C.UTF-8 414326952c
  69. scravy force-pushed on Aug 27, 2018
  70. DrahtBot removed the label Needs rebase on Aug 27, 2018
  71. scravy commented at 11:41 am on August 27, 2018: contributor
    Rebased.
  72. scravy force-pushed on Aug 27, 2018
  73. scravy force-pushed on Aug 27, 2018
  74. scravy force-pushed on Aug 27, 2018
  75. scravy force-pushed on Aug 27, 2018
  76. scravy commented at 12:27 pm on August 27, 2018: contributor

    In https://github.com/bitcoin/bitcoin/pull/13863/commits/8ad042b4bebbfd2e38bb4cc7ed36bc047aaf09cd I am explicitly breaking the build by introducing an undocumented argument, which is supposed to fail the lint stage.

    Here’s the build failing in the lint stage in my repository: https://travis-ci.org/scravy/bitcoin/jobs/421068804#L575

    Here’s the build failing in the lint stage as a pull request: https://travis-ci.org/bitcoin/bitcoin/jobs/421068842#L580

    Screenshots of the failing build:

  77. scravy commented at 12:47 pm on August 27, 2018: contributor

    In https://github.com/bitcoin/bitcoin/pull/13863/commits/236091eebfa9fb0234b0ff7549ec730e87d5a589 I’m undoing the lint-error such that the lint stage passes again and introduce a compilation error in src/init.cpp to fail the build in the test stage.

    Here’s the build failing in the test stage in my repository: https://travis-ci.org/scravy/bitcoin/builds/421075688 (exact failure: https://travis-ci.org/scravy/bitcoin/jobs/421075692#L2865 )

    Here’s the build failing in the test stage as a pull request: https://travis-ci.org/bitcoin/bitcoin/builds/421075705 (exact failure: https://travis-ci.org/bitcoin/bitcoin/jobs/421075707#L3120 )

  78. scravy commented at 12:57 pm on August 27, 2018: contributor

    In https://github.com/bitcoin/bitcoin/pull/13863/commits/b1ab0435ad245161c3a4906b0fe4a68bd211927a I undo the compile error and introduce a lint violation insisde on of the travis script files (not using LC_ALL=c, violating lint-shell-locale).

    This is how it’s failing in my repository: https://travis-ci.org/scravy/bitcoin/jobs/421082198#L579

    This is how it’s failing as a pull request: https://travis-ci.org/bitcoin/bitcoin/jobs/421082215#L585

  79. MarcoFalke force-pushed on Aug 27, 2018
  80. MarcoFalke merged this on Aug 27, 2018
  81. MarcoFalke closed this on Aug 27, 2018

  82. MarcoFalke referenced this in commit ca4510c15d on Aug 27, 2018
  83. in .travis/test_06_script.sh:47 in 414326952c
    42+
    43+BEGIN_FOLD build
    44+DOCKER_EXEC make $MAKEJOBS $GOAL || ( echo "Build failure. Verbose build follows." && DOCKER_EXEC make $GOAL V=1 ; false )
    45+END_FOLD
    46+
    47+if [ "$RUN_TESTS" = "true" ]; then
    


    MarcoFalke commented at 1:57 pm on August 27, 2018:
    There is no symbol with that name, please adjust
  84. in .travis/test_06_script.sh:63 in 414326952c
    58+
    59+if [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then
    60+  extended="--extended --exclude feature_pruning,feature_dbcrash"
    61+fi
    62+
    63+if [ "$RUN_TESTS" = "true" ]; then
    


    MarcoFalke commented at 1:57 pm on August 27, 2018:
    Same here
  85. scravy commented at 2:11 pm on August 27, 2018: contributor
    @MarcoFalke I see two review comments of yours, yet the PR was merged. You say RUN_TESTS is not exported? Will send a follow-up PR then.
  86. scravy commented at 2:16 pm on August 27, 2018: contributor
  87. MarcoFalke referenced this in commit 794e55be10 on Aug 27, 2018
  88. MarcoFalke referenced this in commit c62b151189 on Dec 3, 2018
  89. zkbot referenced this in commit 43ac2062f9 on Oct 28, 2020
  90. zkbot referenced this in commit 84a5830aaa on Nov 9, 2020
  91. Munkybooty referenced this in commit e1e77958ce on Jun 30, 2021
  92. Munkybooty referenced this in commit d80d16e5d7 on Jun 30, 2021
  93. Munkybooty referenced this in commit 17362b8fd4 on Jul 1, 2021
  94. Munkybooty referenced this in commit 62e2f0060a on Jul 1, 2021
  95. Munkybooty referenced this in commit 7f7aa533fe on Jul 1, 2021
  96. Munkybooty referenced this in commit a3a381b28b on Jul 1, 2021
  97. Munkybooty referenced this in commit 6235905170 on Jul 2, 2021
  98. Munkybooty referenced this in commit a872c78836 on Jul 2, 2021
  99. Munkybooty referenced this in commit 3f75de340a on Jul 2, 2021
  100. Munkybooty referenced this in commit 251ce629e7 on Jul 2, 2021
  101. Munkybooty referenced this in commit 6accd035a9 on Jul 4, 2021
  102. Munkybooty referenced this in commit a33cfb7c92 on Jul 4, 2021
  103. UdjinM6 referenced this in commit 50d8d8023e on Jul 7, 2021
  104. Munkybooty referenced this in commit 60ce84bffe on Jul 7, 2021
  105. Munkybooty referenced this in commit 9d9efce3f4 on Jul 7, 2021
  106. UdjinM6 referenced this in commit 77bbcd9612 on Jul 7, 2021
  107. Munkybooty referenced this in commit 1ba72e6323 on Jul 7, 2021
  108. Munkybooty referenced this in commit 4c2211dd41 on Jul 8, 2021
  109. Munkybooty referenced this in commit 483520e5e6 on Jul 8, 2021
  110. Munkybooty referenced this in commit 8e25e2f0fe on Jul 8, 2021
  111. Munkybooty referenced this in commit f2d7c6e715 on Jul 9, 2021
  112. linuxsh2 referenced this in commit 660394ead1 on Jul 29, 2021
  113. Munkybooty referenced this in commit faab35dc2d on Aug 2, 2021
  114. Munkybooty referenced this in commit 1a6a42cfd6 on Aug 3, 2021
  115. Munkybooty referenced this in commit b489595fc8 on Aug 5, 2021
  116. Munkybooty referenced this in commit 2a9174c4ec on Aug 17, 2021
  117. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-19 00:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me