diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 9f13a85de7..73257e7a6f 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -58,20 +58,27 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Check full Python version + run: | + python --version + python_version=$(python --version 2>&1 | cut -d' ' -f2) + echo "Python version: $python_version" + echo "version=$python_version" >> $GITHUB_ENV + - name: Restore Python environment cache if: env.has_changes == 'true' id: restore-env uses: actions/cache/restore@v4 with: - path: .venv-${{ matrix.python-version }} - key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} + path: .venv-${{ env.version }} + key: ${{ runner.os }}-venv-${{ env.version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} - name: Set up virtual environment if not restored from cache if: steps.restore-env.outputs.cache-hit != 'true' && env.has_changes == 'true' run: | gh cache list - python -m venv .venv-${{ matrix.python-version }} - source .venv-${{ matrix.python-version }}/bin/activate + python -m venv .venv-${{ env.version }} + source .venv-${{ env.version }}/bin/activate python -m pip install --upgrade pip pip install -r devtools/dev-requirements.txt pip install matplotlib==3.9.2 @@ -79,7 +86,7 @@ jobs: - name: Benchmark with pytest-benchmark (PR) if: env.has_changes == 'true' run: | - source .venv-${{ matrix.python-version }}/bin/activate + source .venv-${{ env.version }}/bin/activate pwd lscpu pip list @@ -106,7 +113,7 @@ jobs: - name: Benchmark with pytest-benchmark (MASTER) if: env.has_changes == 'true' run: | - source .venv-${{ matrix.python-version }}/bin/activate + source .venv-${{ env.version }}/bin/activate pwd lscpu pip list @@ -122,7 +129,7 @@ jobs: - name: Put benchmark results in same folder if: env.has_changes == 'true' run: | - source .venv-${{ matrix.python-version }}/bin/activate + source .venv-${{ env.version }}/bin/activate pwd cd tests/benchmarks find .benchmarks/ -type f -printf "%T@ %p\n" | sort -n | cut -d' ' -f 2- | tail -n 1 > temp1 @@ -143,7 +150,7 @@ jobs: - name: Compare latest commit results to the master branch results if: env.has_changes == 'true' run: | - source .venv-${{ matrix.python-version }}/bin/activate + source .venv-${{ env.version }}/bin/activate cd tests/benchmarks pwd python compare_bench_results.py diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index ae0be3dbb7..70ee94290e 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -19,25 +19,32 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Check full Python version + run: | + python --version + python_version=$(python --version 2>&1 | cut -d' ' -f2) + echo "Python version: $python_version" + echo "version=$python_version" >> $GITHUB_ENV + - name: Restore Python environment cache id: restore-env uses: actions/cache/restore@v4 with: - path: .venv-${{ matrix.python-version }} - key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} + path: .venv-${{ env.version }} + key: ${{ runner.os }}-venv-${{ env.version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} - name: Set up virtual environment if not restored from cache if: steps.restore-env.outputs.cache-hit != 'true' run: | gh cache list - python -m venv .venv-${{ matrix.python-version }} - source .venv-${{ matrix.python-version }}/bin/activate + python -m venv .venv-${{ env.version }} + source .venv-${{ env.version }}/bin/activate python -m pip install --upgrade pip pip install -r devtools/dev-requirements.txt - name: Check files using the black formatter run: | - source .venv-${{ matrix.python-version }}/bin/activate + source .venv-${{ env.version }}/bin/activate black --version black --check desc/ tests/ || black_return_code=$? echo "BLACK_RETURN_CODE=$black_return_code" >> $GITHUB_ENV diff --git a/.github/workflows/cache_dependencies.yml b/.github/workflows/cache_dependencies.yml index dd648d78f4..8b8fdc9edb 100644 --- a/.github/workflows/cache_dependencies.yml +++ b/.github/workflows/cache_dependencies.yml @@ -24,12 +24,19 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Check full Python version + run: | + python --version + python_version=$(python --version 2>&1 | cut -d' ' -f2) + echo "Python version: $python_version" + echo "version=$python_version" >> $GITHUB_ENV + - name: Delete old cached file with same python version run: | echo "Current Cached files list" gh cache list - echo "Deleting cached files with pattern: ${{ runner.os }}-venv-${{ matrix.python-version }}-" - for cache_key in $(gh cache list --json key -q ".[] | select(.key | startswith(\"${{ runner.os }}-venv-${{ matrix.python-version }}-\")) | .key"); do + echo "Deleting cached files with pattern: ${{ runner.os }}-venv-${{ env.version }}-" + for cache_key in $(gh cache list --json key -q ".[] | select(.key | startswith(\"${{ runner.os }}-venv-${{ env.version }}-\")) | .key"); do echo "Deleting cache with key: $cache_key" gh cache delete "$cache_key" done @@ -37,8 +44,8 @@ jobs: # Update the matplotlib version if needed later - name: Set up virtual environment run: | - python -m venv .venv-${{ matrix.python-version }} - source .venv-${{ matrix.python-version }}/bin/activate + python -m venv .venv-${{ env.version }} + source .venv-${{ env.version }}/bin/activate python -m pip install --upgrade pip pip install -r devtools/dev-requirements.txt pip install matplotlib==3.9.2 @@ -47,12 +54,13 @@ jobs: id: cache-env uses: actions/cache@v4 with: - path: .venv-${{ matrix.python-version }} - key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} + path: .venv-${{ env.version }} + key: ${{ runner.os }}-venv-${{ env.version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} - name: Verify virtual environment activation run: | - source .venv-${{ matrix.python-version }}/bin/activate + source .venv-${{ env.version }}/bin/activate + which python python --version pip --version pip list diff --git a/.github/workflows/notebook_tests.yml b/.github/workflows/notebook_tests.yml index 1d1dc1473c..35613aae53 100644 --- a/.github/workflows/notebook_tests.yml +++ b/.github/workflows/notebook_tests.yml @@ -51,20 +51,27 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Check full Python version + run: | + python --version + python_version=$(python --version 2>&1 | cut -d' ' -f2) + echo "Python version: $python_version" + echo "version=$python_version" >> $GITHUB_ENV + - name: Restore Python environment cache if: env.has_changes == 'true' id: restore-env uses: actions/cache/restore@v4 with: - path: .venv-${{ matrix.python-version }} - key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} + path: .venv-${{ env.version }} + key: ${{ runner.os }}-venv-${{ env.version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} - name: Set up virtual environment if not restored from cache if: steps.restore-env.outputs.cache-hit != 'true' && env.has_changes == 'true' run: | gh cache list - python -m venv .venv-${{ matrix.python-version }} - source .venv-${{ matrix.python-version }}/bin/activate + python -m venv .venv-${{ env.version }} + source .venv-${{ env.version }}/bin/activate python -m pip install --upgrade pip pip install -r devtools/dev-requirements.txt pip install matplotlib==3.9.2 @@ -72,7 +79,7 @@ jobs: - name: Test notebooks with pytest and nbmake if: env.has_changes == 'true' run: | - source .venv-${{ matrix.python-version }}/bin/activate + source .venv-${{ env.version }}/bin/activate pwd lscpu pip list diff --git a/.github/workflows/regression_tests.yml b/.github/workflows/regression_tests.yml index 9e648d3ec1..19122267c3 100644 --- a/.github/workflows/regression_tests.yml +++ b/.github/workflows/regression_tests.yml @@ -50,20 +50,27 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Check full Python version + run: | + python --version + python_version=$(python --version 2>&1 | cut -d' ' -f2) + echo "Python version: $python_version" + echo "version=$python_version" >> $GITHUB_ENV + - name: Restore Python environment cache if: env.has_changes == 'true' id: restore-env uses: actions/cache/restore@v4 with: - path: .venv-${{ matrix.python-version }} - key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} + path: .venv-${{ env.version }} + key: ${{ runner.os }}-venv-${{ env.version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} - name: Set up virtual environment if not restored from cache if: steps.restore-env.outputs.cache-hit != 'true' && env.has_changes == 'true' run: | gh cache list - python -m venv .venv-${{ matrix.python-version }} - source .venv-${{ matrix.python-version }}/bin/activate + python -m venv .venv-${{ env.version }} + source .venv-${{ env.version }}/bin/activate python -m pip install --upgrade pip pip install -r devtools/dev-requirements.txt pip install matplotlib==3.9.2 @@ -77,7 +84,7 @@ jobs: - name: Test with pytest if: env.has_changes == 'true' run: | - source .venv-${{ matrix.python-version }}/bin/activate + source .venv-${{ env.version }}/bin/activate pwd lscpu pip list diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 6e8ebc7a66..023e6503b3 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -56,20 +56,27 @@ jobs: with: python-version: ${{ matrix.combos.python_version }} + - name: Check full Python version + run: | + python --version + python_version=$(python --version 2>&1 | cut -d' ' -f2) + echo "Python version: $python_version" + echo "version=$python_version" >> $GITHUB_ENV + - name: Restore Python environment cache if: env.has_changes == 'true' id: restore-env uses: actions/cache/restore@v4 with: - path: .venv-${{ matrix.combos.python_version }} - key: ${{ runner.os }}-venv-${{ matrix.combos.python_version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} + path: .venv-${{ env.version }} + key: ${{ runner.os }}-venv-${{ env.version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} - name: Set up virtual environment if not restored from cache if: steps.restore-env.outputs.cache-hit != 'true' && env.has_changes == 'true' run: | gh cache list - python -m venv .venv-${{ matrix.combos.python_version }} - source .venv-${{ matrix.combos.python_version }}/bin/activate + python -m venv .venv-${{ env.version }} + source .venv-${{ env.version }}/bin/activate python -m pip install --upgrade pip pip install -r devtools/dev-requirements.txt pip install matplotlib==3.9.2 @@ -80,13 +87,20 @@ jobs: with: swap-size-gb: 10 - - name: Test with pytest + - name: Action Details if: env.has_changes == 'true' run: | - source .venv-${{ matrix.combos.python_version }}/bin/activate + source .venv-${{ env.version }}/bin/activate + which python + python --version pwd lscpu pip list + + - name: Test with pytest + if: env.has_changes == 'true' + run: | + source .venv-${{ env.version }}/bin/activate python -m pytest -v -m unit \ --durations=0 \ --cov-report xml:cov.xml \