From 090a9f09066f2c29151b5920eec65768add38ebb Mon Sep 17 00:00:00 2001 From: lepapareil Date: Mon, 30 Dec 2024 14:34:47 +0100 Subject: [PATCH] Windows ci uses python venv --- .github/workflows/check.yml | 2 +- .github/workflows/package.yml | 41 +++++++------- .github/workflows/test.yml | 56 +++++++++++-------- bin/activate_python3_venv.ps1 | 9 +++ ...thon3_venv.sh => activate_python3_venv.sh} | 2 +- bin/environment.ps1 | 6 +- bin/environment.sh | 8 ++- contrib/cross_compile/README.md | 2 +- 8 files changed, 78 insertions(+), 48 deletions(-) create mode 100644 bin/activate_python3_venv.ps1 rename bin/{install_python3_venv.sh => activate_python3_venv.sh} (82%) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index e36baedb899..3fdff82d601 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -52,7 +52,7 @@ jobs: - name: Install prerequisites if: always() run: | - bin/install_python3_venv.sh + bin/activate_python3_venv.sh export PATH="/tmp/hurl-python3-venv/bin:$PATH" echo "PATH=$PATH" >> $GITHUB_ENV which python3 diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index f013769a049..112278e96d3 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -28,9 +28,9 @@ jobs: uses: actions/setup-python@v5.3.0 with: python-version: '3.11' - - name: Install python3 venv + - name: Activate python3 venv run: | - bin/install_python3_venv.sh + bin/activate_python3_venv.sh export PATH="/tmp/hurl-python3-venv/bin:$PATH" echo "PATH=$PATH" >> $GITHUB_ENV which python3 @@ -131,7 +131,7 @@ jobs: echo "::endgroup::" echo "::group::Install python 3.11" bin/install_pythonx_for_ubuntu.sh 11 - bin/install_python3_venv.sh + bin/activate_python3_venv.sh export PATH=/tmp/hurl-python3-venv/bin:$PATH echo "::endgroup::" echo "::group::Install Rust" @@ -182,8 +182,8 @@ jobs: echo "::group::Install system prerequisites" bin/install_prerequisites_debian.sh echo "::endgroup::" - echo "::group::Install python3 venv" - bin/install_python3_venv.sh + echo "::group::Activate python3 venv" + bin/activate_python3_venv.sh export PATH=/tmp/hurl-python3-venv/bin:$PATH which python3 python3 --version @@ -233,8 +233,8 @@ jobs: echo "::group::Install system prerequisites" bin/install_prerequisites_archlinux.sh echo "::endgroup::" - echo "::group::Install python3 venv" - bin/install_python3_venv.sh + echo "::group::Activate python3 venv" + bin/activate_python3_venv.sh export PATH=/tmp/hurl-python3-venv/bin:$PATH which python3 python3 --version @@ -287,8 +287,8 @@ jobs: echo "::group::Install system prerequisites" bin/install_prerequisites_fedora.sh echo "::endgroup::" - echo "::group::Install python3 venv" - bin/install_python3_venv.sh + echo "::group::Activate python3 venv" + bin/activate_python3_venv.sh export PATH=/tmp/hurl-python3-venv/bin:$PATH which python3 python3 --version @@ -361,7 +361,7 @@ jobs: bash bin/install_prerequisites_alpine.sh echo "::endgroup::" echo "::group::Install tests prerequisites" - bash bin/install_python3_venv.sh + bash bin/activate_python3_venv.sh export PATH=/tmp/hurl-python3-venv/bin:$PATH which python3 python3 --version @@ -399,9 +399,9 @@ jobs: uses: actions/setup-python@v5.3.0 with: python-version: '3.11' - - name: Install python3 venv + - name: Activate python3 venv run: | - bin/install_python3_venv.sh + bin/activate_python3_venv.sh export PATH="/tmp/hurl-python3-venv/bin:$PATH" echo "PATH=$PATH" >> $GITHUB_ENV which python3 @@ -448,9 +448,9 @@ jobs: run: | bin/install_prerequisites_macos.sh echo "PATH=$PATH" >> $GITHUB_ENV - - name: Install python3 venv + - name: Activate python3 venv run: | - bin/install_python3_venv.sh + bin/activate_python3_venv.sh export PATH="/tmp/hurl-python3-venv/bin:$PATH" echo "PATH=$PATH" >> $GITHUB_ENV which python3 @@ -497,9 +497,9 @@ jobs: run: | bin/install_prerequisites_macos.sh echo "PATH=$PATH" >> $GITHUB_ENV - - name: Install python3 venv + - name: Activate python3 venv run: | - bin/install_python3_venv.sh + bin/activate_python3_venv.sh export PATH="/tmp/hurl-python3-venv/bin:$PATH" echo "PATH=$PATH" >> $GITHUB_ENV which python3 @@ -563,14 +563,16 @@ jobs: with: python-version: '3.11' - name: Environment - run: .\bin\environment.ps1 - - name: Build run: | - .\bin\release\release.ps1 + .\bin\activate_python3_venv.ps1 + .\bin\environment.ps1 + - name: Build + run: .\bin\release\release.ps1 - name: Create windows64 Zip package run: .\bin\release\create_windows64_zip_package.ps1 - name: Install win64 zip and test integ run: | + .\bin\activate_python3_venv.ps1 .\bin\release\install_windows64_zip_package.ps1 .\bin\test\test_prerequisites.ps1 .\bin\test\test_integ.ps1 @@ -578,6 +580,7 @@ jobs: run: .\bin\release\create_windows64_installer.ps1 - name: Install win64 installer and test integ run: | + .\bin\activate_python3_venv.ps1 .\bin\release\install_windows64_installer.ps1 .\bin\test\test_prerequisites.ps1 .\bin\test\test_integ.ps1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8065c4dfcf6..3fc3adfa692 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,9 +28,9 @@ jobs: uses: actions/setup-python@v5.3.0 with: python-version: '3.11' - - name: Install python3 venv + - name: Activate python3 venv run: | - bin/install_python3_venv.sh + bin/activate_python3_venv.sh export PATH="/tmp/hurl-python3-venv/bin:$PATH" - name: Install Rust run: bin/install_rust.sh @@ -82,9 +82,9 @@ jobs: uses: actions/setup-python@v5.3.0 with: python-version: '3.11' - - name: Install python3 venv + - name: Activate python3 venv run: | - bin/install_python3_venv.sh + bin/activate_python3_venv.sh export PATH="/tmp/hurl-python3-venv/bin:$PATH" echo "PATH=$PATH" >> $GITHUB_ENV - name: Install Rust @@ -126,9 +126,9 @@ jobs: uses: actions/setup-python@v5.3.0 with: python-version: '3.11' - - name: Install python3 venv + - name: Activate python3 venv run: | - bin/install_python3_venv.sh + bin/activate_python3_venv.sh export PATH="/tmp/hurl-python3-venv/bin:$PATH" echo "PATH=$PATH" >> $GITHUB_ENV - name: Install Rust @@ -171,8 +171,8 @@ jobs: echo "::group::Install Prerequisites" bin/install_prerequisites_archlinux.sh echo "::endgroup::" - echo "::group::Install python3 venv" - bin/install_python3_venv.sh + echo "::group::Activate python3 venv" + bin/activate_python3_venv.sh export PATH=/tmp/hurl-python3-venv/bin:$PATH which python3 python3 --version @@ -215,8 +215,8 @@ jobs: echo "::group::Install Prerequisites" bin/install_prerequisites_fedora.sh echo "::endgroup::" - echo "::group::Install python3 venv" - bin/install_python3_venv.sh + echo "::group::Activate python3 venv" + bin/activate_python3_venv.sh export PATH=/tmp/hurl-python3-venv/bin:$PATH which python3 python3 --version @@ -262,8 +262,8 @@ jobs: echo "::group::Install Prerequisites" bin/install_prerequisites_alpine.sh echo "::endgroup::" - echo "::group::Install python3 venv" - bin/install_python3_venv.sh + echo "::group::Activate python3 venv" + bin/activate_python3_venv.sh export PATH=/tmp/hurl-python3-venv/bin:$PATH which python3 python3 --version @@ -304,9 +304,9 @@ jobs: run: | bin/install_prerequisites_macos.sh echo "PATH=$PATH" >> $GITHUB_ENV - - name: Install python3 venv + - name: Activate python3 venv run: | - bin/install_python3_venv.sh + bin/activate_python3_venv.sh export PATH="/tmp/hurl-python3-venv/bin:$PATH" echo "PATH=$PATH" >> $GITHUB_ENV which python3 @@ -352,9 +352,9 @@ jobs: run: | bin/install_prerequisites_macos.sh echo "PATH=$PATH" >> $GITHUB_ENV - - name: Install python3 venv + - name: Activate python3 venv run: | - bin/install_python3_venv.sh + bin/activate_python3_venv.sh export PATH="/tmp/hurl-python3-venv/bin:$PATH" echo "PATH=$PATH" >> $GITHUB_ENV which python3 @@ -403,8 +403,7 @@ jobs: with: ref: ${{ inputs.branch }} - name: Install Rust - run: | - .\bin\install_rust.ps1 + run: .\bin\install_rust.ps1 - name: Manage vcpkg cache uses: actions/cache@v4.2.0 with: @@ -416,10 +415,21 @@ jobs: uses: actions/setup-python@v5.3.0 with: python-version: '3.11' - - name: Environment - run: .\bin\environment.ps1 - - name: Build and test - run: .\bin\test\test.ps1 + - name: Build, Test units and Integration tests + run: | + # Build, Test units and Integration tests + echo "::group::Install prerequisites" + .\bin\install_prerequisites_windows.ps1 + echo "::endgroup::" + echo "::group::Activate python3 venv" + .\bin\activate_python3_venv.ps1 + echo "::endgroup::" + echo "::group::Environment" + .\bin\environment.ps1 + echo "::endgroup::" + echo "::group::Tests" + .\bin\test\test.ps1 + echo "::endgroup::" - name: Archive production artifacts uses: actions/upload-artifact@v4.5.0 if: ${{ always() }} @@ -468,7 +478,7 @@ jobs: echo "::endgroup::" echo "::group::Install python 3.11" bin/install_pythonx_for_ubuntu.sh 11 - bin/install_python3_venv.sh + bin/activate_python3_venv.sh export PATH=/tmp/hurl-python3-venv/bin:$PATH echo "::endgroup::" echo "::group::Install tests integ prerequisistes" diff --git a/bin/activate_python3_venv.ps1 b/bin/activate_python3_venv.ps1 new file mode 100644 index 00000000000..c49d7f1e882 --- /dev/null +++ b/bin/activate_python3_venv.ps1 @@ -0,0 +1,9 @@ +Set-StrictMode -Version latest +$ErrorActionPreference = 'Stop' + +write-host -foregroundcolor Cyan "----- activate python venv -----" + +python -m venv "$env:TMP\venv" +. $env:TMP\venv\Scripts\activate.ps1 +python -m pip install --upgrade pip --quiet + diff --git a/bin/install_python3_venv.sh b/bin/activate_python3_venv.sh similarity index 82% rename from bin/install_python3_venv.sh rename to bin/activate_python3_venv.sh index 901d0c2ddb0..15a9c946114 100755 --- a/bin/install_python3_venv.sh +++ b/bin/activate_python3_venv.sh @@ -2,7 +2,7 @@ # shellcheck source=/dev/null set -Eeuo pipefail -echo "----- install python3 venv -----" +echo "----- activate python3 venv -----" python3 -m venv /tmp/hurl-python3-venv source /tmp/hurl-python3-venv/bin/activate python3 -m pip install --upgrade pip --quiet diff --git a/bin/environment.ps1 b/bin/environment.ps1 index 8011fcf56ee..ad2cf2a8786 100644 --- a/bin/environment.ps1 +++ b/bin/environment.ps1 @@ -15,10 +15,12 @@ vcpkg --version if ($LASTEXITCODE) { Throw } write-host "# python" -(Get-Command -Name python -CommandType Application).Source +Get-command python | Format-Table -Wrap -Autosize python -V if ($LASTEXITCODE) { Throw } -(Get-Command -Name pip -CommandType Application).Source + +write-host "# pip" +Get-command pip | Format-Table -Wrap -Autosize pip --version if ($LASTEXITCODE) { Throw } diff --git a/bin/environment.sh b/bin/environment.sh index 28a80fab66e..d23a3e50d9e 100755 --- a/bin/environment.sh +++ b/bin/environment.sh @@ -13,10 +13,16 @@ echo "# python3" if command -V python3 ; then which python3 python3 -V +else + echo "No python3 installed" +fi + +echo "# pip" +if command -V pip ; then which pip pip --version else - echo "No python3 installed" + echo "No pip installed" fi echo "# curl" diff --git a/contrib/cross_compile/README.md b/contrib/cross_compile/README.md index 0fe70e04169..4c49f38c36c 100644 --- a/contrib/cross_compile/README.md +++ b/contrib/cross_compile/README.md @@ -74,7 +74,7 @@ bin/release/create_tarball.sh linux ``` bin/release/install_generic_linux_package.sh export PATH="/tmp/hurl-generic-linux:${PATH}" -bin/install_python3_venv.sh +bin/activate_python3_venv.sh export PATH=/tmp/hurl-python3-venv/bin:$PATH bin/test/test_prerequisites.sh bin/test/test_integ.sh