From 458dc814c241066323858182e55d2186d396c09d Mon Sep 17 00:00:00 2001 From: Scott Talbert Date: Wed, 17 Aug 2022 15:15:42 -0400 Subject: [PATCH] CI: fix/simplify httpbin use by standardizing Python version Now that we don't use Travis CI any longer (and don't use httpbin on the other CI providers yet), we can make our life much simpler by just using Python 3.10 on all platforms instead of trying to find version-specific workarounds for various python/pip/httpbin incompatibilities. Closes #22726. --- .github/workflows/ci.yml | 5 +++ .github/workflows/ci_cmake.yml | 5 +++ .github/workflows/ci_mac.yml | 7 ++++ build/tools/httpbin.sh | 67 ++-------------------------------- 4 files changed, 21 insertions(+), 63 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab8bf3804f..dde8d63dd3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -222,6 +222,11 @@ jobs: make $wxBUILD_ARGS failtest make -k $wxBUILD_ARGS "CXXFLAGS=$wxMAKEFILE_CXXFLAGS" "LDFLAGS=$wxMAKEFILE_LDFLAGS" + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Testing working-directory: tests run: | diff --git a/.github/workflows/ci_cmake.yml b/.github/workflows/ci_cmake.yml index 1e5d5a43ce..7b269b52f6 100644 --- a/.github/workflows/ci_cmake.yml +++ b/.github/workflows/ci_cmake.yml @@ -142,6 +142,11 @@ jobs: cmake --build . --target install fi + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Testing if: matrix.cmake_tests != 'OFF' working-directory: build_cmake diff --git a/.github/workflows/ci_mac.yml b/.github/workflows/ci_mac.yml index 3f4ce3ce6c..677ba108b2 100644 --- a/.github/workflows/ci_mac.yml +++ b/.github/workflows/ci_mac.yml @@ -201,6 +201,13 @@ jobs: make -C tests $wxBUILD_ARGS failtest make -k -C tests $wxBUILD_ARGS "CXXFLAGS=$wxMAKEFILE_CXXFLAGS" "LDFLAGS=$wxMAKEFILE_LDFLAGS" + - name: Setup Python + # actions/setup-python broken on self-hosted https://github.com/actions/setup-python/issues/108 + if: matrix.runner != 'self-hosted' + uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Testing if: matrix.skip_testing != true working-directory: tests diff --git a/build/tools/httpbin.sh b/build/tools/httpbin.sh index 608cae87cd..dc75fd61b7 100644 --- a/build/tools/httpbin.sh +++ b/build/tools/httpbin.sh @@ -6,71 +6,12 @@ httpbin_launch() { WX_TEST_WEBREQUEST_URL=0 export WX_TEST_WEBREQUEST_URL - # We need python3 for httpbin, python2 can't be used any longer. - if ! command -v python3 > /dev/null; then - echo 'Python 3 is not available, not using httpbin.' - return - fi - echo 'Launching httpbin...' - case "$(uname -s)" in - Linux) - if command -v lsb_release > /dev/null; then - dist_codename=$(lsb_release --codename --short) - fi - ;; - - Darwin) - dist_codename='macOS' - ;; - esac - - case "$dist_codename" in - trusty) - # Explicitly select the versions of dependencies that are still - # compatible with Python 3.4 used here as the latest versions of - # several of them are not. - pip_explicit_deps='Flask==1.0.4 Jinja2==2.10.3 MarkupSafe==1.1.1 - blinker==1.4 brotlipy==0.7.0 cffi==1.14.5 click==7.0 decorator==4.4.2 - itsdangerous==1.1.0 pycparser==2.20 raven==6.10.0 werkzeug==0.16.1' - ;; - - *) - # Installing Flask 2.1.0 and its dependency Werkzeug 2.1.0 results - # in failures when trying to run httpbin, so stick to an older but - # working version. - pip_explicit_deps='Flask==2.0.3 Werkzeug==2.0.3' - esac - - # Ensure that we have at least some version of pip and setuptools required - # for installing cffi. - if ! python3 -c 'import setuptools'; then - sudo apt-get -q -o=Dpkg::Use-Pty=0 install python3-setuptools - fi - - if ! python3 -c 'import pip'; then - sudo apt-get -q -o=Dpkg::Use-Pty=0 install python3-pip - fi - - # Running pip install fails with weird errors out of the box when - # using old pip version because it attempts to use python rather - # than python3, so upgrade it to fix this. - # - # However don't upgrade to a version which is too new because then - # it may not support Python version that we actually have (this one - # still works with 3.4, 20.0.1 is the last one to support 3.5). - case "$dist_codename" in - jammy) - # pip is newer than 19.1 already, don't "upgrade" it. - ;; - - *) - python3 -m pip install --user --upgrade pip==19.1.1 - python3 -m pip install --user wheel - esac - - echo "Installing using `python3 -m pip --version`" + # Installing Flask 2.1.0 and its dependency Werkzeug 2.1.0 results + # in failures when trying to run httpbin, so stick to an older but + # working version. + pip_explicit_deps='Flask==2.0.3 Werkzeug==2.0.3' python3 -m pip install $pip_explicit_deps httpbin --user python3 -m httpbin.core --port 50500 2>&1 >httpbin.log &