From 7b67a240206cec4c46f8e54324ce9f66abe95eea Mon Sep 17 00:00:00 2001 From: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com> Date: Fri, 23 Oct 2020 10:03:57 -0700 Subject: [PATCH] Use Ubuntu Bionic for CI (#11027) We need to upgrade to Bionic so that we have access to pre-installed Python 3.8 in CI. Installing via Pyenv is too slow and makes the cache too big. --- .travis.yml | 245 ++++++++--------------- build-support/bin/generate_travis_yml.py | 115 ++++------- src/python/pants/engine/process_test.py | 176 ---------------- tests/python/pants_test/pantsd/BUILD | 2 +- 4 files changed, 126 insertions(+), 412 deletions(-) diff --git a/.travis.yml b/.travis.yml index eba2b74bc5e..11982b7aa0f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,10 +20,10 @@ env: - AWS_BUCKET=ci-public.pantsbuild.org - BOOTSTRAPPED_PEX_KEY_PREFIX=daily/${TRAVIS_BUILD_NUMBER}/${TRAVIS_BUILD_ID}/pants.pex - NATIVE_ENGINE_SO_KEY_PREFIX=monthly/native_engine_so - - PYENV_PY27_VERSION=2.7.18 - - PYENV_PY36_VERSION=3.6.10 - - PYENV_PY37_VERSION=3.7.7 - - PYENV_PY38_VERSION=3.8.3 + - MACOS_PYENV_PY27_VERSION=2.7.18 + - MACOS_PYENV_PY36_VERSION=3.6.10 + - MACOS_PYENV_PY37_VERSION=3.7.7 + - MACOS_PYENV_PY38_VERSION=3.8.3 - PYENV_ROOT_OSX=${HOME}/.pants_pyenv - PYENV_ROOT="${PYENV_ROOT:-${PYENV_ROOT_OSX}}" - PATH="${PYENV_ROOT}/shims:${PATH}" @@ -54,7 +54,7 @@ jobs: - ./build-support/bin/prune_travis_cache.sh before_install: - ./build-support/bin/install_aws_cli_for_ci.sh - - pyenv global 2.7.15 3.6.7 3.7.1 + - pyenv global 2.7.17 3.6.10 3.7.6 3.8.1 cache: directories: - ${AWS_CLI_ROOT} @@ -63,7 +63,7 @@ jobs: - build-support/virtualenvs - src/rust/engine/target timeout: 500 - dist: xenial + dist: bionic env: - CACHE_NAME=bootstrap.linux.py36 - BOOTSTRAPPED_PEX_KEY_SUFFIX=py36.linux @@ -85,7 +85,6 @@ jobs: services: - docker stage: Bootstrap Pants - sudo: required - addons: apt: packages: @@ -107,7 +106,7 @@ jobs: - ./build-support/bin/prune_travis_cache.sh before_install: - ./build-support/bin/install_aws_cli_for_ci.sh - - pyenv global 2.7.15 3.6.7 3.7.1 + - pyenv global 2.7.17 3.6.10 3.7.6 3.8.1 cache: directories: - ${AWS_CLI_ROOT} @@ -116,7 +115,7 @@ jobs: - build-support/virtualenvs - src/rust/engine/target timeout: 500 - dist: xenial + dist: bionic env: - CACHE_NAME=bootstrap.linux.py37 - BOOTSTRAPPED_PEX_KEY_SUFFIX=py37.linux @@ -138,7 +137,6 @@ jobs: services: - docker stage: Bootstrap Pants (Cron) - sudo: required - after_failure: - ./build-support/bin/ci-failure.sh before_cache: @@ -150,7 +148,7 @@ jobs: -o /usr/local/bin/jq - chmod 755 /usr/local/bin/jq - ./build-support/bin/install_aws_cli_for_ci.sh - - ./build-support/bin/install_python_for_ci.sh ${PYENV_PY27_VERSION} ${PYENV_PY36_VERSION} + - ./build-support/bin/install_python_for_ci.sh ${MACOS_PYENV_PY27_VERSION} ${MACOS_PYENV_PY36_VERSION} before_script: - ulimit -n 8192 cache: @@ -165,14 +163,14 @@ jobs: - PATH="/usr/local/opt/openssl/bin:${PATH}" - LDFLAGS="-L/usr/local/opt/openssl/lib" - CPPFLAGS="-I/usr/local/opt/openssl/include" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY27_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY36_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY37_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY38_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY27_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY36_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY37_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY38_VERSION}/bin:${PATH}" - CACHE_NAME=bootstrap.osx.py36 - BOOTSTRAPPED_PEX_KEY_SUFFIX=py36.osx language: generic - name: Build OSX native engine and pants.pex (Python 3.6) + name: Build macOS native engine and pants.pex (Python 3.6) os: osx osx_image: xcode8 script: @@ -191,7 +189,7 @@ jobs: -o /usr/local/bin/jq - chmod 755 /usr/local/bin/jq - ./build-support/bin/install_aws_cli_for_ci.sh - - ./build-support/bin/install_python_for_ci.sh ${PYENV_PY27_VERSION} ${PYENV_PY37_VERSION} + - ./build-support/bin/install_python_for_ci.sh ${MACOS_PYENV_PY27_VERSION} ${MACOS_PYENV_PY37_VERSION} before_script: - ulimit -n 8192 cache: @@ -206,14 +204,14 @@ jobs: - PATH="/usr/local/opt/openssl/bin:${PATH}" - LDFLAGS="-L/usr/local/opt/openssl/lib" - CPPFLAGS="-I/usr/local/opt/openssl/include" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY27_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY36_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY37_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY38_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY27_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY36_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY37_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY38_VERSION}/bin:${PATH}" - CACHE_NAME=bootstrap.osx.py37 - BOOTSTRAPPED_PEX_KEY_SUFFIX=py37.osx language: generic - name: Build OSX native engine and pants.pex (Python 3.7) + name: Build macOS native engine and pants.pex (Python 3.7) os: osx osx_image: xcode8 script: @@ -238,17 +236,12 @@ jobs: - ./build-support/bin/ci-failure.sh before_cache: - sudo chown -R travis:travis "${HOME}" "${TRAVIS_BUILD_DIR}" - - find ${HOME}/.ivy2/pants -type f -name "ivydata-*.properties" -delete - - rm -f ${HOME}/.ivy2/pants/*.{css,properties,xml,xsl} - - rm -rf ${HOME}/.ivy2/pants/com.example - du -m -d2 ${HOME}/.cache/pants | sort -r -n - ./build-support/bin/prune_travis_cache.sh before_install: - - PATH="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin":$PATH - - JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 - sudo sysctl fs.inotify.max_user_watches=524288 - ./build-support/bin/install_aws_cli_for_ci.sh - - pyenv global 2.7.15 3.6.7 3.7.1 + - pyenv global 2.7.17 3.6.10 3.7.6 3.8.1 - wget -qO- "https://github.com/crazy-max/travis-wait-enhanced/releases/download/v0.2.1/travis-wait-enhanced_0.2.1_linux_x86_64.tar.gz" | tar -zxvf - travis-wait-enhanced - mv travis-wait-enhanced /home/travis/bin/ @@ -258,15 +251,10 @@ jobs: directories: - ${AWS_CLI_ROOT} - ${PYENV_ROOT_OSX} - - ${HOME}/.cache/pants/tools - - ${HOME}/.cache/pants/zinc - - ${HOME}/.ivy2/pants - - ${HOME}/.npm timeout: 500 - dist: xenial + dist: bionic env: - BOOTSTRAPPED_PEX_KEY_SUFFIX=py36.linux - - PANTS_REMOTE_CA_CERTS_PATH=/usr/lib/google-cloud-sdk/lib/third_party/grpc/_cython/_credentials/roots.pem - CACHE_NAME=lint.py36 language: python name: Self-checks and lint (Python 3.6) @@ -281,7 +269,6 @@ jobs: - travis-wait-enhanced --timeout 40m --interval 9m -- ./build-support/bin/ci.py --lint --python-version 3.6 stage: Test Pants - sudo: required - addons: apt: packages: @@ -299,17 +286,12 @@ jobs: - ./build-support/bin/ci-failure.sh before_cache: - sudo chown -R travis:travis "${HOME}" "${TRAVIS_BUILD_DIR}" - - find ${HOME}/.ivy2/pants -type f -name "ivydata-*.properties" -delete - - rm -f ${HOME}/.ivy2/pants/*.{css,properties,xml,xsl} - - rm -rf ${HOME}/.ivy2/pants/com.example - du -m -d2 ${HOME}/.cache/pants | sort -r -n - ./build-support/bin/prune_travis_cache.sh before_install: - - PATH="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin":$PATH - - JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 - sudo sysctl fs.inotify.max_user_watches=524288 - ./build-support/bin/install_aws_cli_for_ci.sh - - pyenv global 2.7.15 3.6.7 3.7.1 + - pyenv global 2.7.17 3.6.10 3.7.6 3.8.1 - wget -qO- "https://github.com/crazy-max/travis-wait-enhanced/releases/download/v0.2.1/travis-wait-enhanced_0.2.1_linux_x86_64.tar.gz" | tar -zxvf - travis-wait-enhanced - mv travis-wait-enhanced /home/travis/bin/ @@ -319,15 +301,10 @@ jobs: directories: - ${AWS_CLI_ROOT} - ${PYENV_ROOT_OSX} - - ${HOME}/.cache/pants/tools - - ${HOME}/.cache/pants/zinc - - ${HOME}/.ivy2/pants - - ${HOME}/.npm timeout: 500 - dist: xenial + dist: bionic env: - BOOTSTRAPPED_PEX_KEY_SUFFIX=py37.linux - - PANTS_REMOTE_CA_CERTS_PATH=/usr/lib/google-cloud-sdk/lib/third_party/grpc/_cython/_credentials/roots.pem - CACHE_NAME=lint.py37 language: python name: Self-checks and lint (Python 3.7) @@ -342,14 +319,11 @@ jobs: - travis-wait-enhanced --timeout 40m --interval 9m -- ./build-support/bin/ci.py --lint --python-version 3.7 stage: Test Pants (Cron) - sudo: required - before_cache: - sudo chown -R travis:travis "${HOME}" "${TRAVIS_BUILD_DIR}" - find build-support -name "*.py[co]" -delete - ./build-support/bin/prune_travis_cache.sh before_install: - - PATH="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin":$PATH - - JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 - sudo sysctl fs.inotify.max_user_watches=524288 - ./build-support/bin/install_aws_cli_for_ci.sh - pyenv global 2.7.15 3.6.7 3.7.1 @@ -396,17 +370,12 @@ jobs: - ./build-support/bin/upload_coverage.sh before_cache: - sudo chown -R travis:travis "${HOME}" "${TRAVIS_BUILD_DIR}" - - find ${HOME}/.ivy2/pants -type f -name "ivydata-*.properties" -delete - - rm -f ${HOME}/.ivy2/pants/*.{css,properties,xml,xsl} - - rm -rf ${HOME}/.ivy2/pants/com.example - du -m -d2 ${HOME}/.cache/pants | sort -r -n - ./build-support/bin/prune_travis_cache.sh before_install: - - PATH="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin":$PATH - - JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 - sudo sysctl fs.inotify.max_user_watches=524288 - ./build-support/bin/install_aws_cli_for_ci.sh - - pyenv global 2.7.15 3.6.7 3.7.1 + - pyenv global 2.7.17 3.6.10 3.7.6 3.8.1 - wget -qO- "https://github.com/crazy-max/travis-wait-enhanced/releases/download/v0.2.1/travis-wait-enhanced_0.2.1_linux_x86_64.tar.gz" | tar -zxvf - travis-wait-enhanced - mv travis-wait-enhanced /home/travis/bin/ @@ -416,15 +385,10 @@ jobs: directories: - ${AWS_CLI_ROOT} - ${PYENV_ROOT_OSX} - - ${HOME}/.cache/pants/tools - - ${HOME}/.cache/pants/zinc - - ${HOME}/.ivy2/pants - - ${HOME}/.npm timeout: 500 - dist: xenial + dist: bionic env: - BOOTSTRAPPED_PEX_KEY_SUFFIX=py36.linux - - PANTS_REMOTE_CA_CERTS_PATH=/usr/lib/google-cloud-sdk/lib/third_party/grpc/_cython/_credentials/roots.pem - CACHE_NAME=python_tests.py36 language: python name: Python tests (Python 3.6) @@ -437,7 +401,6 @@ jobs: - travis-wait-enhanced --timeout 65m --interval 9m -- ./build-support/bin/ci.py --unit-tests --integration-tests --python-version 3.6 stage: Test Pants - sudo: required - addons: apt: packages: @@ -457,17 +420,12 @@ jobs: - ./build-support/bin/upload_coverage.sh before_cache: - sudo chown -R travis:travis "${HOME}" "${TRAVIS_BUILD_DIR}" - - find ${HOME}/.ivy2/pants -type f -name "ivydata-*.properties" -delete - - rm -f ${HOME}/.ivy2/pants/*.{css,properties,xml,xsl} - - rm -rf ${HOME}/.ivy2/pants/com.example - du -m -d2 ${HOME}/.cache/pants | sort -r -n - ./build-support/bin/prune_travis_cache.sh before_install: - - PATH="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin":$PATH - - JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 - sudo sysctl fs.inotify.max_user_watches=524288 - ./build-support/bin/install_aws_cli_for_ci.sh - - pyenv global 2.7.15 3.6.7 3.7.1 + - pyenv global 2.7.17 3.6.10 3.7.6 3.8.1 - wget -qO- "https://github.com/crazy-max/travis-wait-enhanced/releases/download/v0.2.1/travis-wait-enhanced_0.2.1_linux_x86_64.tar.gz" | tar -zxvf - travis-wait-enhanced - mv travis-wait-enhanced /home/travis/bin/ @@ -477,15 +435,10 @@ jobs: directories: - ${AWS_CLI_ROOT} - ${PYENV_ROOT_OSX} - - ${HOME}/.cache/pants/tools - - ${HOME}/.cache/pants/zinc - - ${HOME}/.ivy2/pants - - ${HOME}/.npm timeout: 500 - dist: xenial + dist: bionic env: - BOOTSTRAPPED_PEX_KEY_SUFFIX=py37.linux - - PANTS_REMOTE_CA_CERTS_PATH=/usr/lib/google-cloud-sdk/lib/third_party/grpc/_cython/_credentials/roots.pem - CACHE_NAME=python_tests.py37 language: python name: Python tests (Python 3.7) @@ -498,14 +451,11 @@ jobs: - travis-wait-enhanced --timeout 65m --interval 9m -- ./build-support/bin/ci.py --unit-tests --integration-tests --python-version 3.7 stage: Test Pants (Cron) - sudo: required - before_cache: - sudo chown -R travis:travis "${HOME}" "${TRAVIS_BUILD_DIR}" - find build-support -name "*.py[co]" -delete - ./build-support/bin/prune_travis_cache.sh before_install: - - PATH="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin":$PATH - - JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 - sudo sysctl fs.inotify.max_user_watches=524288 - ./build-support/bin/install_aws_cli_for_ci.sh - pyenv global 2.7.15 3.6.7 3.7.1 @@ -539,7 +489,7 @@ jobs: - find build-support -name "*.py[co]" -delete - ./build-support/bin/prune_travis_cache.sh before_install: - - ./build-support/bin/install_python_for_ci.sh "${PYENV_PY36_VERSION}" + - ./build-support/bin/install_python_for_ci.sh "${MACOS_PYENV_PY36_VERSION}" - brew cask install osxfuse before_script: - ulimit -n 8192 @@ -555,10 +505,10 @@ jobs: - PATH="/usr/local/opt/openssl/bin:${PATH}" - LDFLAGS="-L/usr/local/opt/openssl/lib" - CPPFLAGS="-I/usr/local/opt/openssl/include" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY27_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY36_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY37_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY38_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY27_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY36_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY37_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY38_VERSION}/bin:${PATH}" - CACHE_NAME=rust_tests.osx if: commit_message !~ /\[ci skip-rust\]/ name: Rust tests - OSX @@ -584,32 +534,22 @@ jobs: - ./build-support/bin/ci-failure.sh before_cache: - sudo chown -R travis:travis "${HOME}" "${TRAVIS_BUILD_DIR}" - - find ${HOME}/.ivy2/pants -type f -name "ivydata-*.properties" -delete - - rm -f ${HOME}/.ivy2/pants/*.{css,properties,xml,xsl} - - rm -rf ${HOME}/.ivy2/pants/com.example - du -m -d2 ${HOME}/.cache/pants | sort -r -n - ./build-support/bin/prune_travis_cache.sh before_install: - - PATH="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin":$PATH - - JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 - sudo sysctl fs.inotify.max_user_watches=524288 - ./build-support/bin/install_aws_cli_for_ci.sh - - pyenv global 2.7.15 3.6.7 3.7.1 + - pyenv global 2.7.17 3.6.10 3.7.6 3.8.1 before_script: - ./build-support/bin/get_ci_bootstrapped_pants_pex.sh ${AWS_BUCKET} ${BOOTSTRAPPED_PEX_KEY_PREFIX}.${BOOTSTRAPPED_PEX_KEY_SUFFIX} cache: directories: - ${AWS_CLI_ROOT} - ${PYENV_ROOT_OSX} - - ${HOME}/.cache/pants/tools - - ${HOME}/.cache/pants/zinc - - ${HOME}/.ivy2/pants - - ${HOME}/.npm timeout: 500 - dist: xenial + dist: bionic env: - BOOTSTRAPPED_PEX_KEY_SUFFIX=py36.linux - - PANTS_REMOTE_CA_CERTS_PATH=/usr/lib/google-cloud-sdk/lib/third_party/grpc/_cython/_credentials/roots.pem - PREPARE_DEPLOY=1 - CACHE_NAME=wheels.linux if: commit_message !~ /\[ci skip-build-wheels\]/ OR type NOT IN (pull_request, @@ -632,7 +572,6 @@ jobs: services: - docker stage: Test Pants - sudo: required - before_cache: - sudo chown -R travis:travis "${HOME}" "${TRAVIS_BUILD_DIR}" - find build-support -name "*.py[co]" -delete @@ -642,8 +581,8 @@ jobs: -o /usr/local/bin/jq - chmod 755 /usr/local/bin/jq - ./build-support/bin/install_aws_cli_for_ci.sh - - ./build-support/bin/install_python_for_ci.sh ${PYENV_PY36_VERSION} ${PYENV_PY37_VERSION} - ${PYENV_PY38_VERSION} + - ./build-support/bin/install_python_for_ci.sh ${MACOS_PYENV_PY36_VERSION} ${MACOS_PYENV_PY37_VERSION} + ${MACOS_PYENV_PY38_VERSION} before_script: - ulimit -n 8192 - ./build-support/bin/get_ci_bootstrapped_pants_pex.sh ${AWS_BUCKET} ${BOOTSTRAPPED_PEX_KEY_PREFIX}.${BOOTSTRAPPED_PEX_KEY_SUFFIX} @@ -659,10 +598,10 @@ jobs: - PATH="/usr/local/opt/openssl/bin:${PATH}" - LDFLAGS="-L/usr/local/opt/openssl/lib" - CPPFLAGS="-I/usr/local/opt/openssl/include" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY27_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY36_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY37_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY38_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY27_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY36_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY37_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY38_VERSION}/bin:${PATH}" - BOOTSTRAPPED_PEX_KEY_SUFFIX=py36.osx - PREPARE_DEPLOY=1 - CACHE_NAME=wheels.osx @@ -683,7 +622,7 @@ jobs: -o /usr/local/bin/jq - chmod 755 /usr/local/bin/jq - ./build-support/bin/install_aws_cli_for_ci.sh - - ./build-support/bin/install_python_for_ci.sh ${PYENV_PY27_VERSION} ${PYENV_PY36_VERSION} + - ./build-support/bin/install_python_for_ci.sh ${MACOS_PYENV_PY27_VERSION} ${MACOS_PYENV_PY36_VERSION} before_script: - ulimit -n 8192 - ./build-support/bin/get_ci_bootstrapped_pants_pex.sh ${AWS_BUCKET} ${BOOTSTRAPPED_PEX_KEY_PREFIX}.${BOOTSTRAPPED_PEX_KEY_SUFFIX} @@ -691,14 +630,14 @@ jobs: - PATH="/usr/local/opt/openssl/bin:${PATH}" - LDFLAGS="-L/usr/local/opt/openssl/lib" - CPPFLAGS="-I/usr/local/opt/openssl/include" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY27_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY36_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY37_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY38_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY27_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY36_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY37_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY38_VERSION}/bin:${PATH}" - BOOTSTRAPPED_PEX_KEY_SUFFIX=py36.osx - CACHE_NAME=osx_platform_tests.py36 language: generic - name: OSX platform-specific tests (Python 3.6) + name: macOS platform-specific tests (Python 3.6) os: osx script: - ./build-support/bin/ci.py --platform-specific-tests --python-version 3.6 @@ -708,7 +647,7 @@ jobs: -o /usr/local/bin/jq - chmod 755 /usr/local/bin/jq - ./build-support/bin/install_aws_cli_for_ci.sh - - ./build-support/bin/install_python_for_ci.sh ${PYENV_PY27_VERSION} ${PYENV_PY37_VERSION} + - ./build-support/bin/install_python_for_ci.sh ${MACOS_PYENV_PY27_VERSION} ${MACOS_PYENV_PY37_VERSION} before_script: - ulimit -n 8192 - ./build-support/bin/get_ci_bootstrapped_pants_pex.sh ${AWS_BUCKET} ${BOOTSTRAPPED_PEX_KEY_PREFIX}.${BOOTSTRAPPED_PEX_KEY_SUFFIX} @@ -716,14 +655,14 @@ jobs: - PATH="/usr/local/opt/openssl/bin:${PATH}" - LDFLAGS="-L/usr/local/opt/openssl/lib" - CPPFLAGS="-I/usr/local/opt/openssl/include" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY27_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY36_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY37_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY38_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY27_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY36_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY37_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY38_VERSION}/bin:${PATH}" - BOOTSTRAPPED_PEX_KEY_SUFFIX=py37.osx - CACHE_NAME=osx_platform_tests.py37 language: generic - name: OSX platform-specific tests (Python 3.7) + name: macOS platform-specific tests (Python 3.7) os: osx script: - ./build-support/bin/ci.py --platform-specific-tests --python-version 3.7 @@ -733,7 +672,7 @@ jobs: -o /usr/local/bin/jq - chmod 755 /usr/local/bin/jq - ./build-support/bin/install_aws_cli_for_ci.sh - - ./build-support/bin/install_python_for_ci.sh ${PYENV_PY27_VERSION} ${PYENV_PY36_VERSION} + - ./build-support/bin/install_python_for_ci.sh ${MACOS_PYENV_PY27_VERSION} ${MACOS_PYENV_PY36_VERSION} before_script: - ulimit -n 8192 - ./build-support/bin/get_ci_bootstrapped_pants_pex.sh ${AWS_BUCKET} ${BOOTSTRAPPED_PEX_KEY_PREFIX}.${BOOTSTRAPPED_PEX_KEY_SUFFIX} @@ -741,14 +680,14 @@ jobs: - PATH="/usr/local/opt/openssl/bin:${PATH}" - LDFLAGS="-L/usr/local/opt/openssl/lib" - CPPFLAGS="-I/usr/local/opt/openssl/include" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY27_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY36_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY37_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY38_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY27_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY36_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY37_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY38_VERSION}/bin:${PATH}" - BOOTSTRAPPED_PEX_KEY_SUFFIX=py36.osx - CACHE_NAME=osx_smoke_tests.10_12.py36 language: generic - name: OSX 10.12 smoke test (Python 3.6) + name: macOS 10.12 smoke test (Python 3.6) os: osx osx_image: xcode9.2 script: @@ -759,7 +698,7 @@ jobs: -o /usr/local/bin/jq - chmod 755 /usr/local/bin/jq - ./build-support/bin/install_aws_cli_for_ci.sh - - ./build-support/bin/install_python_for_ci.sh ${PYENV_PY27_VERSION} ${PYENV_PY37_VERSION} + - ./build-support/bin/install_python_for_ci.sh ${MACOS_PYENV_PY27_VERSION} ${MACOS_PYENV_PY37_VERSION} before_script: - ulimit -n 8192 - ./build-support/bin/get_ci_bootstrapped_pants_pex.sh ${AWS_BUCKET} ${BOOTSTRAPPED_PEX_KEY_PREFIX}.${BOOTSTRAPPED_PEX_KEY_SUFFIX} @@ -767,14 +706,14 @@ jobs: - PATH="/usr/local/opt/openssl/bin:${PATH}" - LDFLAGS="-L/usr/local/opt/openssl/lib" - CPPFLAGS="-I/usr/local/opt/openssl/include" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY27_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY36_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY37_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY38_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY27_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY36_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY37_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY38_VERSION}/bin:${PATH}" - BOOTSTRAPPED_PEX_KEY_SUFFIX=py37.osx - CACHE_NAME=osx_smoke_tests.10_12.py37 language: generic - name: OSX 10.12 smoke test (Python 3.7) + name: macOS 10.12 smoke test (Python 3.7) os: osx osx_image: xcode9.2 script: @@ -785,7 +724,7 @@ jobs: -o /usr/local/bin/jq - chmod 755 /usr/local/bin/jq - ./build-support/bin/install_aws_cli_for_ci.sh - - ./build-support/bin/install_python_for_ci.sh ${PYENV_PY27_VERSION} ${PYENV_PY36_VERSION} + - ./build-support/bin/install_python_for_ci.sh ${MACOS_PYENV_PY27_VERSION} ${MACOS_PYENV_PY36_VERSION} before_script: - ulimit -n 8192 - ./build-support/bin/get_ci_bootstrapped_pants_pex.sh ${AWS_BUCKET} ${BOOTSTRAPPED_PEX_KEY_PREFIX}.${BOOTSTRAPPED_PEX_KEY_SUFFIX} @@ -793,14 +732,14 @@ jobs: - PATH="/usr/local/opt/openssl/bin:${PATH}" - LDFLAGS="-L/usr/local/opt/openssl/lib" - CPPFLAGS="-I/usr/local/opt/openssl/include" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY27_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY36_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY37_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY38_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY27_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY36_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY37_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY38_VERSION}/bin:${PATH}" - BOOTSTRAPPED_PEX_KEY_SUFFIX=py36.osx - CACHE_NAME=osx_smoke_tests.10_13.py36 language: generic - name: OSX 10.13 smoke test (Python 3.6) + name: macOS 10.13 smoke test (Python 3.6) os: osx osx_image: xcode10.1 script: @@ -811,7 +750,7 @@ jobs: -o /usr/local/bin/jq - chmod 755 /usr/local/bin/jq - ./build-support/bin/install_aws_cli_for_ci.sh - - ./build-support/bin/install_python_for_ci.sh ${PYENV_PY27_VERSION} ${PYENV_PY37_VERSION} + - ./build-support/bin/install_python_for_ci.sh ${MACOS_PYENV_PY27_VERSION} ${MACOS_PYENV_PY37_VERSION} before_script: - ulimit -n 8192 - ./build-support/bin/get_ci_bootstrapped_pants_pex.sh ${AWS_BUCKET} ${BOOTSTRAPPED_PEX_KEY_PREFIX}.${BOOTSTRAPPED_PEX_KEY_SUFFIX} @@ -819,14 +758,14 @@ jobs: - PATH="/usr/local/opt/openssl/bin:${PATH}" - LDFLAGS="-L/usr/local/opt/openssl/lib" - CPPFLAGS="-I/usr/local/opt/openssl/include" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY27_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY36_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY37_VERSION}/bin:${PATH}" - - PATH="${PYENV_ROOT}/versions/${PYENV_PY38_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY27_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY36_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY37_VERSION}/bin:${PATH}" + - PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY38_VERSION}/bin:${PATH}" - BOOTSTRAPPED_PEX_KEY_SUFFIX=py37.osx - CACHE_NAME=osx_smoke_tests.10_13.py37 language: generic - name: OSX 10.13 smoke test (Python 3.7) + name: macOS 10.13 smoke test (Python 3.7) os: osx osx_image: xcode10.1 script: @@ -849,27 +788,18 @@ jobs: - ./build-support/bin/ci-failure.sh before_cache: - sudo chown -R travis:travis "${HOME}" "${TRAVIS_BUILD_DIR}" - - find ${HOME}/.ivy2/pants -type f -name "ivydata-*.properties" -delete - - rm -f ${HOME}/.ivy2/pants/*.{css,properties,xml,xsl} - - rm -rf ${HOME}/.ivy2/pants/com.example - du -m -d2 ${HOME}/.cache/pants | sort -r -n - ./build-support/bin/prune_travis_cache.sh before_install: - - PATH="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin":$PATH - - JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 - sudo sysctl fs.inotify.max_user_watches=524288 - ./build-support/bin/install_aws_cli_for_ci.sh - - pyenv global 2.7.15 3.6.7 3.7.1 + - pyenv global 2.7.17 3.6.10 3.7.6 3.8.1 before_script: - ./build-support/bin/get_ci_bootstrapped_pants_pex.sh ${AWS_BUCKET} ${BOOTSTRAPPED_PEX_KEY_PREFIX}.${BOOTSTRAPPED_PEX_KEY_SUFFIX} cache: directories: - ${AWS_CLI_ROOT} - ${PYENV_ROOT_OSX} - - ${HOME}/.cache/pants/tools - - ${HOME}/.cache/pants/zinc - - ${HOME}/.ivy2/pants - - ${HOME}/.npm timeout: 500 deploy: api_key: @@ -881,10 +811,9 @@ jobs: tags: true provider: releases skip_cleanup: true - dist: xenial + dist: bionic env: - BOOTSTRAPPED_PEX_KEY_SUFFIX=py36.linux - - PANTS_REMOTE_CA_CERTS_PATH=/usr/lib/google-cloud-sdk/lib/third_party/grpc/_cython/_credentials/roots.pem - RUN_PANTS_FROM_PEX=1 - PANTS_PEX_RELEASE=stable - CACHE_NAME=deploy.stable @@ -898,7 +827,6 @@ jobs: script: - ./build-support/bin/release.sh -p stage: Deploy Pants Pex - sudo: required - addons: apt: packages: @@ -916,32 +844,22 @@ jobs: - ./build-support/bin/ci-failure.sh before_cache: - sudo chown -R travis:travis "${HOME}" "${TRAVIS_BUILD_DIR}" - - find ${HOME}/.ivy2/pants -type f -name "ivydata-*.properties" -delete - - rm -f ${HOME}/.ivy2/pants/*.{css,properties,xml,xsl} - - rm -rf ${HOME}/.ivy2/pants/com.example - du -m -d2 ${HOME}/.cache/pants | sort -r -n - ./build-support/bin/prune_travis_cache.sh before_install: - - PATH="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin":$PATH - - JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 - sudo sysctl fs.inotify.max_user_watches=524288 - ./build-support/bin/install_aws_cli_for_ci.sh - - pyenv global 2.7.15 3.6.7 3.7.1 + - pyenv global 2.7.17 3.6.10 3.7.6 3.8.1 before_script: - ./build-support/bin/get_ci_bootstrapped_pants_pex.sh ${AWS_BUCKET} ${BOOTSTRAPPED_PEX_KEY_PREFIX}.${BOOTSTRAPPED_PEX_KEY_SUFFIX} cache: directories: - ${AWS_CLI_ROOT} - ${PYENV_ROOT_OSX} - - ${HOME}/.cache/pants/tools - - ${HOME}/.cache/pants/zinc - - ${HOME}/.ivy2/pants - - ${HOME}/.npm timeout: 500 - dist: xenial + dist: bionic env: - BOOTSTRAPPED_PEX_KEY_SUFFIX=py36.linux - - PANTS_REMOTE_CA_CERTS_PATH=/usr/lib/google-cloud-sdk/lib/third_party/grpc/_cython/_credentials/roots.pem - RUN_PANTS_FROM_PEX=1 - PREPARE_DEPLOY=1 - CACHE_NAME=deploy.unstable @@ -957,7 +875,6 @@ jobs: - mkdir -p dist/deploy/pex/ - mv dist/pants*.pex dist/deploy/pex/ stage: Deploy Pants Pex Unstable - sudo: required stages: - if: type != cron name: Bootstrap Pants diff --git a/build-support/bin/generate_travis_yml.py b/build-support/bin/generate_travis_yml.py index 117a0656422..16369e510de 100644 --- a/build-support/bin/generate_travis_yml.py +++ b/build-support/bin/generate_travis_yml.py @@ -76,10 +76,10 @@ def all_entries(cls) -> List[Dict[str, str]]: # mitigate risk. "BOOTSTRAPPED_PEX_KEY_PREFIX=daily/${TRAVIS_BUILD_NUMBER}/${TRAVIS_BUILD_ID}/pants.pex", "NATIVE_ENGINE_SO_KEY_PREFIX=monthly/native_engine_so", - "PYENV_PY27_VERSION=2.7.18", - "PYENV_PY36_VERSION=3.6.10", - "PYENV_PY37_VERSION=3.7.7", - "PYENV_PY38_VERSION=3.8.3", + "MACOS_PYENV_PY27_VERSION=2.7.18", + "MACOS_PYENV_PY36_VERSION=3.6.10", + "MACOS_PYENV_PY37_VERSION=3.7.7", + "MACOS_PYENV_PY38_VERSION=3.8.3", # NB: We must set `PYENV_ROOT` on macOS for Pyenv to work properly. However, on Linux, we must not # override the default value because Linux pre-installs Python via Pyenv and we must keep their # $PYENV_ROOT for this to still work. @@ -126,22 +126,18 @@ def number(self) -> int: def decimal(self) -> float: return {self.py36: 3.6, self.py37: 3.7, self.py38: 3.8}[self] # type: ignore[index] - @property - def is_py36(self) -> bool: - return self == PythonVersion.py36 - - @property - def is_py37(self) -> bool: - return self == PythonVersion.py37 - - @property - def is_py38(self) -> bool: - return self == PythonVersion.py38 - def default_stage(self, *, is_bootstrap: bool = False) -> Stage: if is_bootstrap: - return {self.py36: Stage.bootstrap, self.py37: Stage.bootstrap_cron, self.py38: Stage.bootstrap_cron}[self] # type: ignore[index] - return {self.py36: Stage.test, self.py37: Stage.test_cron, self.py38: Stage.test_cron}[self] # type: ignore[index] + return { + self.py36: Stage.bootstrap, + self.py37: Stage.bootstrap_cron, + self.py38: Stage.bootstrap_cron, + }[ + self # type: ignore[index] + ] + return {self.py36: Stage.test, self.py37: Stage.test_cron, self.py38: Stage.test_cron,}[ + self # type: ignore[index] + ] # ---------------------------------------------------------------------- @@ -210,8 +206,8 @@ def docker_run_travis_ci_image(command: str) -> str: # The default timeout is 180 seconds, and our larger cache uploads exceed this. # TODO: Now that we trim caches, perhaps we no longer need this modified timeout. _cache_timeout = 500 -# NB: Attempting to cache directories that don't exist (e.g., the custom osx pyenv root on linux) causes no harm, -# and simplifies the code. +# NB: Attempting to cache directories that don't exist (e.g., the custom osx pyenv root on linux) +# causes no harm, and simplifies the code. _cache_common_directories = ["${AWS_CLI_ROOT}", "${PYENV_ROOT_OSX}"] # Ensure permissions to do the below removals, which happen with or without caching enabled. _cache_set_required_permissions = 'sudo chown -R travis:travis "${HOME}" "${TRAVIS_BUILD_DIR}"' @@ -227,8 +223,8 @@ def docker_run_travis_ci_image(command: str) -> str: ], "cache": { "timeout": _cache_timeout, - "directories": _cache_common_directories - + [ + "directories": [ + *_cache_common_directories, "${HOME}/.cache/pants/rust/cargo", "build-support/virtualenvs", "src/rust/engine/target", @@ -239,33 +235,13 @@ def docker_run_travis_ci_image(command: str) -> str: CACHE_PANTS_RUN = { "before_cache": [ _cache_set_required_permissions, - # The `ivydata-*.properties` & root level `*.{properties,xml}` files' - # effect on resolution time is in the noise, but they are - # re-timestamped in internal comments and fields on each run and this - # leads to travis-ci cache thrash. Kill these files before the cache - # check to avoid un-needed cache re-packing and re-upload (a ~100s - # operation). - 'find ${HOME}/.ivy2/pants -type f -name "ivydata-*.properties" -delete', - "rm -f ${HOME}/.ivy2/pants/*.{css,properties,xml,xsl}", - # We have several tests that do local file:// url resolves for - # com.example artifacts, these disrupt the cache but are fast since - # they're resolved from local files when omitted from the cache. - "rm -rf ${HOME}/.ivy2/pants/com.example", # Render a summary to assist with further tuning the cache. "du -m -d2 ${HOME}/.cache/pants | sort -r -n", "./build-support/bin/prune_travis_cache.sh", ], "cache": { "timeout": _cache_timeout, - "directories": _cache_common_directories - + [ - "${HOME}/.cache/pants/tools", - "${HOME}/.cache/pants/zinc", - "${HOME}/.ivy2/pants", - # TODO(John Sirois): Update this to ~/.npm/pants when pants starts using its own isolated - # cache: https://github.com/pantsbuild/pants/issues/2485 - "${HOME}/.npm", - ], + "directories": _cache_common_directories, }, } @@ -283,31 +259,32 @@ def __str__(self) -> str: def _linux_before_install( - include_test_config: bool = True, install_travis_wait: bool = False + include_test_config: bool = True, install_travis_wait: bool = False, *, xenial: bool = False ) -> List[str]: commands = [ "./build-support/bin/install_aws_cli_for_ci.sh", + # These are pre-installed through Travis, but we must still activate them. # TODO(John Sirois): Get rid of this in favor of explicitly adding pyenv versions to the PATH: # https://github.com/pantsbuild/pants/issues/7601 - "pyenv global 2.7.15 3.6.7 3.7.1", + ( + "pyenv global 2.7.17 3.6.10 3.7.6 3.8.1" + if not xenial + else "pyenv global 2.7.15 3.6.7 3.7.1" + ), ] if install_travis_wait: commands.extend( [ ( - 'wget -qO- "https://github.com/crazy-max/travis-wait-enhanced/releases/download/v0.2.1/travis-wait-enhanced_0.2' - '.1_linux_x86_64.tar.gz" | tar -zxvf - travis-wait-enhanced' + 'wget -qO- "https://github.com/crazy-max/travis-wait-enhanced/releases/download/' + 'v0.2.1/travis-wait-enhanced_0.2.1_linux_x86_64.tar.gz" | tar -zxvf - ' + "travis-wait-enhanced" ), "mv travis-wait-enhanced /home/travis/bin/", ] ) - if include_test_config: - return [ - 'PATH="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin":$PATH', - "JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64", - "sudo sysctl fs.inotify.max_user_watches=524288", - ] + commands + return ["sudo sysctl fs.inotify.max_user_watches=524288", *commands] return commands @@ -322,8 +299,7 @@ def linux_shard( raise ValueError("Must provide the Python version if using a test config.") setup = { "os": "linux", - "dist": "xenial", - "sudo": "required", + "dist": "bionic", "python": ["2.7", "3.6", "3.7"], "addons": { "apt": { @@ -351,10 +327,7 @@ def linux_shard( } if load_test_config: setup["before_script"] = [AWS_GET_PANTS_PEX_COMMAND] - setup["env"] = [ - f"BOOTSTRAPPED_PEX_KEY_SUFFIX=py{python_version.number}.linux", - "PANTS_REMOTE_CA_CERTS_PATH=/usr/lib/google-cloud-sdk/lib/third_party/grpc/_cython/_credentials/roots.pem", - ] + setup["env"] = [f"BOOTSTRAPPED_PEX_KEY_SUFFIX=py{python_version.number}.linux"] setup = {**setup, **CACHE_PANTS_RUN} if use_docker: setup["services"] = ["docker"] @@ -366,8 +339,8 @@ def linux_fuse_shard() -> Dict: "os": "linux", "dist": "xenial", "sudo": "required", - "before_install": _linux_before_install() - + [ + "before_install": [ + *_linux_before_install(xenial=True), "sudo apt-get install -y pkg-config fuse libfuse-dev", "sudo modprobe fuse", "sudo chmod 666 /dev/fuse", @@ -380,10 +353,10 @@ def _osx_before_install( python_versions: Iterable[PythonVersion], *, install_py27: bool = True ) -> List[str]: versions_to_install = " ".join( - f"${{PYENV_PY{python_version.number}_VERSION}}" for python_version in python_versions + f"${{MACOS_PYENV_PY{python_version.number}_VERSION}}" for python_version in python_versions ) if install_py27: - versions_to_install = f"${{PYENV_PY27_VERSION}} {versions_to_install}" + versions_to_install = f"${{MACOS_PYENV_PY27_VERSION}} {versions_to_install}" return [ "curl -L https://github.com/stedolan/jq/releases/download/jq-1.5/jq-osx-amd64 -o /usr/local/bin/jq", "chmod 755 /usr/local/bin/jq", @@ -403,10 +376,10 @@ def _osx_env() -> List[str]: def _osx_env_with_pyenv() -> List[str]: return [ *_osx_env(), - 'PATH="${PYENV_ROOT}/versions/${PYENV_PY27_VERSION}/bin:${PATH}"', - 'PATH="${PYENV_ROOT}/versions/${PYENV_PY36_VERSION}/bin:${PATH}"', - 'PATH="${PYENV_ROOT}/versions/${PYENV_PY37_VERSION}/bin:${PATH}"', - 'PATH="${PYENV_ROOT}/versions/${PYENV_PY38_VERSION}/bin:${PATH}"', + 'PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY27_VERSION}/bin:${PATH}"', + 'PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY36_VERSION}/bin:${PATH}"', + 'PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY37_VERSION}/bin:${PATH}"', + 'PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY38_VERSION}/bin:${PATH}"', ] @@ -483,7 +456,7 @@ def bootstrap_osx(python_version: PythonVersion) -> Dict: # We use 10.11 as a minimum to avoid https://github.com/rust-lang/regex/issues/489. # See: https://docs.travis-ci.com/user/reference/osx/#OS-X-Version **osx_shard(load_test_config=False, python_version=python_version, osx_image="xcode8"), - "name": f"Build OSX native engine and pants.pex (Python {python_version.decimal})", + "name": f"Build macOS native engine and pants.pex (Python {python_version.decimal})", "after_failure": ["./build-support/bin/ci-failure.sh"], "stage": python_version.default_stage(is_bootstrap=True).value, "script": [_bootstrap_command(python_version=python_version)], @@ -656,7 +629,7 @@ def rust_tests_osx() -> Dict: # See https://gist.github.com/stuhood/856a9b09bbaa86141f36c9925c14fae7 "osx_image": "xcode8", "before_install": [ - './build-support/bin/install_python_for_ci.sh "${PYENV_PY36_VERSION}"', + './build-support/bin/install_python_for_ci.sh "${MACOS_PYENV_PY36_VERSION}"', # We don't use the standard travis "addons" section here because it will either silently # fail (on older images) or cause a multi-minute `brew update` (on newer images), neither of # which we want. This doesn't happen if we just manually run `brew cask install`. @@ -680,7 +653,7 @@ def rust_tests_osx() -> Dict: def osx_platform_tests(python_version: PythonVersion) -> Dict: shard = { **osx_shard(python_version=python_version), - "name": f"OSX platform-specific tests (Python {python_version.decimal})", + "name": f"macOS platform-specific tests (Python {python_version.decimal})", "script": [ f"./build-support/bin/ci.py --platform-specific-tests --python-version {python_version.decimal}" ], @@ -699,7 +672,7 @@ def _osx_smoke_test( ) -> Dict: shard = { **osx_shard(python_version=python_version, osx_image=osx_image), - "name": f"OSX 10.{os_version_number} smoke test (Python {python_version.decimal})", + "name": f"macOS 10.{os_version_number} smoke test (Python {python_version.decimal})", "script": [ f"MODE=debug ./build-support/bin/ci.py --smoke-tests --python-version {python_version.decimal}" ], diff --git a/src/python/pants/engine/process_test.py b/src/python/pants/engine/process_test.py index 068392f380b..0ca4fcd1004 100644 --- a/src/python/pants/engine/process_test.py +++ b/src/python/pants/engine/process_test.py @@ -3,7 +3,6 @@ import os from dataclasses import dataclass -from typing import ClassVar, Tuple import pytest @@ -23,7 +22,6 @@ FallibleProcessResult, InteractiveProcess, Process, - ProcessExecutionFailure, ProcessResult, ) from pants.engine.rules import Get, rule @@ -110,116 +108,6 @@ def cat_stdout_rules(): return [cat_files_process_result_concatted, QueryRule(Concatted, (CatExecutionRequest,))] -@dataclass(frozen=True) -class JavacVersionExecutionRequest: - binary_location: BinaryLocation - description: ClassVar[str] = "obtaining javac version" - - @property - def bin_path(self): - return self.binary_location.bin_path - - def gen_argv(self): - return ( - self.bin_path, - "-version", - ) - - -@dataclass(frozen=True) -class JavacVersionOutput: - value: str - - -@rule -async def get_javac_version_output( - javac_version_command: JavacVersionExecutionRequest, -) -> JavacVersionOutput: - javac_version_proc_req = Process( - argv=javac_version_command.gen_argv(), description=javac_version_command.description - ) - javac_version_proc_result = await Get( - ProcessResult, - Process, - javac_version_proc_req, - ) - - return JavacVersionOutput(javac_version_proc_result.stderr.decode()) - - -@dataclass(frozen=True) -class JavacSources: - """Wrapper for the paths to include for Java source files. - - This shows an example of making a custom type to wrap generic types such as str to add usage - context. - - See CatExecutionRequest and rules above for an example of using PathGlobs - which does not introduce this additional layer of indirection. - """ - - java_files: Tuple[str, ...] - - -@dataclass(frozen=True) -class JavacCompileRequest: - binary_location: BinaryLocation - javac_sources: JavacSources - - @property - def bin_path(self): - return self.binary_location.bin_path - - def argv_from_source_snapshot(self, snapshot): - return (self.bin_path,) + snapshot.files - - -@dataclass(frozen=True) -class JavacCompileResult: - stdout: str - stderr: str - digest: Digest - - -# Note that this rule assumes that no additional classes are generated other than one for each -# source file, i.e. that there are no inner classes, extras generated by annotation processors, etc. -# This rule just serves as documentation for how rules can look - it is not intended to be -# exhaustively correct java compilation. -# This rule/test should be deleted when we have more real java rules (or anything else which serves -# as a suitable rule-writing example). -@rule -async def javac_compile_process_result( - javac_compile_req: JavacCompileRequest, -) -> JavacCompileResult: - java_files = javac_compile_req.javac_sources.java_files - for java_file in java_files: - if not java_file.endswith(".java"): - raise ValueError(f"Can only compile .java files but got {java_file}") - sources_snapshot = await Get(Snapshot, PathGlobs, PathGlobs(java_files)) - output_dirs = tuple({os.path.dirname(java_file) for java_file in java_files}) - process = Process( - argv=javac_compile_req.argv_from_source_snapshot(sources_snapshot), - input_digest=sources_snapshot.digest, - output_directories=output_dirs, - description="javac compilation", - ) - javac_proc_result = await Get(ProcessResult, Process, process) - - return JavacCompileResult( - javac_proc_result.stdout.decode(), - javac_proc_result.stderr.decode(), - javac_proc_result.output_digest, - ) - - -def javac_compile_rules(): - return [ - javac_compile_process_result, - QueryRule(JavacVersionOutput, (JavacVersionExecutionRequest,)), - QueryRule(JavacCompileResult, (JavacCompileRequest,)), - ] - - class TestInputFileCreation(TestBase): @classmethod def rules(cls): @@ -325,9 +213,7 @@ class ProcessTest(TestBase): def rules(cls): return ( *super().rules(), - get_javac_version_output, *cat_stdout_rules(), - *javac_compile_rules(), QueryRule(ProcessResult, (Process,)), QueryRule(FallibleProcessResult, (Process,)), ) @@ -337,7 +223,6 @@ def test_env(self): assert dict(req.env) == {"VAR": "VAL"} def test_integration_concat_with_snapshots_stdout(self): - self.create_file("f1", "one\n") self.create_file("f2", "two\n") @@ -349,11 +234,6 @@ def test_integration_concat_with_snapshots_stdout(self): concatted = self.request(Concatted, [cat_exe_req]) self.assertEqual(Concatted("one\ntwo\n"), concatted) - def test_javac_version_example(self): - request = JavacVersionExecutionRequest(BinaryLocation("/usr/bin/javac")) - result = self.request(JavacVersionOutput, [request]) - self.assertIn("javac", result.value) - def test_write_file(self): request = Process( argv=("/bin/bash", "-c", "echo -n 'European Burmese' > roland"), @@ -387,62 +267,6 @@ def test_timeout(self): self.assertIn(b"Exceeded timeout", result.stdout) self.assertIn(b"sleepy-cat", result.stdout) - def test_javac_compilation_example_success(self): - self.create_dir("simple") - self.create_file( - "simple/Simple.java", - """package simple; -// Valid java. Totally complies. -class Simple { - -}""", - ) - - request = JavacCompileRequest( - BinaryLocation("/usr/bin/javac"), - JavacSources(("simple/Simple.java",)), - ) - result = self.request(JavacCompileResult, [request]) - digest_contents = self.request(DigestContents, [result.digest]) - assert sorted(["simple/Simple.java", "simple/Simple.class"]) == sorted( - file.path for file in digest_contents - ) - assert len(digest_contents[0].content) > 0 - - def test_javac_compilation_example_failure(self): - self.create_dir("simple") - self.create_file( - "simple/Broken.java", - """package simple; -class Broken { - NOT VALID JAVA! -}""", - ) - - request = JavacCompileRequest( - BinaryLocation("/usr/bin/javac"), JavacSources(("simple/Broken.java",)) - ) - - with self.assertRaises(ExecutionError) as cm: - self.request(JavacCompileResult, [request]) - e = cm.exception.wrapped_exceptions[0] - self.assertIsInstance(e, ProcessExecutionFailure) - self.assertEqual(1, e.exit_code) - self.assertIn("javac compilation", str(e)) - self.assertIn(b"NOT VALID JAVA", e.stderr) - - def test_jdk(self): - with temporary_dir() as temp_dir: - with open(os.path.join(temp_dir, "roland"), "w") as f: - f.write("European Burmese") - request = Process( - argv=("/bin/cat", ".jdk/roland"), - description="cat JDK roland", - jdk_home=temp_dir, - ) - result = self.request(ProcessResult, [request]) - self.assertEqual(result.stdout, b"European Burmese") - def test_fallible_failing_command_returns_exited_result(self): request = Process(argv=("/bin/bash", "-c", "exit 1"), description="one-cat") diff --git a/tests/python/pants_test/pantsd/BUILD b/tests/python/pants_test/pantsd/BUILD index a0063fe3e02..f6dc43456f5 100644 --- a/tests/python/pants_test/pantsd/BUILD +++ b/tests/python/pants_test/pantsd/BUILD @@ -19,5 +19,5 @@ python_integration_tests( 'testprojects/src/python:print_env_directory', ], uses_pants_run=True, - timeout = 1800 + timeout = 2100 )