Travis: run full test suite on native macOS #16597

pull Sjors wants to merge 1 commits into bitcoin:master from Sjors:2019/08/travis-macos changing 6 files +109 −18
  1. Sjors commented at 5:36 pm on August 13, 2019: member

    Adds an additional Travis machine to run the functional test suite on native macOS

    Homebrew is not particularly Travis compatible, but I found some useful hints here: https://discourse.brew.sh/t/best-practice-for-homebrew-on-travis-brew-update-is-5min-to-build-time/5215/11

  2. Sjors force-pushed on Aug 13, 2019
  3. Sjors force-pushed on Aug 13, 2019
  4. Sjors force-pushed on Aug 13, 2019
  5. Sjors force-pushed on Aug 13, 2019
  6. fanquake added the label Tests on Aug 13, 2019
  7. Sjors renamed this:
    Travis: run full test suite on native macOS
    [WIP] Travis: run full test suite on native macOS
    on Aug 13, 2019
  8. Sjors marked this as ready for review on Aug 13, 2019
  9. Sjors force-pushed on Aug 13, 2019
  10. Sjors force-pushed on Aug 13, 2019
  11. Sjors force-pushed on Aug 13, 2019
  12. Sjors force-pushed on Aug 13, 2019
  13. Sjors force-pushed on Aug 13, 2019
  14. Sjors force-pushed on Aug 13, 2019
  15. Sjors force-pushed on Aug 13, 2019
  16. DrahtBot commented at 10:11 pm on August 13, 2019: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #12134 (Build previous releases and run functional tests by Sjors)

    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.

  17. emilengler commented at 11:17 pm on August 13, 2019: contributor
    Are there travis tests which can proof it? Like your fork? But I generally like this idea as the current situation with tuxes on the side is a bit confusing
  18. in .travis.yml:240 in 4f602ce5a0 outdated
    235+    osx_image: xcode11
    236+    language:
    237+      - ruby
    238+      - python
    239+    python:
    240+        - "3.6.5"
    


    fanquake commented at 3:45 am on August 14, 2019:
    Should this be 3.5.6 to match our minimum supported Python?
  19. fanquake commented at 3:46 am on August 14, 2019: member
    Concept ACK. Will take a look at the base PR first.
  20. Sjors force-pushed on Aug 14, 2019
  21. Sjors force-pushed on Aug 14, 2019
  22. Sjors force-pushed on Aug 14, 2019
  23. Sjors commented at 8:21 am on August 14, 2019: member
    Travis is ignoring this PR and my branch atm.
  24. emilengler commented at 5:58 pm on August 14, 2019: contributor
    Can you enable travis for your forked repository?
  25. Sjors commented at 10:45 am on August 15, 2019: member
    @emilengler I tried that, but it wasn’t building there either. I’ll wait until the previous PR is merged and then try again.
  26. emilengler commented at 2:43 pm on August 15, 2019: contributor
    @Sjors Ok I will fork your repository, then remove it from the parent and try to enable travis then
  27. DrahtBot added the label Needs rebase on Aug 15, 2019
  28. emilengler commented at 3:34 pm on August 15, 2019: contributor
    @Sjors Doesn’t work, take a look https://travis-ci.org/emilengler/bitcoin-sjors-test/requests. I also forked your repo here as a playgroud, I also invited you for commit access, will delete it once it is done.
  29. Sjors force-pushed on Sep 16, 2019
  30. DrahtBot removed the label Needs rebase on Sep 16, 2019
  31. DrahtBot added the label Needs rebase on Sep 18, 2019
  32. Sjors force-pushed on Oct 9, 2019
  33. in ci/test/00_setup_env_mac.sh:11 in cadea5db43 outdated
     6@@ -7,7 +7,7 @@
     7 export LC_ALL=C.UTF-8
     8 
     9 export HOST=x86_64-apple-darwin14
    10-export PACKAGES="cmake imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools python3-dev python3-setuptools"
    11+export BREW_PACKAGES="automake berkeley-db4 libtool boost miniupnpc openssl pkg-config protobuf qt qrencode librsvg pyenv"
    


    MarcoFalke commented at 7:02 pm on October 9, 2019:
    why is this changed?

    Sjors commented at 7:21 pm on October 9, 2019:
    By accident. Fixed. This PR is still very rough; I can pick it up again now that #13728 is merged.
  34. in ci/test/04_install.sh:8 in cadea5db43 outdated
    3@@ -4,6 +4,11 @@
    4 # Distributed under the MIT software license, see the accompanying
    5 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
    6 
    7+if [ "$TRAVIS_OS_NAME" == "osx" ]; then
    8+    travis_retry brew install $BREW_PACKAGES
    


    MarcoFalke commented at 7:03 pm on October 9, 2019:
    0    ${CI_RETRY_EXE} brew install $PACKAGES
    
  35. MarcoFalke commented at 7:03 pm on October 9, 2019: member
    Concept ACK
  36. Sjors force-pushed on Oct 9, 2019
  37. Sjors force-pushed on Oct 9, 2019
  38. Sjors force-pushed on Oct 9, 2019
  39. DrahtBot removed the label Needs rebase on Oct 9, 2019
  40. in ci/test/04_install.sh:34 in 38aa9d402a outdated
     3@@ -4,6 +4,11 @@
     4 # Distributed under the MIT software license, see the accompanying
     5 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
     6 
     7+if [ "$TRAVIS_OS_NAME" == "osx" ]; then
     8+    ${CI_RETRY_EXE} brew install $BREW_PACKAGES
     9+    return 0
    10+ fi
    11+
    


    MarcoFalke commented at 7:19 pm on October 10, 2019:
    should move this below the LC_ALL line
  41. in .travis.yml:169 in 38aa9d402a outdated
    164+    - stage: test
    165+      name: 'macOS 10.14 native'
    166+      os: osx
    167+      # Use the most recent version:
    168+      # Xcode 11, macOS 10.14, JDK 12.0.1
    169+      # https://docs.travis-ci.com/user/reference/osx/#OS-X-Version
    


    MarcoFalke commented at 8:46 pm on October 10, 2019:
    0      # https://docs.travis-ci.com/user/reference/osx/#macos-version
    
  42. in .travis.yml:174 in 38aa9d402a outdated
    172+        - ruby
    173+        - python
    174+      python:
    175+        - "3.5.6"
    176+      rvm:
    177+        - 2.6.0
    


    MarcoFalke commented at 8:48 pm on October 10, 2019:

    This config doesn’t boot (even after waiting an hour)

    Maybe you need to install python via brew upgrade python?


    Sjors commented at 11:24 am on October 11, 2019:
    Trying with pyenv install 3.5.6

    Sjors commented at 11:57 am on October 11, 2019:
    That doesn’t seem to boot either.

    MarcoFalke commented at 12:32 pm on October 11, 2019:

    In def61133e18a4487af1c9406ffa3f6bf19b702fd I removed both of these and it fails with:

    https://travis-ci.org/bitcoin/bitcoin/jobs/596568166


    MarcoFalke commented at 1:29 pm on October 11, 2019:
     0Warning: automake 1.16.1_1 is already installed and up-to-date
     1
     2To reinstall 1.16.1_1, run `brew reinstall automake`
     3
     4Warning: berkeley-db@4 4.8.30 is already installed and up-to-date
     5
     6To reinstall 4.8.30, run `brew reinstall berkeley-db@4`
     7
     8Warning: libtool 2.4.6_1 is already installed and up-to-date
     9
    10To reinstall 2.4.6_1, run `brew reinstall libtool`
    11
    12Warning: boost 1.71.0 is already installed and up-to-date
    13
    14To reinstall 1.71.0, run `brew reinstall boost`
    15
    16Warning: miniupnpc 2.1 is already installed and up-to-date
    17
    18To reinstall 2.1, run `brew reinstall miniupnpc`
    19
    20Warning: openssl 1.0.2t is already installed and up-to-date
    21
    22To reinstall 1.0.2t, run `brew reinstall openssl`
    23
    24Warning: pkg-config 0.29.2 is already installed and up-to-date
    25
    26To reinstall 0.29.2, run `brew reinstall pkg-config`
    27
    28Warning: qt 5.13.1 is already installed and up-to-date
    29
    30To reinstall 5.13.1, run `brew reinstall qt`
    31
    32Warning: qrencode 4.0.2 is already installed and up-to-date
    33
    34To reinstall 4.0.2, run `brew reinstall qrencode`
    35
    36Warning: librsvg 2.46.1 is already installed and up-to-date
    37
    38To reinstall 2.46.1, run `brew reinstall librsvg`
    39
    40Warning: pyenv 1.2.13_1 is already installed and up-to-date
    41
    42To reinstall 1.2.13_1, run `brew reinstall pyenv`
    43
    44Error: protobuf 3.9.1_1 is already installed
    45
    46To upgrade to 3.10.0, run `brew upgrade protobuf`.
    47
    48The command "brew install automake berkeley-db4 libtool boost miniupnpc openssl pkg-config protobuf qt qrencode librsvg pyenv" failed. Retrying, 3 of 3.
    


    Sjors commented at 8:47 am on October 13, 2019:
    @vadi2 @keneanung let me know if you prefer not to be mentioned as co-authored-by in the commit.

    Sjors commented at 8:48 am on October 13, 2019:
    (assuming we ever get this to work :-)

    vadi2 commented at 9:08 am on October 13, 2019:
    It’s fine! Let us know if we can help you out with this.

    keneanung commented at 5:48 pm on October 13, 2019:
    I’m good with this as well. As Vadim said, let us know if we can be of help.

    Sjors commented at 8:19 pm on October 13, 2019:
    Thanks! I could use some help with update 7 below.

    keneanung commented at 11:30 pm on October 14, 2019:
    Hm. I’m unsure whether we had this error… And since we don’t use this deep caching anymore, we don’t have any further experience in this dark corner of homebrew :ghost:
  43. Sjors force-pushed on Oct 11, 2019
  44. Sjors force-pushed on Oct 13, 2019
  45. Sjors force-pushed on Oct 13, 2019
  46. Sjors force-pushed on Oct 13, 2019
  47. Sjors force-pushed on Oct 13, 2019
  48. Sjors force-pushed on Oct 13, 2019
  49. Sjors force-pushed on Oct 13, 2019
  50. Sjors force-pushed on Oct 13, 2019
  51. Sjors force-pushed on Oct 13, 2019
  52. Sjors force-pushed on Oct 13, 2019
  53. Sjors force-pushed on Oct 13, 2019
  54. Sjors force-pushed on Oct 13, 2019
  55. Sjors force-pushed on Oct 13, 2019
  56. Sjors force-pushed on Oct 13, 2019
  57. Sjors force-pushed on Oct 13, 2019
  58. Sjors commented at 11:50 am on October 13, 2019: member

    5ea77cd56d failed at travis_fold:end:autogen without any error. I added a check for OSX in order to run ./autogen.sh without DOCKER_EXEC; who knows…

    Update: no luck, trying some other things. Apparently sometimes set -o errexit can cause Travis to exit before the log is updated with the last error.

    Update2: it couldn’t find OpenSSL. Continuing on a PR-less branch to avoid overloading Travis.

    Update3: Travis macOS comes with OpenSSL 1.1 preinstalled via Homebrew. I removed openssl from the BREW_PACKAGES list, and added the appropriate PKG_CONFIG_PATH.

    Update4: Got all the way to make deploy, but the Apple script just hangs. Switching goal to install. Caching homebrew and PyEnv seems to work, and save a lot of time.

    Update5: There is something weird about the configure step that cause Travis to rage quit without information. I put set +o errexit around those places. Also, the output of make distdir doesn’t look very healthy, though I get the same on my local machine, despite exit status 0. (fatal: current working directory is untracked).

    Update6: It wasn’t ./configure. It looks like this pattern is the culprit: cd build || (echo "could not enter build directory"; exit 1). Afaik this is redundant because all scripts are already called with set -o errexit; source. But removing the check doesn’t help. Instead, I just wrapped it in set +o errexit. Clearly cd build is working, so I have no idea why Travis bails on that line.

    Update 7: got all the way through the functional test suite. The code that tries to prune brew cache doesn’t seem to behave, see error: find: -delete: /usr/local/Homebrew: relative path potentially not safe. I commented the line out to preserve my own sanity :-)

  59. Sjors force-pushed on Oct 13, 2019
  60. Sjors force-pushed on Oct 13, 2019
  61. Sjors force-pushed on Oct 13, 2019
  62. Sjors force-pushed on Oct 13, 2019
  63. in ci/test/00_setup_env_mac_functional.sh:10 in c2e4c57642 outdated
     5+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
     6+
     7+export LC_ALL=C.UTF-8
     8+
     9+export HOST=x86_64-apple-darwin14
    10+export BREW_PACKAGES="automake berkeley-db4 libtool boost miniupnpc openssl pkg-config protobuf qt qrencode librsvg pyenv ccache"
    


    fanquake commented at 1:40 pm on October 13, 2019:
    No reason to install protobuf if we’re not enabling BIP70.

    Sjors commented at 2:25 pm on October 13, 2019:
    Dropped (in other branch, will push later)

    luke-jr commented at 4:42 pm on October 13, 2019:
    If we’re building/testing only once natively, we should enable everything…

    Sjors commented at 8:21 pm on October 13, 2019:
    I added it back and enabled BIP70 in the build.
  64. in ci/test/00_setup_env_mac_functional.sh:8 in c2e4c57642 outdated
    0@@ -0,0 +1,15 @@
    1+#!/usr/bin/env bash
    2+#
    3+# Copyright (c) 2019 The Bitcoin Core developers
    4+# Distributed under the MIT software license, see the accompanying
    5+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
    6+
    7+export LC_ALL=C.UTF-8
    8+
    


    fanquake commented at 1:57 pm on October 13, 2019:
    Even thought it’ll be unused, could add NO_DEPENDS=1 here to make it clear that we aren’t actually using depends.
  65. Sjors force-pushed on Oct 13, 2019
  66. Sjors renamed this:
    [WIP] Travis: run full test suite on native macOS
    Travis: run full test suite on native macOS
    on Oct 13, 2019
  67. Sjors force-pushed on Oct 13, 2019
  68. Sjors force-pushed on Oct 14, 2019
  69. Sjors commented at 6:55 am on October 14, 2019: member

    Travis macOS passed! I added pip install zmq for the functional ZMQ tests…

    pyenv was causing more headaches than it solved. There doesn’t appear to be any `language: python python: ‘3.x’. packages available, so I’m installing via homebrew instead.

  70. Sjors force-pushed on Oct 14, 2019
  71. in ci/test/04_install.sh:76 in 26068f31ad outdated
    72@@ -26,7 +73,7 @@ elif [[ $BITCOIN_CONFIG = *--with-sanitizers=*address* ]]; then # If ran with (A
    73   DOCKER_ADMIN="--cap-add SYS_PTRACE"
    74 fi
    75 
    76-if [ -z "$RUN_CI_ON_HOST" ]; then
    77+if [ -z "$RUN_CI_ON_HOST" ] && [ "$TRAVIS_OS_NAME" != "osx" ]; then
    


    MarcoFalke commented at 12:30 pm on October 14, 2019:
    I’d prefer if you set RUN_CI_ON_HOST=1 in the env file or travis.yml
  72. in ci/test/04_install.sh:25 in 26068f31ad outdated
    42+      else
    43+        echo "Retrying..."
    44+      fi
    45+    done
    46+
    47+  done
    


    MarcoFalke commented at 12:33 pm on October 14, 2019:

    homebrew :man_facepalming:

    This can’t be written shorter, right?


    Sjors commented at 2:00 pm on October 14, 2019:
    Probably, but I’m no bash-master. Homebrew doesn’t have a “install or update if possible, don’t complain otherwise” feature, because … reason.

    fanquake commented at 2:05 pm on October 14, 2019:
    Could you just run brew update then brew install package-name --force for each package you’re trying to install?

    Sjors commented at 4:09 pm on October 14, 2019:

    Reinstalling these packages at every Travis run seems very slow:

    0-f, --force
    1              Remove a previously cached version and re-fetch.
    

    I shortened it a bit; we don’t really care if brew upgrade fails, and we can use CI_RETRY_EXE for install.


    MarcoFalke commented at 5:05 pm on October 14, 2019:
    I’d be fine with a solution that works, but isn’t the fastest. We can optimize for speed in a follow up pull request.
  73. MarcoFalke commented at 12:34 pm on October 14, 2019: member
    ACK 26068f31ad60c957ab7e6aef0a757fea4397da13 (looked at the diff on GitHub)
  74. Sjors force-pushed on Oct 14, 2019
  75. Sjors force-pushed on Oct 14, 2019
  76. in ci/lint/04_install.sh:12 in 092d3880a5 outdated
     7@@ -8,6 +8,8 @@ export LC_ALL=C
     8 
     9 if [ "$TRAVIS_OS_NAME" == "osx" ]; then
    10   # update first to install required ruby dependency
    11+  cd /usr/local/Homebrew
    12+  git reset --hard origin/master
    


    MarcoFalke commented at 5:11 pm on October 14, 2019:
    Why is the linter modified?

    Sjors commented at 6:47 pm on October 14, 2019:
    Oops, wrong one.
  77. Sjors force-pushed on Oct 14, 2019
  78. in ci/test/04_install.sh:15 in 3cd5e595ee outdated
     5@@ -6,6 +6,29 @@
     6 
     7 export LC_ALL=C.UTF-8
     8 
     9+if [ "$TRAVIS_OS_NAME" == "osx" ]; then
    10+  cd /usr/local/Homebrew || exit 1
    11+  git reset --hard origin/master
    12+  ${CI_RETRY_EXE} brew update
    


    Sjors commented at 6:58 pm on October 14, 2019:
    @MarcoFalke brew update blew up on a previous run (can’t find it anymore) and recommended these two lines to “fix” it.

    Sjors commented at 6:59 pm on October 14, 2019:
    It might be worth rebasing the PR for a while to see if any other surprises show up.
  79. Sjors force-pushed on Oct 14, 2019
  80. in ci/test/06_script_b.sh:10 in 21c1601f35 outdated
     5@@ -6,7 +6,10 @@
     6 
     7 export LC_ALL=C.UTF-8
     8 
     9+# Temporarily disable errexit, because Travis macOS fails without error message
    10+set +o errexit
    


    Sjors commented at 7:17 pm on October 14, 2019:
    This is where your sanity gives in…
  81. Sjors force-pushed on Oct 14, 2019
  82. travis: run tests on macOS native
    Review hint:
    git show -w
    
    Co-authored-by: MarcoFalke <falke.marco@gmail.com>
    Co-authored-by: keneanung <keneanung@googlemail.com>
    Co-authored-by: Vadim Peretokin <vperetokin@gmail.com>
    1f6c650c99
  83. Sjors force-pushed on Oct 14, 2019
  84. MarcoFalke commented at 3:59 pm on October 15, 2019: member
    re-ACK 1f6c650c99eb94fdd0cbdd528aa3405201de08c2
  85. in ci/test/04_install.sh:14 in 1f6c650c99
     5@@ -6,6 +6,32 @@
     6 
     7 export LC_ALL=C.UTF-8
     8 
     9+if [ "$TRAVIS_OS_NAME" == "osx" ]; then
    10+  set +o errexit
    11+  pushd /usr/local/Homebrew || exit 1
    12+  git reset --hard origin/master
    13+  popd || exit 1
    14+  set -o errexit
    


    MarcoFalke commented at 4:00 pm on October 15, 2019:
    What happens if you remove this?

    Sjors commented at 4:56 pm on October 15, 2019:
    Nothing initially because the brew cache is in a good state. But at some random other moment homebrew will be in a bad state and you’ll need this.
  86. in .travis.yml:43 in 1f6c650c99
    38+    - $HOME/Library/Caches/Homebrew
    39+    - /usr/local/Homebrew
    40+before_cache:
    41+  - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then brew cleanup; fi
    42+  # Cache only .git files under "/usr/local/Homebrew" so "brew update" does not take 5min every build
    43+  # - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then find /usr/local/Homebrew \! -regex ".+\.git.+" -delete; fi
    


    MarcoFalke commented at 1:05 pm on October 16, 2019:

    Is this still needed?

    The whole process takes 2 min without it: https://travis-ci.org/bitcoin/bitcoin/jobs/597848502#L100


    Sjors commented at 5:15 pm on October 17, 2019:
    I don’t know if it builds up any cruft over time, but if time doesn’t creep up, then we can drop this.

    MarcoFalke commented at 5:41 pm on October 17, 2019:
    Well it is commented out already, so I removed it in #17176
  87. MarcoFalke referenced this in commit ec3ed5a448 on Oct 17, 2019
  88. MarcoFalke merged this on Oct 17, 2019
  89. MarcoFalke closed this on Oct 17, 2019

  90. in ci/test/06_script_a.sh:27 in 1f6c650c99
    19@@ -20,7 +20,11 @@ fi
    20 END_FOLD
    21 
    22 mkdir -p build
    23+
    24+# Temporarily disable errexit, because Travis macOS fails without error message
    25+set +o errexit
    26 cd build || (echo "could not enter build directory"; exit 1)
    27+set -o errexit
    


    ryanofsky commented at 2:51 pm on October 17, 2019:
    The cd command succeeds and returns an error code? I guess this is calling some travis-wrapped cd alias rather than the actual cd command? Could debug with type cd. If a workaround is necessary, it would seem nicer to wrap the workaround in a safe_cd function than repeat this errexit stuff different places.

    MarcoFalke commented at 3:35 pm on October 17, 2019:
    Filed as good first issue. See #17178
  91. in ci/test/05_before_script.sh:16 in 1f6c650c99
    13+else
    14+  DOCKER_EXEC echo \> \$HOME/.bitcoin
    15+fi
    16 
    17-mkdir -p depends/SDKs depends/sdk-sources
    18+if [ "$TRAVIS_OS_NAME" != "osx" ]; then
    


    ryanofsky commented at 3:01 pm on October 17, 2019:
    Maybe should add a comment explaining this check. I’m confused about why all of this is skipped on osx. Does the depends build not work there? It would seem cleaner to use NO_DEPENDS variable to skip depends steps than to tie the decision to the travis operating system name.

    MarcoFalke commented at 3:31 pm on October 17, 2019:
    Thanks for the review @ryanofsky . This check looks indeed redundant. Removed in #17176
  92. ryanofsky commented at 3:12 pm on October 17, 2019: member

    Post merge code review ACK 1f6c650c99eb94fdd0cbdd528aa3405201de08c2

    Since this adds homebrew, I wonder if it fixes the scripted diff lint error I ran into #13728 (comment)

  93. sidhujag referenced this in commit 751b535f69 on Oct 18, 2019
  94. DrahtBot locked this on Dec 16, 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-09-29 07:12 UTC

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