Skip to content

Commit

Permalink
apply
Browse files Browse the repository at this point in the history
  • Loading branch information
YigitElma committed Dec 12, 2024
1 parent 487782e commit 5768eef
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 29 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/cache_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,15 @@ jobs:
GH_TOKEN: ${{ github.token }}
strategy:
matrix:
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'}
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4

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

- name: Check full Python version
run: |
Expand Down
24 changes: 16 additions & 8 deletions .github/workflows/regression_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
strategy:
matrix:
python-version: ['3.10']
group: [1, 2, 3, 4, 5, 6]

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

- name: Set up Python 3.10
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: '3.10'
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-10
key: ${{ runner.os }}-venv-10-${{ 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-10
source .venv-10/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
Expand All @@ -76,7 +84,7 @@ jobs:
- name: Test with pytest
if: env.has_changes == 'true'
run: |
source .venv-10/bin/activate
source .venv-${{ env.version }}/bin/activate
pwd
lscpu
pip list
Expand All @@ -97,7 +105,7 @@ jobs:
if: always() && env.has_changes == 'true'
uses: actions/upload-artifact@v4
with:
name: regression_test_artifact-3.10-${{ matrix.group }}
name: regression_test_artifact-${{ matrix.python-version }}-${{ 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', 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'}]
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'}]

steps:
- uses: actions/checkout@v4
Expand All @@ -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.venv_suffix }}
key: ${{ runner.os }}-venv-${{ matrix.combos.venv_suffix }}-${{ 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.venv_suffix }}
source .venv-${{ matrix.combos.venv_suffix }}/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
Expand All @@ -83,7 +90,7 @@ jobs:
- name: Action Details
if: env.has_changes == 'true'
run: |
source .venv-${{ matrix.combos.venv_suffix }}/bin/activate
source .venv-${{ env.version }}/bin/activate
which python
python --version
pwd
Expand All @@ -93,7 +100,7 @@ jobs:
- name: Test with pytest
if: env.has_changes == 'true'
run: |
source .venv-${{ matrix.combos.venv_suffix }}/bin/activate
source .venv-${{ env.version }}/bin/activate
python -m pytest -v -m unit \
--durations=0 \
--cov-report xml:cov.xml \
Expand Down

0 comments on commit 5768eef

Please sign in to comment.