From 907550fbdb5edd4d6a8002c5a6f425f3b2c0fb6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Fri, 3 Jan 2025 14:12:03 +0100 Subject: [PATCH] ci: use a venv instead of system-wide installs --- .github/workflows/ci.yml | 7 +++++-- scripts/test_linux.sh | 1 - scripts/test_macos.sh | 2 ++ scripts/test_solc.sh | 2 ++ scripts/test_solc_upgrade.sh | 7 ++++--- scripts/test_windows.sh | 2 ++ 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8189d6..3b57547 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,15 +29,18 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 + id: python with: python-version: ${{ matrix.python }} - name: Install solc-select run: | - ${{ (matrix.os != 'windows-2022' && 'sudo pip install .') || 'pip install . --user' }} - solc-select install all + ${{ steps.python.outputs.python-path }} -m venv test-venv + source test-venv/bin/activate + pip3 install . - name: Run Tests env: TEST_TYPE: ${{ (matrix.type != 'os_specific' && matrix.type) || runner.os }} run: | + source test-venv/bin/activate TEST_TYPE="$(echo "$TEST_TYPE" | tr '[:upper:]' '[:lower:]')" bash scripts/test_${TEST_TYPE}.sh diff --git a/scripts/test_linux.sh b/scripts/test_linux.sh index 6564bf1..d47e1bb 100644 --- a/scripts/test_linux.sh +++ b/scripts/test_linux.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash set -euo pipefail -sudo pip3 install . solc-select install all use_version=$(solc-select use 0.4.0) diff --git a/scripts/test_macos.sh b/scripts/test_macos.sh index 232605e..7edde9f 100644 --- a/scripts/test_macos.sh +++ b/scripts/test_macos.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash set -euo pipefail +solc-select install all + use_version=$(solc-select use 0.3.6) if [[ $use_version != "Switched global version to 0.3.6"* ]]; then echo "OS X FAILED: set minimum version" diff --git a/scripts/test_solc.sh b/scripts/test_solc.sh index 6e328cd..6bacea9 100644 --- a/scripts/test_solc.sh +++ b/scripts/test_solc.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash set -euo pipefail +solc-select install 0.4.5 0.5.0 0.6.0 0.7.0 0.8.0 0.8.1 0.8.9 + ## solc 0.4.5 ## solc-select use 0.4.5 &> /dev/null solc ./scripts/solidity_tests/solc045_success.sol diff --git a/scripts/test_solc_upgrade.sh b/scripts/test_solc_upgrade.sh index de504d0..387a03b 100644 --- a/scripts/test_solc_upgrade.sh +++ b/scripts/test_solc_upgrade.sh @@ -2,15 +2,16 @@ set -euo pipefail ### Install old version of solc -sudo pip3 uninstall --yes solc-select -sudo pip3 install solc-select +pip3 uninstall --yes solc-select +pip3 install solc-select solc-select use 0.8.0 --always-install old_solc_version=$(solc --version) solc-select install 0.4.11 0.5.0 0.6.12 0.7.3 0.8.3 all_old_versions=$(solc-select versions | sort) ### Install new version of solc -sudo pip3 install -e . +pip3 uninstall --yes solc-select +pip3 install -e . new_solc_version=$(solc --version) all_new_versions=$(solc-select versions | sort) diff --git a/scripts/test_windows.sh b/scripts/test_windows.sh index acc284b..51097c6 100644 --- a/scripts/test_windows.sh +++ b/scripts/test_windows.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash set -euo pipefail +solc-select install all + use_version=$(solc-select use 0.4.5) if [[ $use_version != "Switched global version to 0.4.5"* ]]; then echo "WINDOWS FAILED: minimum version"