Skip to content

Commit

Permalink
Merge branch 'yge/fix-unit' into yge/tr_direct
Browse files Browse the repository at this point in the history
  • Loading branch information
YigitElma committed Dec 12, 2024
2 parents 47719ca + 455a918 commit 2a6c99a
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 33 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/cache_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,35 @@ jobs:
GH_TOKEN: ${{ github.token }}
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
combos:
- {python_version: '3.9', venv_suffix: '9'}
- {python_version: '3.10', venv_suffix: '10'}
- {python_version: '3.11.11', venv_suffix: '11'}
- {python_version: '3.12.8', venv_suffix: '12'}

steps:
- uses: actions/checkout@v4

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

- 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-${{ matrix.combos.venv_suffix }}-"
for cache_key in $(gh cache list --json key -q ".[] | select(.key | startswith(\"${{ runner.os }}-venv-${{ matrix.combos.venv_suffix }}-\")) | .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 }}
source .venv-${{ matrix.python-version }}/bin/activate
python -m venv .venv-${{ matrix.combos.venv_suffix }}
source .venv-${{ matrix.combos.venv_suffix }}/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,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-${{ matrix.combos.venv_suffix }}
key: ${{ runner.os }}-venv-${{ matrix.combos.venv_suffix }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }}

- name: Verify virtual environment activation
run: |
source .venv-${{ matrix.python-version }}/bin/activate
source .venv-${{ matrix.combos.venv_suffix }}/bin/activate
which python
python --version
pip --version
pip list
17 changes: 8 additions & 9 deletions .github/workflows/regression_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
GH_TOKEN: ${{ github.token }}
strategy:
matrix:
python-version: ['3.10']
group: [1, 2, 3, 4, 5, 6]

steps:
Expand All @@ -45,25 +44,25 @@ jobs:
id: check_changes
run: echo "has_changes=${{ steps.changes.outputs.has_changes }}" >> $GITHUB_ENV

- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: '3.10'

- 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-10
key: ${{ runner.os }}-venv-10-${{ 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-10
source .venv-10/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 +76,7 @@ jobs:
- name: Test with pytest
if: env.has_changes == 'true'
run: |
source .venv-${{ matrix.python-version }}/bin/activate
source .venv-10/bin/activate
pwd
lscpu
pip list
Expand All @@ -98,7 +97,7 @@ jobs:
if: always() && env.has_changes == 'true'
uses: actions/upload-artifact@v4
with:
name: regression_test_artifact-${{ matrix.python-version }}-${{ matrix.group }}
name: regression_test_artifact-3.10-${{ matrix.group }}
path: |
./cov.xml
./mpl_results.html
Expand Down
35 changes: 21 additions & 14 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ jobs:
GH_TOKEN: ${{ github.token }}
strategy:
matrix:
combos: [{group: 1, python_version: '3.9'},
{group: 2, python_version: '3.10'},
{group: 3, python_version: '3.11'},
{group: 4, python_version: '3.12'},
{group: 5, python_version: '3.12'},
{group: 6, python_version: '3.12'},
{group: 7, python_version: '3.12'},
{group: 8, python_version: '3.12'}]
combos: [{group: 1, python_version: '3.9', venv_suffix: '9'},
{group: 2, python_version: '3.10', venv_suffix: '10'},
{group: 3, python_version: '3.11.11', venv_suffix: '11'},
{group: 4, python_version: '3.12.8', venv_suffix: '12'},
{group: 5, python_version: '3.12.8', venv_suffix: '12'},
{group: 6, python_version: '3.12.8', venv_suffix: '12'},
{group: 7, python_version: '3.12.8', venv_suffix: '12'},
{group: 8, python_version: '3.12.8', venv_suffix: '12'}]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -61,15 +61,15 @@ jobs:
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-${{ matrix.combos.venv_suffix }}
key: ${{ runner.os }}-venv-${{ matrix.combos.venv_suffix }}-${{ 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-${{ matrix.combos.venv_suffix }}
source .venv-${{ matrix.combos.venv_suffix }}/bin/activate
python -m pip install --upgrade pip
pip install -r devtools/dev-requirements.txt
pip install matplotlib==3.9.2
Expand All @@ -80,13 +80,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-${{ matrix.combos.venv_suffix }}/bin/activate
which python
python --version
pwd
lscpu
pip list
- name: Test with pytest
if: env.has_changes == 'true'
run: |
source .venv-${{ matrix.combos.venv_suffix }}/bin/activate
python -m pytest -v -m unit \
--durations=0 \
--cov-report xml:cov.xml \
Expand Down

0 comments on commit 2a6c99a

Please sign in to comment.