Skip to content

Commit

Permalink
rename format
Browse files Browse the repository at this point in the history
  • Loading branch information
YigitElma committed Dec 12, 2024
1 parent 27ec9c7 commit caf8d33
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 35 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ jobs:
run: |
gh cache list
python -m venv .venv-${{ matrix.python-version }}
source .venv-${{ matrix.python-version | split('.')[1] }}/bin/activate
source .venv-${{ env.PYTHON_MINOR_VERSION }}/bin/activate
python -m pip install --upgrade pip
pip install -r devtools/dev-requirements.txt
pip install matplotlib==3.9.2
- name: Benchmark with pytest-benchmark (PR)
if: env.has_changes == 'true'
run: |
source .venv-${{ matrix.python-version | split('.')[1] }}/bin/activate
source .venv-${{ env.PYTHON_MINOR_VERSION }}/bin/activate
pwd
lscpu
pip list
Expand All @@ -106,7 +106,7 @@ jobs:
- name: Benchmark with pytest-benchmark (MASTER)
if: env.has_changes == 'true'
run: |
source .venv-${{ matrix.python-version | split('.')[1] }}/bin/activate
source .venv-${{ env.PYTHON_MINOR_VERSION }}/bin/activate
pwd
lscpu
pip list
Expand All @@ -122,7 +122,7 @@ jobs:
- name: Put benchmark results in same folder
if: env.has_changes == 'true'
run: |
source .venv-${{ matrix.python-version | split('.')[1] }}/bin/activate
source .venv-${{ env.PYTHON_MINOR_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
Expand All @@ -143,7 +143,7 @@ jobs:
- name: Compare latest commit results to the master branch results
if: env.has_changes == 'true'
run: |
source .venv-${{ matrix.python-version | split('.')[1] }}/bin/activate
source .venv-${{ env.PYTHON_MINOR_VERSION }}/bin/activate
cd tests/benchmarks
pwd
python compare_bench_results.py
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ jobs:
run: |
gh cache list
python -m venv .venv-${{ matrix.python-version }}
source .venv-${{ matrix.python-version | split('.')[1] }}/bin/activate
source .venv-${{ env.PYTHON_MINOR_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 | split('.')[1] }}/bin/activate
source .venv-${{ env.PYTHON_MINOR_VERSION }}/bin/activate
black --version
black --check desc/ tests/ || black_return_code=$?
echo "BLACK_RETURN_CODE=$black_return_code" >> $GITHUB_ENV
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/cache_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,25 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Extract Python Minor Version
id: extract_version
run: echo "PYTHON_MINOR_VERSION=$(echo '${{ matrix.python_version }}' | cut -d'.' -f2)" >> $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 | split('.')[1] }}-"
for cache_key in $(gh cache list --json key -q ".[] | select(.key | startswith(\"${{ runner.os }}-venv-${{ matrix.python-version | split('.')[1] }}-\")) | .key"); do
echo "Deleting cached files with pattern: ${{ runner.os }}-venv-${{ env.PYTHON_MINOR_VERSION }}-"
for cache_key in $(gh cache list --json key -q ".[] | select(.key | startswith(\"${{ runner.os }}-venv-${{ env.PYTHON_MINOR_VERSION }}-\")) | .key"); do
echo "Deleting cache with key: $cache_key"
gh cache delete "$cache_key"
done
# Update the matplotlib version if needed later
- name: Set up virtual environment
run: |
python -m venv .venv-${{ matrix.python-version | split('.')[1] }}
source .venv-${{ matrix.python-version | split('.')[1] }}/bin/activate
python -m venv .venv-${{ env.PYTHON_MINOR_VERSION }}
source .venv-${{ env.PYTHON_MINOR_VERSION }}/bin/activate
python -m pip install --upgrade pip
pip install -r devtools/dev-requirements.txt
pip install matplotlib==3.9.2
Expand All @@ -47,12 +51,12 @@ jobs:
id: cache-env
uses: actions/cache@v4
with:
path: .venv-${{ matrix.python-version | split('.')[1] }}
key: ${{ runner.os }}-venv-${{ matrix.python-version | split('.')[1] }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }}
path: .venv-${{ env.PYTHON_MINOR_VERSION }}
key: ${{ runner.os }}-venv-${{ env.PYTHON_MINOR_VERSION }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }}

