Skip to content

Commit

Permalink
update the hash of the cache to have requirements.txt to account for …
Browse files Browse the repository at this point in the history
…dependency changes, change cache update time
  • Loading branch information
YigitElma committed Aug 23, 2024
1 parent 7058bf9 commit ba5334a
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 26 deletions.
29 changes: 20 additions & 9 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ concurrency:
jobs:
benchmark:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9']

steps:
# Enable tmate debugging of manually-triggered workflows if the input option was provided
Expand All @@ -32,23 +35,31 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}

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

- name: Restore Python environment cache
id: restore-env
uses: actions/cache/restore@v4
with:
path: .venv-3.9
key: ${{ runner.os }}-venv-3.9-${{ hashFiles('devtools/dev-requirements.txt') }}
path: .venv-${{ matrix.python-version }}
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-venv-3.9-
${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }}
- name: Set up virtual environment if not restored from cache
if: steps.restore-env.outputs.cache-hit != 'true'
run: |
python -m venv .venv-${{ matrix.python-version }}
source .venv-${{ matrix.python-version }}/bin/activate
python -m pip install --upgrade pip
pip install -r devtools/dev-requirements.txt
- name: Benchmark with pytest-benchmark
run: |
source .venv-3.9/bin/activate
source .venv-${{ matrix.python-version }}/bin/activate
pwd
lscpu
cd tests/benchmarks
Expand All @@ -67,7 +78,7 @@ jobs:
run: git checkout ${{ github.event.pull_request.head.sha }} -- tests/benchmarks
- name: Benchmark with pytest-benchmark
run: |
source .venv-3.9/bin/activate
source .venv-${{ matrix.python-version }}/bin/activate
pwd
lscpu
cd tests/benchmarks
Expand All @@ -78,7 +89,7 @@ jobs:
- name: put benchmark results in same folder
run: |
source .venv-3.9/bin/activate
source .venv-${{ matrix.python-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 @@ -91,7 +102,7 @@ jobs:
- name: Compare latest commit results to the master branch results
run: |
source .venv-3.9/bin/activate
source .venv-${{ matrix.python-version }}/bin/activate
pwd
cd tests/benchmarks
python compare_bench_results.py
Expand Down
24 changes: 18 additions & 6 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,37 @@ jobs:
black_format:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']

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

- name: Restore Python environment cache
id: restore-env
uses: actions/cache/restore@v4
with:
path: .venv-3.10
key: ${{ runner.os }}-venv-3.10-${{ hashFiles('devtools/dev-requirements.txt') }}
path: .venv-${{ matrix.python-version }}
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-venv-3.10-
${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }}
- name: Set up virtual environment if not restored from cache
if: steps.restore-env.outputs.cache-hit != 'true'
run: |
python -m venv .venv-${{ matrix.python-version }}
source .venv-${{ matrix.python-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-3.10/bin/activate
source .venv-${{ matrix.python-version }}/bin/activate
black --version
black --check desc/ tests/ || black_return_code=$?
echo "BLACK_RETURN_CODE=$black_return_code" >> $GITHUB_ENV
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ on: [pull_request, workflow_dispatch]
jobs:
flake8_linting:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']

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

# For some reason, loading venv makes this way slower
- name: Install dependencies
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/nbtests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,17 @@ jobs:
uses: actions/cache/restore@v4
with:
path: .venv-${{ matrix.python-version }}
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-venv-${{ matrix.python-version }}-
${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }}
- name: Set up virtual environment if not restored from cache
if: steps.restore-env.outputs.cache-hit != 'true'
run: |
python -m venv .venv-${{ matrix.python-version }}
source .venv-${{ matrix.python-version }}/bin/activate
python -m pip install --upgrade pip
pip install -r devtools/dev-requirements.txt
- name: Test notebooks with pytest and nbmake
run: |
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/pythonpip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@ name: Cache Python and pip dependencies
# and pip dependencies cache

on:
push: # TODO: remove while merging
branches:
- master
- dev
pull_request:
branches:
- master
schedule:
- cron: '0 0 */2 * *' # This triggers the workflow every 2 days at midnight
- cron: '30 4 */2 * *' # This triggers the workflow at 4:30 AM every 2 days
workflow_dispatch:

jobs:
Expand All @@ -27,9 +34,9 @@ jobs:
uses: actions/cache@v3
with:
path: ./.venv-${{ matrix.python-version }}
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-venv-${{ matrix.python-version }}-
${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }}
- name: Set up virtual environment
run: |
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/regression_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,17 @@ jobs:
uses: actions/cache/restore@v4
with:
path: .venv-${{ matrix.python-version }}
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-venv-${{ matrix.python-version }}-
${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }}
- name: Set up virtual environment if not restored from cache
if: steps.restore-env.outputs.cache-hit != 'true'
run: |
python -m venv .venv-${{ matrix.python-version }}
source .venv-${{ matrix.python-version }}/bin/activate
python -m pip install --upgrade pip
pip install -r devtools/dev-requirements.txt
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,17 @@ jobs:
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') }}
key: ${{ runner.os }}-venv-${{ matrix.combos.python_version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-venv-${{ matrix.combos.python_version }}-
${{ runner.os }}-venv-${{ matrix.combos.python_version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }}
- name: Set up virtual environment if not restored from cache
if: steps.restore-env.outputs.cache-hit != 'true'
run: |
python -m venv .venv-${{ matrix.combos.python_version }}
source .venv-${{ matrix.combos.python_version }}/bin/activate
python -m pip install --upgrade pip
pip install -r devtools/dev-requirements.txt
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
Expand Down

0 comments on commit ba5334a

Please sign in to comment.