- name: Verify virtual environment activation
run: |
source .venv-${{ matrix.python-version | split('.')[1] }}/bin/activate
source .venv-${{ env.PYTHON_MINOR_VERSION }}/bin/activate
python --version
pip --version
pip list
4 changes: 2 additions & 2 deletions .github/workflows/notebook_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ jobs:
run: |
gh cache list
python -m venv .venv-${{ matrix.python-version }}
source .venv-${{ matrix.python-version | split('.')[1] }}/bin/activate
source .venv-${{ env.PYTHON_MINOR_VERSION }}/bin/activate
python -m pip install --upgrade pip
pip install -r devtools/dev-requirements.txt
pip install matplotlib==3.9.2
- name: Test notebooks with pytest and nbmake
if: env.has_changes == 'true'
run: |
source .venv-${{ matrix.python-version | split('.')[1] }}/bin/activate
source .venv-${{ env.PYTHON_MINOR_VERSION }}/bin/activate
pwd
lscpu
pip list
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/regression_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,24 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Extract Python Minor Version
id: extract_version
run: echo "PYTHON_MINOR_VERSION=$(echo '${{ matrix.python_version }}' | cut -d'.' -f2)" >> $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 | split('.')[1] }}
key: ${{ runner.os }}-venv-${{ matrix.python-version | split('.')[1] }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }}
path: .venv-${{ env.PYTHON_MINOR_VERSION }}
key: ${{ runner.os }}-venv-${{ env.PYTHON_MINOR_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 | split('.')[1] }}
source .venv-${{ matrix.python-version | split('.')[1] }}/bin/activate
python -m venv .venv-${{ env.PYTHON_MINOR_VERSION }}
source .venv-${{ env.PYTHON_MINOR_VERSION }}/bin/activate
python -m pip install --upgrade pip
pip install -r devtools/dev-requirements.txt
pip install matplotlib==3.9.2
Expand All @@ -77,7 +81,7 @@ jobs:
- name: Test with pytest
if: env.has_changes == 'true'
run: |
source .venv-${{ matrix.python-version | split('.')[1] }}/bin/activate
source .venv-${{ env.PYTHON_MINOR_VERSION }}/bin/activate
pwd
lscpu
pip list
Expand Down
28 changes: 16 additions & 12 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,29 @@ jobs:
id: check_changes
run: echo "has_changes=${{ steps.changes.outputs.has_changes }}" >> $GITHUB_ENV

- name: Set up Python ${{ matrix.combos.python_version }}
- name: Set up Python ${{ env.PYTHON_MINOR_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.combos.python_version }}
python-version: ${{ env.PYTHON_MINOR_VERSION }}

- name: Extract Python Minor Version
id: extract_version
run: echo "PYTHON_MINOR_VERSION=$(echo '${{ env.PYTHON_MINOR_VERSION }}' | cut -d'.' -f2)" >> $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.PYTHON_MINOR_VERSION }}
key: ${{ runner.os }}-venv-${{ env.PYTHON_MINOR_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.PYTHON_MINOR_VERSION }}
source .venv-${{ env.PYTHON_MINOR_VERSION }}/bin/activate
python -m pip install --upgrade pip
pip install -r devtools/dev-requirements.txt
pip install matplotlib==3.9.2
Expand All @@ -84,25 +88,25 @@ jobs:
if: env.has_changes == 'true'
run: |
echo "Checking virtual environment directory"
ls -la .venv-${{ matrix.combos.python_version }}/bin
ls -la .venv-${{ env.PYTHON_MINOR_VERSION }}/bin
echo "Trying to activate virtual environment"
source .venv-${{ matrix.combos.python_version }}/bin/activate
source .venv-${{ env.PYTHON_MINOR_VERSION }}/bin/activate
which python
python --version
pwd
ls -a
ls -a .venv-${{ matrix.combos.python_version }}/bin
ls -a .venv-${{ env.PYTHON_MINOR_VERSION }}/bin
lscpu
source .venv-${{ matrix.combos.python_version }}/bin/activate
ls -a .venv-${{ matrix.combos.python_version }}/bin
source .venv-${{ env.PYTHON_MINOR_VERSION }}/bin/activate
ls -a .venv-${{ env.PYTHON_MINOR_VERSION }}/bin
python -m pip install --upgrade pip
pip install -r devtools/dev-requirements.txt
pip list
- name: Test with pytest
if: env.has_changes == 'true'
run: |
source .venv-${{ matrix.combos.python_version }}/bin/activate
source .venv-${{ env.PYTHON_MINOR_VERSION }}/bin/activate
python -m pytest -v -m unit \
--durations=0 \
--cov-report xml:cov.xml \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/weekly_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.combos.python_version }}
- name: Set up Python ${{ env.PYTHON_MINOR_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.combos.python_version }}
python-version: ${{ env.PYTHON_MINOR_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down

0 comments on commit caf8d33

Please sign in to comment.