From 68332034d8da5663746326f4e1107e93e7f04d2b Mon Sep 17 00:00:00 2001 From: Rahul Date: Tue, 20 Aug 2024 21:57:17 -0400 Subject: [PATCH 01/55] making changes to yaml and dev-requirements.txt --- .github/workflows/jax_tests.yml | 2 +- .github/workflows/regression_test.yml | 2 +- .github/workflows/unittest.yml | 2 +- .gitignore | 2 ++ devtools/dev-requirements.txt | 1 + 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/jax_tests.yml b/.github/workflows/jax_tests.yml index c751a37045..e47b62131c 100644 --- a/.github/workflows/jax_tests.yml +++ b/.github/workflows/jax_tests.yml @@ -44,7 +44,7 @@ jobs: run: | pwd lscpu - python -m pytest -m unit \ + python -m pytest -n auto -m unit \ --durations=0 \ --mpl \ --maxfail=1 \ diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index d9ef1072d6..97e4263643 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -42,7 +42,7 @@ jobs: run: | pwd lscpu - python -m pytest -v -m regression \ + python -m pytest -v -n auto -m regression\ --durations=0 \ --cov-report xml:cov.xml \ --cov-config=setup.cfg \ diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 57e5881a05..53f8190bd1 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -44,7 +44,7 @@ jobs: run: | pwd lscpu - python -m pytest -v -m unit \ + python -m pytest -v -n auto -m unit \ --durations=0 \ --cov-report xml:cov.xml \ --cov-config=setup.cfg \ diff --git a/.gitignore b/.gitignore index f5fa96e0ec..bf9806ab11 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,6 @@ tests/benchmarks/.benchmarks/ *.output *.pdf *.pyc +*.swp +*.swo .pymon diff --git a/devtools/dev-requirements.txt b/devtools/dev-requirements.txt index 078bddc916..b5ab2c49e8 100644 --- a/devtools/dev-requirements.txt +++ b/devtools/dev-requirements.txt @@ -24,6 +24,7 @@ pre-commit markupsafe == 2.0.1 nbmake pytest ~= 8.0.0 +pytest-xdist >= 3.6.0 pytest-benchmark pytest-cov >= 2.6.0 pytest-monitor From 77249ade917e26825d529353446694348e4cd4ba Mon Sep 17 00:00:00 2001 From: Rahul Date: Tue, 20 Aug 2024 22:03:36 -0400 Subject: [PATCH 02/55] adding -n auto to the rest of the yml files --- .github/workflows/mpl_tests.yml | 2 +- .github/workflows/nbtests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mpl_tests.yml b/.github/workflows/mpl_tests.yml index b986b33ec9..dade655d09 100644 --- a/.github/workflows/mpl_tests.yml +++ b/.github/workflows/mpl_tests.yml @@ -61,4 +61,4 @@ jobs: run: | pwd lscpu - python -m pytest tests/test_plotting.py --durations=0 --mpl --maxfail=1 + python -m pytest -n auto tests/test_plotting.py --durations=0 --mpl --maxfail=1 diff --git a/.github/workflows/nbtests.yml b/.github/workflows/nbtests.yml index 6d1fc6ca24..9ffe096965 100644 --- a/.github/workflows/nbtests.yml +++ b/.github/workflows/nbtests.yml @@ -38,7 +38,7 @@ jobs: pwd lscpu export PYTHONPATH=$(pwd) - pytest -v --nbmake "./docs/notebooks" \ + pytest -v -n auto --nbmake "./docs/notebooks" \ --nbmake-timeout=2000 \ --ignore=./docs/notebooks/zernike_eval.ipynb \ --splits 2 \ From 8b629d324b027af9ec80dd32dd475a5df6b216ba Mon Sep 17 00:00:00 2001 From: YigitElma Date: Wed, 21 Aug 2024 11:25:32 -0400 Subject: [PATCH 03/55] increase splitting --- .github/workflows/jax_tests.yml | 2 +- .github/workflows/mpl_tests.yml | 2 +- .github/workflows/nbtests.yml | 2 +- .github/workflows/regression_test.yml | 6 +++--- .github/workflows/unittest.yml | 10 +++++++--- .gitignore | 2 -- devtools/dev-requirements.txt | 1 - 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/jax_tests.yml b/.github/workflows/jax_tests.yml index e47b62131c..c751a37045 100644 --- a/.github/workflows/jax_tests.yml +++ b/.github/workflows/jax_tests.yml @@ -44,7 +44,7 @@ jobs: run: | pwd lscpu - python -m pytest -n auto -m unit \ + python -m pytest -m unit \ --durations=0 \ --mpl \ --maxfail=1 \ diff --git a/.github/workflows/mpl_tests.yml b/.github/workflows/mpl_tests.yml index dade655d09..b986b33ec9 100644 --- a/.github/workflows/mpl_tests.yml +++ b/.github/workflows/mpl_tests.yml @@ -61,4 +61,4 @@ jobs: run: | pwd lscpu - python -m pytest -n auto tests/test_plotting.py --durations=0 --mpl --maxfail=1 + python -m pytest tests/test_plotting.py --durations=0 --mpl --maxfail=1 diff --git a/.github/workflows/nbtests.yml b/.github/workflows/nbtests.yml index 9ffe096965..6d1fc6ca24 100644 --- a/.github/workflows/nbtests.yml +++ b/.github/workflows/nbtests.yml @@ -38,7 +38,7 @@ jobs: pwd lscpu export PYTHONPATH=$(pwd) - pytest -v -n auto --nbmake "./docs/notebooks" \ + pytest -v --nbmake "./docs/notebooks" \ --nbmake-timeout=2000 \ --ignore=./docs/notebooks/zernike_eval.ipynb \ --splits 2 \ diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 97e4263643..9f5d64a821 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: python-version: ['3.10'] - group: [1, 2, 3, 4, 5, 6] + group: [1, 2, 3, 4, 5, 6, 7, 8] steps: - uses: actions/checkout@v4 @@ -42,7 +42,7 @@ jobs: run: | pwd lscpu - python -m pytest -v -n auto -m regression\ + python -m pytest -v -m regression\ --durations=0 \ --cov-report xml:cov.xml \ --cov-config=setup.cfg \ @@ -50,7 +50,7 @@ jobs: --mpl \ --mpl-results-path=mpl_results.html \ --mpl-generate-summary=html \ - --splits 6 \ + --splits 8 \ --group ${{ matrix.group }} \ --splitting-algorithm least_duration \ --db ./prof.db diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 53f8190bd1..aa0f572ba2 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -23,7 +23,11 @@ jobs: 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: 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 @@ -44,7 +48,7 @@ jobs: run: | pwd lscpu - python -m pytest -v -n auto -m unit \ + python -m pytest -v -m unit \ --durations=0 \ --cov-report xml:cov.xml \ --cov-config=setup.cfg \ @@ -52,7 +56,7 @@ jobs: --mpl \ --mpl-results-path=mpl_results.html \ --mpl-generate-summary=html \ - --splits 4 \ + --splits 8 \ --group ${{ matrix.combos.group }} \ --splitting-algorithm least_duration \ --db ./prof.db diff --git a/.gitignore b/.gitignore index bf9806ab11..f5fa96e0ec 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,4 @@ tests/benchmarks/.benchmarks/ *.output *.pdf *.pyc -*.swp -*.swo .pymon diff --git a/devtools/dev-requirements.txt b/devtools/dev-requirements.txt index b5ab2c49e8..078bddc916 100644 --- a/devtools/dev-requirements.txt +++ b/devtools/dev-requirements.txt @@ -24,7 +24,6 @@ pre-commit markupsafe == 2.0.1 nbmake pytest ~= 8.0.0 -pytest-xdist >= 3.6.0 pytest-benchmark pytest-cov >= 2.6.0 pytest-monitor From f13d157a0856cb943ab18d52e5b3342edf0bb054 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Wed, 21 Aug 2024 13:22:44 -0400 Subject: [PATCH 04/55] try to cache pip dependencies --- .github/workflows/pythonpip.yml | 39 +++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/pythonpip.yml diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml new file mode 100644 index 0000000000..5582938c14 --- /dev/null +++ b/.github/workflows/pythonpip.yml @@ -0,0 +1,39 @@ +name: Python CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + schedule: + - cron: '0 0 * * 0' # This triggers the workflow every Sunday at midnight + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.9', '3.10', '3.11','3.12'] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Cache pip dependencies + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip-${{ matrix.python-version }}- + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r devtools/dev-requirements.txt From 602cfd75b4db58a688570ba54c0c71b02dd7bdec Mon Sep 17 00:00:00 2001 From: YigitElma Date: Wed, 21 Aug 2024 13:23:24 -0400 Subject: [PATCH 05/55] small fix --- .github/workflows/pythonpip.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 5582938c14..74c2b54e7d 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -4,6 +4,7 @@ on: push: branches: - master + - dev pull_request: branches: - master From 0b7227250d480afc74df6552f37490fa3a05296b Mon Sep 17 00:00:00 2001 From: YigitElma Date: Wed, 21 Aug 2024 13:35:15 -0400 Subject: [PATCH 06/55] use cached env for tests --- .github/workflows/black.yml | 12 ++++++++---- .github/workflows/linting.yml | 12 ++++++++---- .github/workflows/nbtests.yml | 14 ++++++++++---- .github/workflows/pythonpip.yml | 11 +++-------- .github/workflows/regression_test.yml | 13 ++++++++----- .github/workflows/unittest.yml | 13 ++++++++----- 6 files changed, 45 insertions(+), 30 deletions(-) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 993e56ee4b..fbad98e1d7 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -12,10 +12,14 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.10' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r devtools/dev-requirements.txt + - name: Cache pip dependencies + uses: actions/cache@v3 + with: + path: | + ~/.cache/pip + key: ${{ runner.os }}-pip-3.10-${{ hashFiles('devtools/dev-requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip-3.10- - name: Check files using the black formatter run: | black --version diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index c3ea0f96e9..758b8b84a5 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -12,10 +12,14 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.10' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r devtools/dev-requirements.txt + - name: Cache pip dependencies + uses: actions/cache@v3 + with: + path: | + ~/.cache/pip + key: ${{ runner.os }}-pip-3.10-${{ hashFiles('devtools/dev-requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip-3.10- - name: flake8 Lint uses: reviewdog/action-flake8@v3 with: diff --git a/.github/workflows/nbtests.yml b/.github/workflows/nbtests.yml index 6d1fc6ca24..0df8b26dce 100644 --- a/.github/workflows/nbtests.yml +++ b/.github/workflows/nbtests.yml @@ -25,14 +25,20 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r devtools/dev-requirements.txt + + - name: Cache pip dependencies + uses: actions/cache@v3 + with: + path: | + ~/.cache/pip + key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip-${{ matrix.python-version }}- - name: Test notebooks with pytest and nbmake run: | pwd diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 74c2b54e7d..9bd0fc71b9 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -1,15 +1,10 @@ -name: Python CI +name: Cache Python and pip dependencies +# This workflow is triggered every Sunday at midnight and updates the Python and pip dependencies cache on: - push: - branches: - - master - - dev - pull_request: - branches: - - master schedule: - cron: '0 0 * * 0' # This triggers the workflow every Sunday at midnight + workflow_dispatch: jobs: build: diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 9f5d64a821..32e461a070 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -29,11 +29,14 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r devtools/dev-requirements.txt - pip install matplotlib==3.7.2 + - name: Cache pip dependencies + uses: actions/cache@v3 + with: + path: | + ~/.cache/pip + key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip-${{ matrix.python-version }}- - name: Set Swap Space uses: pierotofy/set-swap-space@master with: diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index aa0f572ba2..523ff42604 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -35,11 +35,14 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.combos.python_version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r devtools/dev-requirements.txt - pip install matplotlib==3.7.2 + - name: Cache pip dependencies + uses: actions/cache@v3 + with: + path: | + ~/.cache/pip + key: ${{ runner.os }}-pip-${{ matrix.combos.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip-${{ matrix.combos.python-version }}- - name: Set Swap Space uses: pierotofy/set-swap-space@master with: From d2aa717433c253baff5f3746cf9f5f76a2331509 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Wed, 21 Aug 2024 13:39:11 -0400 Subject: [PATCH 07/55] try to fix --- .github/workflows/black.yml | 5 +++++ .github/workflows/linting.yml | 4 ++++ .github/workflows/nbtests.yml | 5 ++++- .github/workflows/regression_test.yml | 4 ++++ .github/workflows/unittest.yml | 4 ++++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index fbad98e1d7..2daa6e426a 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -20,6 +20,11 @@ jobs: key: ${{ runner.os }}-pip-3.10-${{ hashFiles('devtools/dev-requirements.txt') }} restore-keys: | ${{ runner.os }}-pip-3.10- + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r devtools/dev-requirements.txt - name: Check files using the black formatter run: | black --version diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 758b8b84a5..ef5e42e066 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -20,6 +20,10 @@ jobs: key: ${{ runner.os }}-pip-3.10-${{ hashFiles('devtools/dev-requirements.txt') }} restore-keys: | ${{ runner.os }}-pip-3.10- + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r devtools/dev-requirements.txt - name: flake8 Lint uses: reviewdog/action-flake8@v3 with: diff --git a/.github/workflows/nbtests.yml b/.github/workflows/nbtests.yml index 0df8b26dce..e6e16fe429 100644 --- a/.github/workflows/nbtests.yml +++ b/.github/workflows/nbtests.yml @@ -30,7 +30,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Cache pip dependencies uses: actions/cache@v3 with: @@ -39,6 +38,10 @@ jobs: key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }} restore-keys: | ${{ runner.os }}-pip-${{ matrix.python-version }}- + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r devtools/dev-requirements.txt - name: Test notebooks with pytest and nbmake run: | pwd diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 32e461a070..6f93dc9f2a 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -37,6 +37,10 @@ jobs: key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }} restore-keys: | ${{ runner.os }}-pip-${{ matrix.python-version }}- + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r devtools/dev-requirements.txt - name: Set Swap Space uses: pierotofy/set-swap-space@master with: diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 523ff42604..4120ad23cd 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -43,6 +43,10 @@ jobs: key: ${{ runner.os }}-pip-${{ matrix.combos.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }} restore-keys: | ${{ runner.os }}-pip-${{ matrix.combos.python-version }}- + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r devtools/dev-requirements.txt - name: Set Swap Space uses: pierotofy/set-swap-space@master with: From 741010135e440a1c91edc7cc4d704dbd93f9ea28 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Wed, 21 Aug 2024 13:45:15 -0400 Subject: [PATCH 08/55] fix the typo --- .github/workflows/unittest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 4120ad23cd..9643b4ff08 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -40,9 +40,9 @@ jobs: with: path: | ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.combos.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }} + key: ${{ runner.os }}-pip-${{ matrix.combos.python_version }}-${{ hashFiles('devtools/dev-requirements.txt') }} restore-keys: | - ${{ runner.os }}-pip-${{ matrix.combos.python-version }}- + ${{ runner.os }}-pip-${{ matrix.combos.python_version }}- - name: Install dependencies run: | python -m pip install --upgrade pip From c655ae56794ebc6287dd3b3d644cc31db17a8b28 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Wed, 21 Aug 2024 13:52:04 -0400 Subject: [PATCH 09/55] only use cached files --- .github/workflows/black.yml | 2 +- .github/workflows/linting.yml | 2 +- .github/workflows/nbtests.yml | 2 +- .github/workflows/regression_test.yml | 2 +- .github/workflows/unittest.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 2daa6e426a..d8cd8b26a0 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -24,7 +24,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r devtools/dev-requirements.txt + pip install --no-index --find-links=~/.cache/pip -r devtools/dev-requirements.txt - name: Check files using the black formatter run: | black --version diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index ef5e42e066..8a4e9ac3d5 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -23,7 +23,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r devtools/dev-requirements.txt + pip install --no-index --find-links=~/.cache/pip -r devtools/dev-requirements.txt - name: flake8 Lint uses: reviewdog/action-flake8@v3 with: diff --git a/.github/workflows/nbtests.yml b/.github/workflows/nbtests.yml index e6e16fe429..23f0ad8213 100644 --- a/.github/workflows/nbtests.yml +++ b/.github/workflows/nbtests.yml @@ -41,7 +41,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r devtools/dev-requirements.txt + pip install --no-index --find-links=~/.cache/pip -r devtools/dev-requirements.txt - name: Test notebooks with pytest and nbmake run: | pwd diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 6f93dc9f2a..8191d0c965 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -40,7 +40,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r devtools/dev-requirements.txt + pip install --no-index --find-links=~/.cache/pip -r devtools/dev-requirements.txt - name: Set Swap Space uses: pierotofy/set-swap-space@master with: diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 9643b4ff08..6543b978dc 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -46,7 +46,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r devtools/dev-requirements.txt + pip install --no-index --find-links=~/.cache/pip -r devtools/dev-requirements.txt - name: Set Swap Space uses: pierotofy/set-swap-space@master with: From 96ff3967ba7804cdeb4a0f31ed6030409219e596 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Wed, 21 Aug 2024 13:56:20 -0400 Subject: [PATCH 10/55] fix --- .github/workflows/black.yml | 2 +- .github/workflows/linting.yml | 2 +- .github/workflows/nbtests.yml | 2 +- .github/workflows/regression_test.yml | 2 +- .github/workflows/unittest.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index d8cd8b26a0..7c7c031904 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -24,7 +24,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install --no-index --find-links=~/.cache/pip -r devtools/dev-requirements.txt + pip install --no-index -r devtools/dev-requirements.txt - name: Check files using the black formatter run: | black --version diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 8a4e9ac3d5..55a8e5750a 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -23,7 +23,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install --no-index --find-links=~/.cache/pip -r devtools/dev-requirements.txt + pip install --no-index -r devtools/dev-requirements.txt - name: flake8 Lint uses: reviewdog/action-flake8@v3 with: diff --git a/.github/workflows/nbtests.yml b/.github/workflows/nbtests.yml index 23f0ad8213..a8ddd84c0e 100644 --- a/.github/workflows/nbtests.yml +++ b/.github/workflows/nbtests.yml @@ -41,7 +41,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install --no-index --find-links=~/.cache/pip -r devtools/dev-requirements.txt + pip install --no-index -r devtools/dev-requirements.txt - name: Test notebooks with pytest and nbmake run: | pwd diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 8191d0c965..50690119ba 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -40,7 +40,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install --no-index --find-links=~/.cache/pip -r devtools/dev-requirements.txt + pip install --no-index -r devtools/dev-requirements.txt - name: Set Swap Space uses: pierotofy/set-swap-space@master with: diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 6543b978dc..b846d736d4 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -46,7 +46,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install --no-index --find-links=~/.cache/pip -r devtools/dev-requirements.txt + pip install --no-index -r devtools/dev-requirements.txt - name: Set Swap Space uses: pierotofy/set-swap-space@master with: From c41867d86231d328dc6d32b2a90f19d728558b79 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Wed, 21 Aug 2024 13:58:30 -0400 Subject: [PATCH 11/55] switch back to cache --- .github/workflows/black.yml | 2 +- .github/workflows/linting.yml | 2 +- .github/workflows/nbtests.yml | 2 +- .github/workflows/regression_test.yml | 2 +- .github/workflows/unittest.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 7c7c031904..2daa6e426a 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -24,7 +24,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install --no-index -r devtools/dev-requirements.txt + pip install -r devtools/dev-requirements.txt - name: Check files using the black formatter run: | black --version diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 55a8e5750a..ef5e42e066 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -23,7 +23,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install --no-index -r devtools/dev-requirements.txt + pip install -r devtools/dev-requirements.txt - name: flake8 Lint uses: reviewdog/action-flake8@v3 with: diff --git a/.github/workflows/nbtests.yml b/.github/workflows/nbtests.yml index a8ddd84c0e..e6e16fe429 100644 --- a/.github/workflows/nbtests.yml +++ b/.github/workflows/nbtests.yml @@ -41,7 +41,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install --no-index -r devtools/dev-requirements.txt + pip install -r devtools/dev-requirements.txt - name: Test notebooks with pytest and nbmake run: | pwd diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 50690119ba..6f93dc9f2a 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -40,7 +40,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install --no-index -r devtools/dev-requirements.txt + pip install -r devtools/dev-requirements.txt - name: Set Swap Space uses: pierotofy/set-swap-space@master with: diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index b846d736d4..9643b4ff08 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -46,7 +46,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install --no-index -r devtools/dev-requirements.txt + pip install -r devtools/dev-requirements.txt - name: Set Swap Space uses: pierotofy/set-swap-space@master with: From 886a7c3539c3f86b8f130b03ce9b62a5c894c224 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Wed, 21 Aug 2024 14:16:33 -0400 Subject: [PATCH 12/55] try venv strategy --- .github/workflows/black.yml | 14 ++------------ .github/workflows/linting.yml | 13 ++----------- .github/workflows/nbtests.yml | 13 ++----------- .github/workflows/pythonpip.yml | 22 ++++++++++++++++------ .github/workflows/regression_test.yml | 13 ++----------- .github/workflows/unittest.yml | 13 ++----------- 6 files changed, 26 insertions(+), 62 deletions(-) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 2daa6e426a..ea4c54c784 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -12,19 +12,9 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.10' - - name: Cache pip dependencies - uses: actions/cache@v3 - with: - path: | - ~/.cache/pip - key: ${{ runner.os }}-pip-3.10-${{ hashFiles('devtools/dev-requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip-3.10- - - - name: Install dependencies + - name: Activate virtual environment run: | - python -m pip install --upgrade pip - pip install -r devtools/dev-requirements.txt + source .venv-3.10/bin/activate - name: Check files using the black formatter run: | black --version diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index ef5e42e066..54b7c8ecd4 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -12,18 +12,9 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.10' - - name: Cache pip dependencies - uses: actions/cache@v3 - with: - path: | - ~/.cache/pip - key: ${{ runner.os }}-pip-3.10-${{ hashFiles('devtools/dev-requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip-3.10- - - name: Install dependencies + - name: Activate virtual environment run: | - python -m pip install --upgrade pip - pip install -r devtools/dev-requirements.txt + source .venv-3.10/bin/activate - name: flake8 Lint uses: reviewdog/action-flake8@v3 with: diff --git a/.github/workflows/nbtests.yml b/.github/workflows/nbtests.yml index e6e16fe429..1b69ae8e61 100644 --- a/.github/workflows/nbtests.yml +++ b/.github/workflows/nbtests.yml @@ -30,18 +30,9 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Cache pip dependencies - uses: actions/cache@v3 - with: - path: | - ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip-${{ matrix.python-version }}- - - name: Install dependencies + - name: Activate virtual environment run: | - python -m pip install --upgrade pip - pip install -r devtools/dev-requirements.txt + source .venv-${{ matrix.python-version }}/bin/activate - name: Test notebooks with pytest and nbmake run: | pwd diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 9bd0fc71b9..41900b487e 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.9', '3.10', '3.11','3.12'] + python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v4 @@ -21,15 +21,25 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Cache pip dependencies + - name: Cache Python environment + id: cache-env uses: actions/cache@v3 with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }} + path: .venv-${{ matrix.python-version }} + key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }} restore-keys: | - ${{ runner.os }}-pip-${{ matrix.python-version }}- + ${{ runner.os }}-venv-${{ matrix.python-version }}- - - name: Install dependencies + - name: Set up virtual environment + if: steps.cache-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: Verify virtual environment activation + run: | + source .venv-${{ matrix.python-version }}/bin/activate + python --version + pip --version diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 6f93dc9f2a..7e210336a7 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -29,18 +29,9 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Cache pip dependencies - uses: actions/cache@v3 - with: - path: | - ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip-${{ matrix.python-version }}- - - name: Install dependencies + - name: Activate virtual environment run: | - python -m pip install --upgrade pip - pip install -r devtools/dev-requirements.txt + source .venv-${{ matrix.python-version }}/bin/activate - name: Set Swap Space uses: pierotofy/set-swap-space@master with: diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 9643b4ff08..e513960122 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -35,18 +35,9 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.combos.python_version }} - - name: Cache pip dependencies - uses: actions/cache@v3 - with: - path: | - ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.combos.python_version }}-${{ hashFiles('devtools/dev-requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip-${{ matrix.combos.python_version }}- - - name: Install dependencies + - name: Activate virtual environment run: | - python -m pip install --upgrade pip - pip install -r devtools/dev-requirements.txt + source .venv-${{ matrix.combos.python_version }}/bin/activate - name: Set Swap Space uses: pierotofy/set-swap-space@master with: From b9cb7d8e99b3bd0aaededd3dc69ef884e08a9a42 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Wed, 21 Aug 2024 14:17:47 -0400 Subject: [PATCH 13/55] run pytonpip.yml for once --- .github/workflows/pythonpip.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 41900b487e..6ded44ef56 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -2,6 +2,13 @@ name: Cache Python and pip dependencies # This workflow is triggered every Sunday at midnight and updates the Python and pip dependencies cache on: + push: + branches: + - master + - dev + pull_request: + branches: + - master # TODO: comment this lines later schedule: - cron: '0 0 * * 0' # This triggers the workflow every Sunday at midnight workflow_dispatch: From f3ca1b69589e3dcb086daab8335570d1f188eb7e Mon Sep 17 00:00:00 2001 From: YigitElma Date: Wed, 21 Aug 2024 14:23:24 -0400 Subject: [PATCH 14/55] delete the redundant lines --- .github/workflows/pythonpip.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 6ded44ef56..41900b487e 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -2,13 +2,6 @@ name: Cache Python and pip dependencies # This workflow is triggered every Sunday at midnight and updates the Python and pip dependencies cache on: - push: - branches: - - master - - dev - pull_request: - branches: - - master # TODO: comment this lines later schedule: - cron: '0 0 * * 0' # This triggers the workflow every Sunday at midnight workflow_dispatch: From 8df66570459d4f308ede70107046ff8d2e2ce560 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Wed, 21 Aug 2024 14:29:54 -0400 Subject: [PATCH 15/55] update --- .github/workflows/black.yml | 16 ++++++++++++++++ .github/workflows/linting.yml | 16 ++++++++++++++++ .github/workflows/regression_test.yml | 16 ++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index ea4c54c784..8226b61d61 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -12,6 +12,22 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.10' + - name: Restore Python environment cache + id: restore-env + uses: actions/cache@v3 + with: + path: .venv-3.10 + key: ${{ runner.os }}-venv-3.10-${{ hashFiles('devtools/dev-requirements.txt') }} + restore-keys: | + ${{ runner.os }}-venv-3.10- + + - name: Check if virtual environment exists + run: | + if [ ! -d ".venv-3.10" ]; then + echo "Error: Virtual environment .venv-3.10 not found!" + exit 1 + fi + - name: Activate virtual environment run: | source .venv-3.10/bin/activate diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 54b7c8ecd4..bf4e295b1b 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -12,6 +12,22 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.10' + - name: Restore Python environment cache + id: restore-env + uses: actions/cache@v3 + with: + path: .venv-3.10 + key: ${{ runner.os }}-venv-3.10-${{ hashFiles('devtools/dev-requirements.txt') }} + restore-keys: | + ${{ runner.os }}-venv-3.10- + + - name: Check if virtual environment exists + run: | + if [ ! -d ".venv-3.10" ]; then + echo "Error: Virtual environment .venv-3.10 not found!" + exit 1 + fi + - name: Activate virtual environment run: | source .venv-3.10/bin/activate diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 7e210336a7..32f4ba5044 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -29,6 +29,22 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Restore Python environment cache + id: restore-env + uses: actions/cache@v3 + with: + path: .venv-${{ matrix.python-version }} + key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }} + restore-keys: | + ${{ runner.os }}-venv-${{ matrix.python-version }}- + + - name: Check if virtual environment exists + run: | + if [ ! -d ".venv-${{ matrix.python-version }}" ]; then + echo "Error: Virtual environment .venv-${{ matrix.python-version }} not found!" + exit 1 + fi + - name: Activate virtual environment run: | source .venv-${{ matrix.python-version }}/bin/activate From e12fdce7759252b77b05bf637057b6f95d06292f Mon Sep 17 00:00:00 2001 From: YigitElma Date: Wed, 21 Aug 2024 14:34:55 -0400 Subject: [PATCH 16/55] try smth --- .github/workflows/black.yml | 1 + .github/workflows/nbtests.yml | 1 + .github/workflows/regression_test.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 8226b61d61..428f4a2ea9 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -33,6 +33,7 @@ jobs: source .venv-3.10/bin/activate - name: Check files using the black formatter run: | + 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 diff --git a/.github/workflows/nbtests.yml b/.github/workflows/nbtests.yml index 1b69ae8e61..7a588aae1f 100644 --- a/.github/workflows/nbtests.yml +++ b/.github/workflows/nbtests.yml @@ -35,6 +35,7 @@ jobs: source .venv-${{ matrix.python-version }}/bin/activate - name: Test notebooks with pytest and nbmake run: | + source .venv-${{ matrix.python-version }}/bin/activate pwd lscpu export PYTHONPATH=$(pwd) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 32f4ba5044..e5dbe61a3a 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -54,6 +54,7 @@ jobs: swap-size-gb: 10 - name: Test with pytest run: | + source .venv-${{ matrix.python-version }}/bin/activate pwd lscpu python -m pytest -v -m regression\ From 1ddd718036bde9e05ed75916e1df5b9b0eab543f Mon Sep 17 00:00:00 2001 From: YigitElma Date: Wed, 21 Aug 2024 19:18:00 -0400 Subject: [PATCH 17/55] try new restore for black/linting and regression tests --- .github/workflows/black.yml | 11 +++++++---- .github/workflows/linting.yml | 6 +++--- .github/workflows/pythonpip.yml | 2 +- .github/workflows/regression_test.yml | 6 +++--- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 428f4a2ea9..1c251cc7e9 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -12,9 +12,10 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.10' + - name: Restore Python environment cache id: restore-env - uses: actions/cache@v3 + uses: actions/restore@v4 with: path: .venv-3.10 key: ${{ runner.os }}-venv-3.10-${{ hashFiles('devtools/dev-requirements.txt') }} @@ -22,26 +23,28 @@ jobs: ${{ runner.os }}-venv-3.10- - name: Check if virtual environment exists + if: steps.restore-env.outputs.cache-hit != 'true' run: | - if [ ! -d ".venv-3.10" ]; then echo "Error: Virtual environment .venv-3.10 not found!" exit 1 - fi - name: Activate virtual environment run: | source .venv-3.10/bin/activate + - name: Check files using the black formatter run: | - source .venv-${{ matrix.python-version }}/bin/activate + source .venv-3.10/bin/activate black --version black --check desc/ tests/ || black_return_code=$? echo "BLACK_RETURN_CODE=$black_return_code" >> $GITHUB_ENV black desc/ tests/ + - name: Annotate diff changes using reviewdog uses: reviewdog/action-suggester@v1 with: tool_name: blackfmt + - name: Fail if not formatted run: | exit ${{ env.BLACK_RETURN_CODE }} diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index bf4e295b1b..3e8978be3c 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -14,7 +14,7 @@ jobs: python-version: '3.10' - name: Restore Python environment cache id: restore-env - uses: actions/cache@v3 + uses: actions/restore@v3 with: path: .venv-3.10 key: ${{ runner.os }}-venv-3.10-${{ hashFiles('devtools/dev-requirements.txt') }} @@ -22,15 +22,15 @@ jobs: ${{ runner.os }}-venv-3.10- - name: Check if virtual environment exists + if: steps.restore-env.outputs.cache-hit != 'true' run: | - if [ ! -d ".venv-3.10" ]; then echo "Error: Virtual environment .venv-3.10 not found!" exit 1 - fi - name: Activate virtual environment run: | source .venv-3.10/bin/activate + - name: flake8 Lint uses: reviewdog/action-flake8@v3 with: diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 41900b487e..7342f26ec9 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -25,7 +25,7 @@ jobs: id: cache-env uses: actions/cache@v3 with: - path: .venv-${{ matrix.python-version }} + path: ./.venv-${{ matrix.python-version }} key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }} restore-keys: | ${{ runner.os }}-venv-${{ matrix.python-version }}- diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index e5dbe61a3a..d6b9cde398 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -31,7 +31,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Restore Python environment cache id: restore-env - uses: actions/cache@v3 + uses: actions/restore@v4 with: path: .venv-${{ matrix.python-version }} key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }} @@ -39,15 +39,15 @@ jobs: ${{ runner.os }}-venv-${{ matrix.python-version }}- - name: Check if virtual environment exists + if: steps.restore-env.outputs.cache-hit != 'true' run: | - if [ ! -d ".venv-${{ matrix.python-version }}" ]; then echo "Error: Virtual environment .venv-${{ matrix.python-version }} not found!" exit 1 - fi - name: Activate virtual environment run: | source .venv-${{ matrix.python-version }}/bin/activate + - name: Set Swap Space uses: pierotofy/set-swap-space@master with: From 4927894e0ebf2eaec4a7746ad6d73ecf09a5ec6a Mon Sep 17 00:00:00 2001 From: YigitElma Date: Wed, 21 Aug 2024 19:28:23 -0400 Subject: [PATCH 18/55] fix --- .github/workflows/black.yml | 2 +- .github/workflows/linting.yml | 2 +- .github/workflows/regression_test.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 1c251cc7e9..864aa3232e 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -15,7 +15,7 @@ jobs: - name: Restore Python environment cache id: restore-env - uses: actions/restore@v4 + uses: actions/cache/restore@v4 with: path: .venv-3.10 key: ${{ runner.os }}-venv-3.10-${{ hashFiles('devtools/dev-requirements.txt') }} diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 3e8978be3c..407e22aedb 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -14,7 +14,7 @@ jobs: python-version: '3.10' - name: Restore Python environment cache id: restore-env - uses: actions/restore@v3 + uses: actions/cache/restore@v3 with: path: .venv-3.10 key: ${{ runner.os }}-venv-3.10-${{ hashFiles('devtools/dev-requirements.txt') }} diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index d6b9cde398..f220fcbcda 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -31,7 +31,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Restore Python environment cache id: restore-env - uses: actions/restore@v4 + uses: actions/cache/restore@v4 with: path: .venv-${{ matrix.python-version }} key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }} From bf158a093a1ed73c4db4c165ca9e9b953eb3af61 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Wed, 21 Aug 2024 19:38:48 -0400 Subject: [PATCH 19/55] add restore to rest of the workflows --- .github/workflows/benchmark.yml | 29 ++++++++++++++++++++++++--- .github/workflows/nbtests.yml | 17 ++++++++++++++++ .github/workflows/regression_test.yml | 4 ++++ .github/workflows/unittest.yml | 20 ++++++++++++++++++ 4 files changed, 67 insertions(+), 3 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index ad00eeef5d..5f7e0994d4 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -31,14 +31,31 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} + - name: Set up Python 3.9 uses: actions/setup-python@v5 with: python-version: 3.9 - - name: Install dependencies + + - 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') }} + restore-keys: | + ${{ runner.os }}-venv-3.9- + + - name: Check if virtual environment exists + if: steps.restore-env.outputs.cache-hit != 'true' run: | - python -m pip install --upgrade pip - pip install -r devtools/dev-requirements.txt + echo "Error: Virtual environment .venv-3.9 not found!" + exit 1 + + - name: Activate virtual environment + run: | + source .venv-3.9/bin/activate + - name: Benchmark with pytest-benchmark run: | pwd @@ -48,11 +65,13 @@ jobs: --benchmark-save='Latest_Commit' \ --durations=0 \ --benchmark-save-data + - name: Checkout current master uses: actions/checkout@v4 with: ref: master clean: false + - name: Checkout benchmarks from PR head run: git checkout ${{ github.event.pull_request.head.sha }} -- tests/benchmarks - name: Benchmark with pytest-benchmark @@ -64,6 +83,7 @@ jobs: --benchmark-save='master' \ --durations=0 \ --benchmark-save-data + - name: put benchmark results in same folder run: | pwd @@ -75,12 +95,14 @@ jobs: mkdir compare_results cp $t1 compare_results cp $t2 compare_results + - name: Compare latest commit results to the master branch results run: | pwd cd tests/benchmarks python compare_bench_results.py cat commit_msg.txt + - name: comment PR with the results uses: thollander/actions-comment-pull-request@v2 env: @@ -88,6 +110,7 @@ jobs: with: filePath: tests/benchmarks/commit_msg.txt comment_tag: benchmark + - name: Upload benchmark data if: always() uses: actions/upload-artifact@v4 diff --git a/.github/workflows/nbtests.yml b/.github/workflows/nbtests.yml index 7a588aae1f..4656e6d738 100644 --- a/.github/workflows/nbtests.yml +++ b/.github/workflows/nbtests.yml @@ -30,9 +30,26 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + + - 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') }} + restore-keys: | + ${{ runner.os }}-venv-${{ matrix.python-version }}- + + - name: Check if virtual environment exists + if: steps.restore-env.outputs.cache-hit != 'true' + run: | + echo "Error: Virtual environment .venv-${{ matrix.python-version }} not found!" + exit 1 + - name: Activate virtual environment run: | source .venv-${{ matrix.python-version }}/bin/activate + - name: Test notebooks with pytest and nbmake run: | source .venv-${{ matrix.python-version }}/bin/activate diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index f220fcbcda..4da96f49ab 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -29,6 +29,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Restore Python environment cache id: restore-env uses: actions/cache/restore@v4 @@ -52,6 +53,7 @@ jobs: uses: pierotofy/set-swap-space@master with: swap-size-gb: 10 + - name: Test with pytest run: | source .venv-${{ matrix.python-version }}/bin/activate @@ -69,6 +71,7 @@ jobs: --group ${{ matrix.group }} \ --splitting-algorithm least_duration \ --db ./prof.db + - name: save coverage file and plot comparison results if: always() uses: actions/upload-artifact@v4 @@ -78,6 +81,7 @@ jobs: ./cov.xml ./mpl_results.html ./prof.db + - name: Upload coverage id : codecov uses: Wandalen/wretry.action@v1.3.0 diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index e513960122..d1517e2724 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -35,13 +35,31 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.combos.python_version }} + + - name: Restore Python environment cache + 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') }} + restore-keys: | + ${{ runner.os }}-venv-${{ matrix.combos.python_version }}- + + - name: Check if virtual environment exists + if: steps.restore-env.outputs.cache-hit != 'true' + run: | + echo "Error: Virtual environment .venv-${{ matrix.combos.python_version }} not found!" + exit 1 + - name: Activate virtual environment run: | source .venv-${{ matrix.combos.python_version }}/bin/activate + - name: Set Swap Space uses: pierotofy/set-swap-space@master with: swap-size-gb: 10 + - name: Test with pytest run: | pwd @@ -58,6 +76,7 @@ jobs: --group ${{ matrix.combos.group }} \ --splitting-algorithm least_duration \ --db ./prof.db + - name: save coverage file and plot comparison results if: always() uses: actions/upload-artifact@v4 @@ -67,6 +86,7 @@ jobs: ./cov.xml ./mpl_results.html ./prof.db + - name: Upload coverage id : codecov uses: Wandalen/wretry.action@v1.3.0 From 77d2cea85c7d5a977e310461b7d1ac5e452ed2c4 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Wed, 21 Aug 2024 19:44:46 -0400 Subject: [PATCH 20/55] change frequency of caching --- .github/workflows/pythonpip.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 7342f26ec9..a4dd1ff62b 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -1,9 +1,10 @@ name: Cache Python and pip dependencies -# This workflow is triggered every Sunday at midnight and updates the Python and pip dependencies cache +# This workflow is triggered every 2 days and updates the Python +# and pip dependencies cache on: schedule: - - cron: '0 0 * * 0' # This triggers the workflow every Sunday at midnight + - cron: '0 0 */2 * *' # This triggers the workflow every 2 days at midnight workflow_dispatch: jobs: @@ -31,7 +32,6 @@ jobs: ${{ runner.os }}-venv-${{ matrix.python-version }}- - name: Set up virtual environment - if: steps.cache-env.outputs.cache-hit != 'true' run: | python -m venv .venv-${{ matrix.python-version }} source .venv-${{ matrix.python-version }}/bin/activate From e84ffabfc4fc65c9c52fb3f5d166f91ef899b592 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Wed, 21 Aug 2024 22:46:49 -0400 Subject: [PATCH 21/55] fix source thing --- .github/workflows/benchmark.yml | 14 ++++---------- .github/workflows/black.yml | 10 ---------- .github/workflows/linting.yml | 13 +++++-------- .github/workflows/nbtests.yml | 10 ---------- .github/workflows/regression_test.yml | 10 ---------- .github/workflows/unittest.yml | 11 +---------- 6 files changed, 10 insertions(+), 58 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 5f7e0994d4..dbb80cc4a2 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -46,18 +46,9 @@ jobs: restore-keys: | ${{ runner.os }}-venv-3.9- - - name: Check if virtual environment exists - if: steps.restore-env.outputs.cache-hit != 'true' - run: | - echo "Error: Virtual environment .venv-3.9 not found!" - exit 1 - - - name: Activate virtual environment - run: | - source .venv-3.9/bin/activate - - name: Benchmark with pytest-benchmark run: | + source .venv-3.9/bin/activate pwd lscpu cd tests/benchmarks @@ -76,6 +67,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 pwd lscpu cd tests/benchmarks @@ -86,6 +78,7 @@ jobs: - name: put benchmark results in same folder run: | + source .venv-3.9/bin/activate pwd cd tests/benchmarks find .benchmarks/ -type f -printf "%T@ %p\n" | sort -n | cut -d' ' -f 2- | tail -n 1 > temp1 @@ -98,6 +91,7 @@ jobs: - name: Compare latest commit results to the master branch results run: | + source .venv-3.9/bin/activate pwd cd tests/benchmarks python compare_bench_results.py diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 864aa3232e..92b3e6360b 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -22,16 +22,6 @@ jobs: restore-keys: | ${{ runner.os }}-venv-3.10- - - name: Check if virtual environment exists - if: steps.restore-env.outputs.cache-hit != 'true' - run: | - echo "Error: Virtual environment .venv-3.10 not found!" - exit 1 - - - name: Activate virtual environment - run: | - source .venv-3.10/bin/activate - - name: Check files using the black formatter run: | source .venv-3.10/bin/activate diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 407e22aedb..1c1540f7e1 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -21,15 +21,12 @@ jobs: restore-keys: | ${{ runner.os }}-venv-3.10- - - name: Check if virtual environment exists - if: steps.restore-env.outputs.cache-hit != 'true' + # We need to activate the virtual environment and add the PATH to the environment variables + # so that the flake8 command can be found. This is different than other workflows, but needed. + - name: Activate virtualenv run: | - echo "Error: Virtual environment .venv-3.10 not found!" - exit 1 - - - name: Activate virtual environment - run: | - source .venv-3.10/bin/activate + . .venv-3.10/bin/activate + echo PATH=$PATH >> $GITHUB_ENV - name: flake8 Lint uses: reviewdog/action-flake8@v3 diff --git a/.github/workflows/nbtests.yml b/.github/workflows/nbtests.yml index 4656e6d738..af1f647ca6 100644 --- a/.github/workflows/nbtests.yml +++ b/.github/workflows/nbtests.yml @@ -40,16 +40,6 @@ jobs: restore-keys: | ${{ runner.os }}-venv-${{ matrix.python-version }}- - - name: Check if virtual environment exists - if: steps.restore-env.outputs.cache-hit != 'true' - run: | - echo "Error: Virtual environment .venv-${{ matrix.python-version }} not found!" - exit 1 - - - name: Activate virtual environment - run: | - source .venv-${{ matrix.python-version }}/bin/activate - - name: Test notebooks with pytest and nbmake run: | source .venv-${{ matrix.python-version }}/bin/activate diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 4da96f49ab..4a66108796 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -39,16 +39,6 @@ jobs: restore-keys: | ${{ runner.os }}-venv-${{ matrix.python-version }}- - - name: Check if virtual environment exists - if: steps.restore-env.outputs.cache-hit != 'true' - run: | - echo "Error: Virtual environment .venv-${{ matrix.python-version }} not found!" - exit 1 - - - name: Activate virtual environment - run: | - source .venv-${{ matrix.python-version }}/bin/activate - - name: Set Swap Space uses: pierotofy/set-swap-space@master with: diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index d1517e2724..fff6be4c79 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -45,16 +45,6 @@ jobs: restore-keys: | ${{ runner.os }}-venv-${{ matrix.combos.python_version }}- - - name: Check if virtual environment exists - if: steps.restore-env.outputs.cache-hit != 'true' - run: | - echo "Error: Virtual environment .venv-${{ matrix.combos.python_version }} not found!" - exit 1 - - - name: Activate virtual environment - run: | - source .venv-${{ matrix.combos.python_version }}/bin/activate - - name: Set Swap Space uses: pierotofy/set-swap-space@master with: @@ -62,6 +52,7 @@ jobs: - name: Test with pytest run: | + source .venv-${{ matrix.combos.python_version }}/bin/activate pwd lscpu python -m pytest -v -m unit \ From 368058ef16edf53cc02455337b03e57d1dd09db7 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Thu, 22 Aug 2024 01:53:23 -0400 Subject: [PATCH 22/55] don't use venv for lintin, for some reason it is 6 minutes slower --- .github/workflows/linting.yml | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 1c1540f7e1..60e7ac31ff 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -12,21 +12,12 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.10' - - name: Restore Python environment cache - id: restore-env - uses: actions/cache/restore@v3 - with: - path: .venv-3.10 - key: ${{ runner.os }}-venv-3.10-${{ hashFiles('devtools/dev-requirements.txt') }} - restore-keys: | - ${{ runner.os }}-venv-3.10- - # We need to activate the virtual environment and add the PATH to the environment variables - # so that the flake8 command can be found. This is different than other workflows, but needed. - - name: Activate virtualenv + # For some reason, loading venv makes this way slower + - name: Install dependencies run: | - . .venv-3.10/bin/activate - echo PATH=$PATH >> $GITHUB_ENV + python -m pip install --upgrade pip + pip install -r devtools/dev-requirements.txt - name: flake8 Lint uses: reviewdog/action-flake8@v3 From ba5334a85721f67bb936de2e679030eafa41fe83 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 13:07:56 -0400 Subject: [PATCH 23/55] update the hash of the cache to have requirements.txt to account for dependency changes, change cache update time --- .github/workflows/benchmark.yml | 29 ++++++++++++++++++--------- .github/workflows/black.yml | 24 ++++++++++++++++------ .github/workflows/linting.yml | 8 ++++++-- .github/workflows/nbtests.yml | 12 +++++++++-- .github/workflows/pythonpip.yml | 13 +++++++++--- .github/workflows/regression_test.yml | 12 +++++++++-- .github/workflows/unittest.yml | 12 +++++++++-- 7 files changed, 84 insertions(+), 26 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index dbb80cc4a2..7ab698aee1 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 92b3e6360b..9961e11999 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -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 diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 60e7ac31ff..2eef77dcc0 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -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 diff --git a/.github/workflows/nbtests.yml b/.github/workflows/nbtests.yml index af1f647ca6..b4155101aa 100644 --- a/.github/workflows/nbtests.yml +++ b/.github/workflows/nbtests.yml @@ -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: | diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index a4dd1ff62b..8a3f035861 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -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: @@ -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: | diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 4a66108796..cafdbd24c7 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -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 diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index fff6be4c79..eeaf53190f 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -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 From 52cb5aff71020464ec9c5d343c8df2492c53dfd2 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 13:40:46 -0400 Subject: [PATCH 24/55] to rerun the tests --- .github/workflows/pythonpip.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 8a3f035861..b357747e79 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -1,7 +1,7 @@ name: Cache Python and pip dependencies # This workflow is triggered every 2 days and updates the Python # and pip dependencies cache - +# TODO: this needs to delete old cache too!!!! on: push: # TODO: remove while merging branches: From 008036de208eaa2b841fda5c4c07535fe54f57ce Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 14:51:05 -0400 Subject: [PATCH 25/55] change cache workflow to save --- .github/workflows/pythonpip.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index b357747e79..fa8ee02878 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -29,15 +29,6 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Cache Python environment - id: cache-env - uses: actions/cache@v3 - with: - 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-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }} - - name: Set up virtual environment run: | python -m venv .venv-${{ matrix.python-version }} @@ -45,6 +36,13 @@ jobs: python -m pip install --upgrade pip pip install -r devtools/dev-requirements.txt + - name: Cache Python environment + id: cache-env + uses: actions/cache/save@v3 + with: + path: ./.venv-${{ matrix.python-version }} + key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }} + - name: Verify virtual environment activation run: | source .venv-${{ matrix.python-version }}/bin/activate From c76a5e5da074331f0b037b9b216c0d4aff810952 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 15:32:09 -0400 Subject: [PATCH 26/55] add delete old cache files --- .github/workflows/pythonpip.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index fa8ee02878..8e15a9be73 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -29,6 +29,14 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Delete old cached file with same python version + run: | + echo "Current Cached files list" + gh cache list + gh cache delete ${{ runner.os }}-venv-${{ matrix.python-version }}- + echo "After Deletion Cached files list" + gh cache list + - name: Set up virtual environment run: | python -m venv .venv-${{ matrix.python-version }} @@ -38,10 +46,13 @@ jobs: - name: Cache Python environment id: cache-env - uses: actions/cache/save@v3 + uses: actions/cache@v3 with: 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-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }} + ${{ runner.os }}-venv-${{ matrix.python-version }}- - name: Verify virtual environment activation run: | From ac9024c9a064c34545d7aa6e452cd1a91005ce7f Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 15:33:32 -0400 Subject: [PATCH 27/55] add delete old cache files --- .github/workflows/pythonpip.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 8e15a9be73..9667d1a0ea 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -17,6 +17,8 @@ on: jobs: build: runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ github.token }} strategy: matrix: python-version: ['3.9', '3.10', '3.11', '3.12'] From af9af478ef77815880b5b8f025c0d9efdf34e229 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 15:34:53 -0400 Subject: [PATCH 28/55] add delete old cache files --- .github/workflows/pythonpip.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 9667d1a0ea..cf829b62bc 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -31,13 +31,13 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Delete old cached file with same python version - run: | - echo "Current Cached files list" - gh cache list - gh cache delete ${{ runner.os }}-venv-${{ matrix.python-version }}- - echo "After Deletion Cached files list" - gh cache list + # - name: Delete old cached file with same python version + # run: | + # echo "Current Cached files list" + # gh cache list + # gh cache delete ${{ runner.os }}-venv-${{ matrix.python-version }}- + # echo "After Deletion Cached files list" + # gh cache list - name: Set up virtual environment run: | From 49a7ff876bf030168587c2cb3c44c68e6874baf8 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 15:39:54 -0400 Subject: [PATCH 29/55] add delete old cache files --- .github/workflows/pythonpip.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index cf829b62bc..49d2a10e2c 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -1,7 +1,7 @@ name: Cache Python and pip dependencies # This workflow is triggered every 2 days and updates the Python # and pip dependencies cache -# TODO: this needs to delete old cache too!!!! +# TODO: this needs to delete old cache too!!!!! on: push: # TODO: remove while merging branches: From 7d68c2bb8e7e92b45b365bfe1d480565bc1b9b10 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 15:47:12 -0400 Subject: [PATCH 30/55] add delete old cache files --- .github/workflows/pythonpip.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 49d2a10e2c..7b40323208 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -31,13 +31,13 @@ jobs: with: python-version: ${{ matrix.python-version }} - # - name: Delete old cached file with same python version - # run: | - # echo "Current Cached files list" - # gh cache list - # gh cache delete ${{ runner.os }}-venv-${{ matrix.python-version }}- - # echo "After Deletion Cached files list" - # gh cache list + - name: Delete old cached file with same python version + run: | + echo "Current Cached files list" + gh cache list + gh cache delete ${{ runner.os }}-venv-${{ matrix.python-version }}- + echo "After Deletion Cached files list" + gh cache list - name: Set up virtual environment run: | From c42e16ba48ceef3b8e0989cbfeb010b3d6b03438 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 21:54:34 -0400 Subject: [PATCH 31/55] try * for unknown cache --- .github/workflows/pythonpip.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 7b40323208..2ad5be890e 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -35,7 +35,7 @@ jobs: run: | echo "Current Cached files list" gh cache list - gh cache delete ${{ runner.os }}-venv-${{ matrix.python-version }}- + gh cache delete ${{ runner.os }}-venv-${{ matrix.python-version }}-* echo "After Deletion Cached files list" gh cache list From bfa3448113ab4b16dce10eaf78cfdec66bf6a954 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 21:59:18 -0400 Subject: [PATCH 32/55] try for unknown cache --- .github/workflows/pythonpip.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 2ad5be890e..4a7193defa 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -35,8 +35,12 @@ jobs: run: | echo "Current Cached files list" gh cache list - gh cache delete ${{ runner.os }}-venv-${{ matrix.python-version }}-* - echo "After Deletion Cached files 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 cache with key: $cache_key" + gh cache delete "$cache_key" + done + echo "Remaining Cached files list" gh cache list - name: Set up virtual environment From cf85a3bf80a3665dbc628af99b915d7b15cff0e2 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 22:14:45 -0400 Subject: [PATCH 33/55] split regression 6, notebook tests to 4 parts, remove redundant prints --- .github/workflows/nbtests.yml | 4 ++-- .github/workflows/pythonpip.yml | 3 --- .github/workflows/regression_test.yml | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/nbtests.yml b/.github/workflows/nbtests.yml index b4155101aa..ef9557778a 100644 --- a/.github/workflows/nbtests.yml +++ b/.github/workflows/nbtests.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: python-version: ['3.10'] - group: [1, 2] + group: [1, 2, 3, 4] steps: - uses: actions/checkout@v4 @@ -57,5 +57,5 @@ jobs: pytest -v --nbmake "./docs/notebooks" \ --nbmake-timeout=2000 \ --ignore=./docs/notebooks/zernike_eval.ipynb \ - --splits 2 \ + --splits 4 \ --group ${{ matrix.group }} \ diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 4a7193defa..5c15b88f5d 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -40,8 +40,6 @@ jobs: echo "Deleting cache with key: $cache_key" gh cache delete "$cache_key" done - echo "Remaining Cached files list" - gh cache list - name: Set up virtual environment run: | @@ -58,7 +56,6 @@ jobs: key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }} restore-keys: | ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }} - ${{ runner.os }}-venv-${{ matrix.python-version }}- - name: Verify virtual environment activation run: | diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index cafdbd24c7..a11691dd8b 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: python-version: ['3.10'] - group: [1, 2, 3, 4, 5, 6, 7, 8] + group: [1, 2, 3, 4, 5, 6] steps: - uses: actions/checkout@v4 @@ -65,7 +65,7 @@ jobs: --mpl \ --mpl-results-path=mpl_results.html \ --mpl-generate-summary=html \ - --splits 8 \ + --splits 6 \ --group ${{ matrix.group }} \ --splitting-algorithm least_duration \ --db ./prof.db From feec422dca8b86825b2ebf0e78860c5351301a32 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 22:33:23 -0400 Subject: [PATCH 34/55] try splitting benchmarks --- .github/workflows/benchmark.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 7ab698aee1..f08d4e42f6 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -25,6 +25,7 @@ jobs: strategy: matrix: python-version: ['3.9'] + group: [1, 2] steps: # Enable tmate debugging of manually-triggered workflows if the input option was provided @@ -66,7 +67,10 @@ jobs: python -m pytest benchmark_cpu_small.py -vv \ --benchmark-save='Latest_Commit' \ --durations=0 \ - --benchmark-save-data + --benchmark-save-data \ + --splits 2 \ + --group ${{ matrix.group }} \ + --splitting-algorithm least_duration - name: Checkout current master uses: actions/checkout@v4 @@ -85,7 +89,10 @@ jobs: python -m pytest benchmark_cpu_small.py -vv \ --benchmark-save='master' \ --durations=0 \ - --benchmark-save-data + --benchmark-save-data \ + --splits 2 \ + --group ${{ matrix.group }} \ + --splitting-algorithm least_duration - name: put benchmark results in same folder run: | From 8314f2d74810c842411359a71e7d2d305cf0c8e0 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 22:42:38 -0400 Subject: [PATCH 35/55] re distribute splitting --- .github/workflows/nbtests.yml | 5 +++-- .github/workflows/pythonpip.yml | 10 +--------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/nbtests.yml b/.github/workflows/nbtests.yml index ef9557778a..bafbc9ec22 100644 --- a/.github/workflows/nbtests.yml +++ b/.github/workflows/nbtests.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: python-version: ['3.10'] - group: [1, 2, 3, 4] + group: [1, 2, 3] steps: - uses: actions/checkout@v4 @@ -57,5 +57,6 @@ jobs: pytest -v --nbmake "./docs/notebooks" \ --nbmake-timeout=2000 \ --ignore=./docs/notebooks/zernike_eval.ipynb \ - --splits 4 \ + --splits 3 \ --group ${{ matrix.group }} \ + --splitting-algorithm least_duration diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 5c15b88f5d..2bccf574bc 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -1,15 +1,7 @@ -name: Cache Python and pip dependencies +name: Cache dependencies # This workflow is triggered every 2 days and updates the Python # and pip dependencies cache -# TODO: this needs to delete old cache too!!!!! on: - push: # TODO: remove while merging - branches: - - master - - dev - pull_request: - branches: - - master schedule: - cron: '30 4 */2 * *' # This triggers the workflow at 4:30 AM every 2 days workflow_dispatch: From f8bfd3b1b94a9531dc530fcdf353782feb2bbe8a Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 22:54:57 -0400 Subject: [PATCH 36/55] something broke cache use, try to revert --- .github/workflows/benchmark.yml | 4 +--- .github/workflows/black.yml | 4 +--- .github/workflows/nbtests.yml | 4 +--- .github/workflows/pythonpip.yml | 11 +++++++++-- .github/workflows/regression_test.yml | 4 +--- .github/workflows/unittest.yml | 4 +--- 6 files changed, 14 insertions(+), 17 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index f08d4e42f6..1cddcd59f9 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -46,9 +46,7 @@ jobs: uses: actions/cache/restore@v4 with: 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-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }} + key: ${{ 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' diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 9961e11999..ae35872788 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -22,9 +22,7 @@ jobs: uses: actions/cache/restore@v4 with: 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-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }} + key: ${{ 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' diff --git a/.github/workflows/nbtests.yml b/.github/workflows/nbtests.yml index bafbc9ec22..b24690ce2e 100644 --- a/.github/workflows/nbtests.yml +++ b/.github/workflows/nbtests.yml @@ -36,9 +36,7 @@ jobs: uses: actions/cache/restore@v4 with: 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-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }} + key: ${{ 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' diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 2bccf574bc..fb80ad5fc9 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -2,6 +2,13 @@ name: Cache dependencies # This workflow is triggered every 2 days and updates the Python # and pip dependencies cache on: + push: + branches: + - master + - dev + pull_request: + branches: + - master schedule: - cron: '30 4 */2 * *' # This triggers the workflow at 4:30 AM every 2 days workflow_dispatch: @@ -45,9 +52,9 @@ jobs: uses: actions/cache@v3 with: path: ./.venv-${{ matrix.python-version }} - key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('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 }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }} + ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}-${{ hashFiles('requirements.txt') }} - name: Verify virtual environment activation run: | diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index a11691dd8b..bb6c5afc3b 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -35,9 +35,7 @@ jobs: uses: actions/cache/restore@v4 with: 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-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }} + key: ${{ 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' diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index eeaf53190f..be287970b2 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -41,9 +41,7 @@ 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') }}--${{ hashFiles('requirements.txt') }} - restore-keys: | - ${{ runner.os }}-venv-${{ matrix.combos.python_version }}-${{ hashFiles('devtools/dev-requirements.txt') }}--${{ hashFiles('requirements.txt') }} + key: ${{ 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' From f8600b51f91907f6d0a029aa5c80a5f988dedb5f Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 23:01:35 -0400 Subject: [PATCH 37/55] remove extra run for caching --- .github/workflows/pythonpip.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index fb80ad5fc9..d50b3246ab 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -2,13 +2,6 @@ name: Cache dependencies # This workflow is triggered every 2 days and updates the Python # and pip dependencies cache on: - push: - branches: - - master - - dev - pull_request: - branches: - - master schedule: - cron: '30 4 */2 * *' # This triggers the workflow at 4:30 AM every 2 days workflow_dispatch: From eec95c35e841e69d05ad2961f57f69ca9c741de8 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 23:08:24 -0400 Subject: [PATCH 38/55] try 1 --- .github/workflows/pythonpip.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index d50b3246ab..cb89a5158a 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -42,12 +42,10 @@ jobs: - name: Cache Python environment id: cache-env - uses: actions/cache@v3 + uses: actions/cache/save@v3 with: 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-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}-${{ hashFiles('requirements.txt') }} - name: Verify virtual environment activation run: | From 56128e236275f5e1d5389a06de0242f9aad11b92 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 23:15:18 -0400 Subject: [PATCH 39/55] try 2 --- .github/workflows/benchmark.yml | 3 +++ .github/workflows/black.yml | 3 +++ .github/workflows/nbtests.yml | 3 +++ .github/workflows/regression_test.yml | 3 +++ .github/workflows/unittest.yml | 3 +++ 5 files changed, 15 insertions(+) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 1cddcd59f9..998e092a06 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -22,6 +22,8 @@ concurrency: jobs: benchmark: runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ github.token }} strategy: matrix: python-version: ['3.9'] @@ -51,6 +53,7 @@ jobs: - 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 pip install --upgrade pip diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index ae35872788..333ee99a36 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -6,6 +6,8 @@ jobs: black_format: runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ github.token }} strategy: matrix: python-version: ['3.10'] @@ -27,6 +29,7 @@ jobs: - 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 pip install --upgrade pip diff --git a/.github/workflows/nbtests.yml b/.github/workflows/nbtests.yml index b24690ce2e..fe7e63ee39 100644 --- a/.github/workflows/nbtests.yml +++ b/.github/workflows/nbtests.yml @@ -18,6 +18,8 @@ jobs: notebook_tests: runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ github.token }} strategy: matrix: python-version: ['3.10'] @@ -41,6 +43,7 @@ jobs: - 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 pip install --upgrade pip diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index bb6c5afc3b..1ce163c36b 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -18,6 +18,8 @@ jobs: regression_tests: runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ github.token }} strategy: matrix: python-version: ['3.10'] @@ -40,6 +42,7 @@ jobs: - 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 pip install --upgrade pip diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index be287970b2..bbd06f3bcc 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -18,6 +18,8 @@ jobs: unit_tests: runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ github.token }} strategy: matrix: combos: [{group: 1, python_version: '3.9'}, @@ -46,6 +48,7 @@ jobs: - 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.combos.python_version }} source .venv-${{ matrix.combos.python_version }}/bin/activate python -m pip install --upgrade pip From f4f7474ebd99453c1c823a7dd5e2c03a123649cc Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 23:22:38 -0400 Subject: [PATCH 40/55] make a single hash for the cache name, re write caches --- .github/workflows/benchmark.yml | 2 +- .github/workflows/black.yml | 2 +- .github/workflows/nbtests.yml | 2 +- .github/workflows/pythonpip.yml | 9 ++++++++- .github/workflows/regression_test.yml | 2 +- .github/workflows/unittest.yml | 2 +- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 998e092a06..79bce84235 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -48,7 +48,7 @@ jobs: uses: actions/cache/restore@v4 with: path: .venv-${{ matrix.python-version }} - key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}-${{ hashFiles('requirements.txt') }} + key: ${{ runner.os }}-venv-${{ matrix.python-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' diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 333ee99a36..ae0be3dbb7 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -24,7 +24,7 @@ jobs: uses: actions/cache/restore@v4 with: path: .venv-${{ matrix.python-version }} - key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}-${{ hashFiles('requirements.txt') }} + key: ${{ runner.os }}-venv-${{ matrix.python-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' diff --git a/.github/workflows/nbtests.yml b/.github/workflows/nbtests.yml index fe7e63ee39..4dcbe54e14 100644 --- a/.github/workflows/nbtests.yml +++ b/.github/workflows/nbtests.yml @@ -38,7 +38,7 @@ jobs: uses: actions/cache/restore@v4 with: path: .venv-${{ matrix.python-version }} - key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}-${{ hashFiles('requirements.txt') }} + key: ${{ runner.os }}-venv-${{ matrix.python-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' diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index cb89a5158a..18e4dc540d 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -2,6 +2,13 @@ name: Cache dependencies # This workflow is triggered every 2 days and updates the Python # and pip dependencies cache on: + push: + branches: + - master + - dev + pull_request: + branches: + - master schedule: - cron: '30 4 */2 * *' # This triggers the workflow at 4:30 AM every 2 days workflow_dispatch: @@ -45,7 +52,7 @@ jobs: uses: actions/cache/save@v3 with: path: ./.venv-${{ matrix.python-version }} - key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}-${{ hashFiles('requirements.txt') }} + key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} - name: Verify virtual environment activation run: | diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 1ce163c36b..c2a254df7b 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -37,7 +37,7 @@ jobs: uses: actions/cache/restore@v4 with: path: .venv-${{ matrix.python-version }} - key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}-${{ hashFiles('requirements.txt') }} + key: ${{ runner.os }}-venv-${{ matrix.python-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' diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index bbd06f3bcc..41140b2314 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -43,7 +43,7 @@ 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') }}-${{ hashFiles('requirements.txt') }} + key: ${{ runner.os }}-venv-${{ matrix.combos.python_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' From dfdb2917414ea0588c47c47290503f8aebd8704a Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 23:26:58 -0400 Subject: [PATCH 41/55] try 3 --- .github/workflows/pythonpip.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 18e4dc540d..93f3fbd14f 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -2,13 +2,6 @@ name: Cache dependencies # This workflow is triggered every 2 days and updates the Python # and pip dependencies cache on: - push: - branches: - - master - - dev - pull_request: - branches: - - master schedule: - cron: '30 4 */2 * *' # This triggers the workflow at 4:30 AM every 2 days workflow_dispatch: From 168777fb577486ec76fb380e78ffb2bdf975060b Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 23:52:37 -0400 Subject: [PATCH 42/55] add dummy test --- .github/workflows/dummy_test.yml | 32 ++++++++++++++++++++++++++++++++ .github/workflows/pythonpip.yml | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/dummy_test.yml diff --git a/.github/workflows/dummy_test.yml b/.github/workflows/dummy_test.yml new file mode 100644 index 0000000000..35c2231576 --- /dev/null +++ b/.github/workflows/dummy_test.yml @@ -0,0 +1,32 @@ +name: Dummy Test +# This workflow is triggered every 2 days and updates the Python +# and pip dependencies cache +on: ["pull_request"] + +jobs: + build: + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ github.token }} + strategy: + matrix: + python-version: ['3.9'] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: List all cached files + run: | + echo "Current Cached files list" + gh cache list + + - name: Check cache hit + run: | + echo "Checking cache hit" + echo "Cache key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }}" + gh cache get ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} || echo "Cache miss" diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 93f3fbd14f..5a02279453 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -42,7 +42,7 @@ jobs: - name: Cache Python environment id: cache-env - uses: actions/cache/save@v3 + uses: actions/cache@v4 with: path: ./.venv-${{ matrix.python-version }} key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} From 4c549624d44363ac15232aef31f5d280488838ea Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 23:54:24 -0400 Subject: [PATCH 43/55] add dummy test --- .github/workflows/dummy_test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dummy_test.yml b/.github/workflows/dummy_test.yml index 35c2231576..2fa43f0677 100644 --- a/.github/workflows/dummy_test.yml +++ b/.github/workflows/dummy_test.yml @@ -27,6 +27,7 @@ jobs: - name: Check cache hit run: | - echo "Checking cache hit" + echo "Checking cache delete" echo "Cache key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }}" - gh cache get ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} || echo "Cache miss" + gh cache delete ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} + gh cache list From c00781d71ba200817ac5644abf59d63857b7197a Mon Sep 17 00:00:00 2001 From: YigitElma Date: Fri, 23 Aug 2024 23:58:02 -0400 Subject: [PATCH 44/55] add dummy test --- .github/workflows/dummy_test.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dummy_test.yml b/.github/workflows/dummy_test.yml index 2fa43f0677..b737698484 100644 --- a/.github/workflows/dummy_test.yml +++ b/.github/workflows/dummy_test.yml @@ -10,7 +10,7 @@ jobs: GH_TOKEN: ${{ github.token }} strategy: matrix: - python-version: ['3.9'] + python-version: ['3.10'] steps: - uses: actions/checkout@v4 @@ -25,9 +25,15 @@ jobs: echo "Current Cached files list" gh cache list - - name: Check cache hit - run: | - echo "Checking cache delete" - echo "Cache key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }}" - gh cache delete ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} - gh cache list + # - name: Check cache hit + # run: | + # echo "Checking cache delete" + # echo "Cache key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }}" + # gh cache delete ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} + # gh cache list + - 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') }} From 03d1c6f81cc1b06b252be11189763b4b5a7fdb15 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Sat, 24 Aug 2024 00:01:31 -0400 Subject: [PATCH 45/55] add dummy test --- .github/workflows/dummy_test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dummy_test.yml b/.github/workflows/dummy_test.yml index b737698484..4918d0955f 100644 --- a/.github/workflows/dummy_test.yml +++ b/.github/workflows/dummy_test.yml @@ -37,3 +37,5 @@ jobs: with: path: .venv-${{ matrix.python-version }} key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} + restore-keys: | + ${{ runner.os }}-venv-${{ matrix.python-version }}- From d3094196159627fd090335da89c8529d155437d2 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Sat, 24 Aug 2024 00:06:37 -0400 Subject: [PATCH 46/55] add dummy test --- .github/workflows/pythonpip.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 5a02279453..0d2c9271b1 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -2,6 +2,13 @@ name: Cache dependencies # This workflow is triggered every 2 days and updates the Python # and pip dependencies cache on: + push: + branches: + - master + - dev + pull_request: + branches: + - master schedule: - cron: '30 4 */2 * *' # This triggers the workflow at 4:30 AM every 2 days workflow_dispatch: @@ -44,7 +51,7 @@ jobs: id: cache-env uses: actions/cache@v4 with: - path: ./.venv-${{ matrix.python-version }} + path: .venv-${{ matrix.python-version }} key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} - name: Verify virtual environment activation From 1af745314fe6a315b236b5cc0fefcc34a0e225a0 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Sat, 24 Aug 2024 00:08:34 -0400 Subject: [PATCH 47/55] add dummy test --- .github/workflows/dummy_test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dummy_test.yml b/.github/workflows/dummy_test.yml index 4918d0955f..d924c19bdb 100644 --- a/.github/workflows/dummy_test.yml +++ b/.github/workflows/dummy_test.yml @@ -22,6 +22,8 @@ jobs: - name: List all cached files run: | + ls + pwd echo "Current Cached files list" gh cache list From bbc655b7d9fcd439542f842b34bd2144956d15c4 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Sat, 24 Aug 2024 00:11:27 -0400 Subject: [PATCH 48/55] add dummy test --- .github/workflows/pythonpip.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/pythonpip.yml index 0d2c9271b1..ad3192a4c6 100644 --- a/.github/workflows/pythonpip.yml +++ b/.github/workflows/pythonpip.yml @@ -2,13 +2,6 @@ name: Cache dependencies # This workflow is triggered every 2 days and updates the Python # and pip dependencies cache on: - push: - branches: - - master - - dev - pull_request: - branches: - - master schedule: - cron: '30 4 */2 * *' # This triggers the workflow at 4:30 AM every 2 days workflow_dispatch: From c4fe39c29b318d155af7b243d80a761dd276ccd4 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Sat, 24 Aug 2024 00:13:43 -0400 Subject: [PATCH 49/55] remove dummy test --- .github/workflows/dummy_test.yml | 43 -------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 .github/workflows/dummy_test.yml diff --git a/.github/workflows/dummy_test.yml b/.github/workflows/dummy_test.yml deleted file mode 100644 index d924c19bdb..0000000000 --- a/.github/workflows/dummy_test.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Dummy Test -# This workflow is triggered every 2 days and updates the Python -# and pip dependencies cache -on: ["pull_request"] - -jobs: - build: - runs-on: ubuntu-latest - env: - GH_TOKEN: ${{ github.token }} - strategy: - matrix: - python-version: ['3.10'] - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: List all cached files - run: | - ls - pwd - echo "Current Cached files list" - gh cache list - - # - name: Check cache hit - # run: | - # echo "Checking cache delete" - # echo "Cache key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }}" - # gh cache delete ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }} - # gh cache list - - 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') }} - restore-keys: | - ${{ runner.os }}-venv-${{ matrix.python-version }}- From eaf110fde548cfedfaca58262bd4a38180f56337 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Sat, 24 Aug 2024 00:49:33 -0400 Subject: [PATCH 50/55] test --- .github/workflows/benchmark.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 79bce84235..516eb26e0c 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -35,8 +35,8 @@ jobs: uses: mxschmitt/action-tmate@v3 if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} + # with: + # ref: ${{ github.event.pull_request.head.sha }} - name: Set up Python uses: actions/setup-python@v5 From 506687476a486b9ceca7e98ef09b80c7a774d35c Mon Sep 17 00:00:00 2001 From: YigitElma Date: Mon, 26 Aug 2024 16:10:28 -0400 Subject: [PATCH 51/55] remove python 3.8 from weekly tests, we stoped using it 3 months ago --- .github/workflows/scheduled.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml index a584db5cb8..2fb309bd8a 100644 --- a/.github/workflows/scheduled.yml +++ b/.github/workflows/scheduled.yml @@ -11,11 +11,10 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - combos: [{group: 1, python_version: '3.8'}, - {group: 2, python_version: '3.9'}, - {group: 3, python_version: '3.10'}, - {group: 4, python_version: '3.11'}, - {group: 5, python_version: '3.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'}] steps: - uses: actions/checkout@v4 @@ -37,6 +36,6 @@ jobs: lscpu python -m pytest -v -m unit \ --durations=0 \ - --splits 5 \ + --splits 4 \ --group ${{ matrix.combos.group }} \ --splitting-algorithm least_duration From 8b480b58464af0ca1cc580e20b03d2de82c281f4 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Mon, 26 Aug 2024 17:36:13 -0400 Subject: [PATCH 52/55] re run tests --- .github/workflows/benchmark.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 516eb26e0c..79bce84235 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -35,8 +35,8 @@ jobs: uses: mxschmitt/action-tmate@v3 if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} - uses: actions/checkout@v4 - # with: - # ref: ${{ github.event.pull_request.head.sha }} + with: + ref: ${{ github.event.pull_request.head.sha }} - name: Set up Python uses: actions/setup-python@v5 From 4a73d3a52f551a30abd7bc48e1ab7964ba522934 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Tue, 27 Aug 2024 01:42:09 -0400 Subject: [PATCH 53/55] update benchmarks to work with splitting --- .github/workflows/benchmark.yml | 30 ++++-- tests/benchmarks/compare_bench_results.py | 107 +++++++++++++--------- 2 files changed, 90 insertions(+), 47 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 79bce84235..3655d67034 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -59,7 +59,7 @@ jobs: python -m pip install --upgrade pip pip install -r devtools/dev-requirements.txt - - name: Benchmark with pytest-benchmark + - name: Benchmark with pytest-benchmark (PR) run: | source .venv-${{ matrix.python-version }}/bin/activate pwd @@ -81,7 +81,8 @@ jobs: - name: Checkout benchmarks from PR head run: git checkout ${{ github.event.pull_request.head.sha }} -- tests/benchmarks - - name: Benchmark with pytest-benchmark + + - name: Benchmark with pytest-benchmark (MASTER) run: | source .venv-${{ matrix.python-version }}/bin/activate pwd @@ -95,7 +96,7 @@ jobs: --group ${{ matrix.group }} \ --splitting-algorithm least_duration - - name: put benchmark results in same folder + - name: Put benchmark results in same folder run: | source .venv-${{ matrix.python-version }}/bin/activate pwd @@ -108,15 +109,32 @@ jobs: cp $t1 compare_results cp $t2 compare_results + - name: Download artifact + if: always() + uses: actions/download-artifact@v4 + with: + pattern: benchmark_artifact_* + path: tests/benchmarks + + - name: Unzip artifacts if downloaded + run: | + cd tests/benchmarks + ls + if [ -f tests/benchmarks/benchmark_artifact_*.zip ]; then + unzip tests/benchmarks/benchmark_artifact_*.zip -d tests/benchmarks + else + echo "No benchmark artifact file found." + fi + - name: Compare latest commit results to the master branch results run: | source .venv-${{ matrix.python-version }}/bin/activate - pwd cd tests/benchmarks + pwd python compare_bench_results.py cat commit_msg.txt - - name: comment PR with the results + - name: Comment PR with the results uses: thollander/actions-comment-pull-request@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -128,5 +146,5 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: benchmark_artifact + name: benchmark_artifact_${{ matrix.group }} path: tests/benchmarks/.benchmarks diff --git a/tests/benchmarks/compare_bench_results.py b/tests/benchmarks/compare_bench_results.py index 09fc580e22..ab56816153 100644 --- a/tests/benchmarks/compare_bench_results.py +++ b/tests/benchmarks/compare_bench_results.py @@ -8,60 +8,87 @@ cwd = os.getcwd() data = {} -master_idx = 0 -latest_idx = 0 +master_idx = [] +latest_idx = [] commit_ind = 0 -for diret in os.walk(cwd + "/compare_results"): - files = diret[2] - timing_file_exists = False - - for filename in files: - if filename.find("json") != -1: # check if json output file is present - try: - filepath = os.path.join(diret[0], filename) - with open(filepath) as f: - print(filepath) - curr_data = json.load(f) - commit_id = curr_data["commit_info"]["id"][0:7] - data[commit_id] = curr_data - if filepath.find("master") != -1: - master_idx = commit_ind - elif filepath.find("Latest_Commit") != -1: - latest_idx = commit_ind - commit_ind += 1 - except Exception as e: - print(e) - continue - +folder_names = [] + +for root1, dirs1, files1 in os.walk(cwd): + for dir_name in dirs1: + if dir_name == "compare_results" or dir_name.startswith("benchmark_artifact"): + print("Including folder: " + dir_name) + # "compare_results" is the folder containing the benchmark results from this + # job "benchmark_artifact" is the folder containing the benchmark results + # from other jobs if in future we change the Python version of the + # benchmarks, we will need to update this + # "/Linux-CPython--64bit" + files2walk = ( + os.walk(cwd + "/" + dir_name) + if dir_name == "compare_results" + else os.walk(cwd + "/" + dir_name + "/Linux-CPython-3.9-64bit") + ) + for root, dirs, files in files2walk: + for filename in files: + if ( + filename.find("json") != -1 + ): # check if json output file is present + try: + filepath = os.path.join(root, filename) + with open(filepath) as f: + curr_data = json.load(f) + commit_id = curr_data["commit_info"]["id"][0:7] + data[commit_ind] = curr_data["benchmarks"] + if filepath.find("master") != -1: + master_idx.append(commit_ind) + elif filepath.find("Latest_Commit") != -1: + latest_idx.append(commit_ind) + commit_ind += 1 + except Exception as e: + print(e) + continue # need arrays of size [ num benchmarks x num commits ] # one for mean one for stddev # number of benchmark cases -num_benchmarks = len(data[list(data.keys())[0]]["benchmarks"]) -num_commits = len(list(data.keys())) +num_benchmarks = 0 +# sum number of benchmarks splitted into different jobs +for split in master_idx: + num_benchmarks += len(data[split]) +num_commits = 2 + times = np.zeros([num_benchmarks, num_commits]) stddevs = np.zeros([num_benchmarks, num_commits]) commit_ids = [] test_names = [None] * num_benchmarks -for id_num, commit_id in enumerate(data.keys()): - commit_ids.append(commit_id) - for i, test in enumerate(data[commit_id]["benchmarks"]): +id_num = 0 +for i in master_idx: + for test in data[i]: t_mean = test["stats"]["median"] t_stddev = test["stats"]["iqr"] - times[i, id_num] = t_mean - stddevs[i, id_num] = t_stddev - test_names[i] = test["name"] - + times[id_num, 0] = t_mean + stddevs[id_num, 0] = t_stddev + test_names[id_num] = test["name"] + id_num = id_num + 1 + +id_num = 0 +for i in latest_idx: + for test in data[i]: + t_mean = test["stats"]["median"] + t_stddev = test["stats"]["iqr"] + times[id_num, 1] = t_mean + stddevs[id_num, 1] = t_stddev + test_names[id_num] = test["name"] + id_num = id_num + 1 # we say a slowdown/speedup has occurred if the mean time difference is greater than # n_sigma * (stdev of time delta) significance = 3 # n_sigmas of normal distribution, ie z score of 3 colors = [" "] * num_benchmarks # g if faster, w if similar, r if slower -delta_times_ms = times[:, latest_idx] - times[:, master_idx] -delta_stds_ms = np.sqrt(stddevs[:, latest_idx] ** 2 + stddevs[:, master_idx] ** 2) -delta_times_pct = delta_times_ms / times[:, master_idx] * 100 -delta_stds_pct = delta_stds_ms / times[:, master_idx] * 100 +delta_times_ms = times[:, 1] - times[:, 0] +delta_stds_ms = np.sqrt(stddevs[:, 1] ** 2 + stddevs[:, 0] ** 2) +delta_times_pct = delta_times_ms / times[:, 0] * 100 +delta_stds_pct = delta_stds_ms / times[:, 0] * 100 for i, (pct, spct) in enumerate(zip(delta_times_pct, delta_stds_pct)): if pct > 0 and pct > significance * spct: colors[i] = "-" # this will make the line red @@ -72,8 +99,6 @@ # now make the commit message, save as a txt file # benchmark_name dt(%) dt(s) t_new(s) t_old(s) -print(latest_idx) -print(master_idx) commit_msg_lines = [ "```diff", f"| {'benchmark_name':^38} | {'dt(%)':^22} | {'dt(s)':^22} |" @@ -88,8 +113,8 @@ line = f"{colors[i]:>1}{test_names[i]:<39} |" line += f" {f'{dpct:+6.2f} +/- {sdpct:4.2f}':^22} |" line += f" {f'{dt:+.2e} +/- {sdt:.2e}':^22} |" - line += f" {f'{times[i, latest_idx]:.2e} +/- {stddevs[i, latest_idx]:.1e}':^22} |" - line += f" {f'{times[i, master_idx]:.2e} +/- {stddevs[i, master_idx]:.1e}':^22} |" + line += f" {f'{times[i, 1]:.2e} +/- {stddevs[i, 1]:.1e}':^22} |" + line += f" {f'{times[i, 0]:.2e} +/- {stddevs[i, 0]:.1e}':^22} |" commit_msg_lines.append(line) From b4e50601e0da178fe1afc778942da5979718eeb0 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Tue, 27 Aug 2024 13:32:54 -0400 Subject: [PATCH 54/55] make workflow file names consistent and more descriptive, use specific matplotlib version for tests --- .github/workflows/{pythonpip.yml => cache_dependencies.yml} | 0 .github/workflows/{nbtests.yml => notebook_tests.yml} | 0 .github/workflows/{regression_test.yml => regression_tests.yml} | 2 ++ .github/workflows/{unittest.yml => unit_tests.yml} | 2 ++ .github/workflows/{scheduled.yml => weekly_tests.yml} | 0 5 files changed, 4 insertions(+) rename .github/workflows/{pythonpip.yml => cache_dependencies.yml} (100%) rename .github/workflows/{nbtests.yml => notebook_tests.yml} (100%) rename .github/workflows/{regression_test.yml => regression_tests.yml} (97%) rename .github/workflows/{unittest.yml => unit_tests.yml} (97%) rename .github/workflows/{scheduled.yml => weekly_tests.yml} (100%) diff --git a/.github/workflows/pythonpip.yml b/.github/workflows/cache_dependencies.yml similarity index 100% rename from .github/workflows/pythonpip.yml rename to .github/workflows/cache_dependencies.yml diff --git a/.github/workflows/nbtests.yml b/.github/workflows/notebook_tests.yml similarity index 100% rename from .github/workflows/nbtests.yml rename to .github/workflows/notebook_tests.yml diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_tests.yml similarity index 97% rename from .github/workflows/regression_test.yml rename to .github/workflows/regression_tests.yml index c2a254df7b..021d25a7a3 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_tests.yml @@ -47,6 +47,7 @@ jobs: source .venv-${{ matrix.python-version }}/bin/activate python -m pip install --upgrade pip pip install -r devtools/dev-requirements.txt + pip install matplotlib==3.7.2 - name: Set Swap Space uses: pierotofy/set-swap-space@master @@ -56,6 +57,7 @@ jobs: - name: Test with pytest run: | source .venv-${{ matrix.python-version }}/bin/activate + pip install matplotlib==3.7.2 pwd lscpu python -m pytest -v -m regression\ diff --git a/.github/workflows/unittest.yml b/.github/workflows/unit_tests.yml similarity index 97% rename from .github/workflows/unittest.yml rename to .github/workflows/unit_tests.yml index 41140b2314..bf95d25b28 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unit_tests.yml @@ -53,6 +53,7 @@ jobs: source .venv-${{ matrix.combos.python_version }}/bin/activate python -m pip install --upgrade pip pip install -r devtools/dev-requirements.txt + pip install matplotlib==3.7.2 - name: Set Swap Space uses: pierotofy/set-swap-space@master @@ -62,6 +63,7 @@ jobs: - name: Test with pytest run: | source .venv-${{ matrix.combos.python_version }}/bin/activate + pip install matplotlib==3.7.2 pwd lscpu python -m pytest -v -m unit \ diff --git a/.github/workflows/scheduled.yml b/.github/workflows/weekly_tests.yml similarity index 100% rename from .github/workflows/scheduled.yml rename to .github/workflows/weekly_tests.yml From 7318805f27b210af2f5c02cad53ef4932c6234b7 Mon Sep 17 00:00:00 2001 From: YigitElma Date: Tue, 27 Aug 2024 14:33:50 -0400 Subject: [PATCH 55/55] add pip list --- .github/workflows/cache_dependencies.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cache_dependencies.yml b/.github/workflows/cache_dependencies.yml index ad3192a4c6..d1f63538c5 100644 --- a/.github/workflows/cache_dependencies.yml +++ b/.github/workflows/cache_dependencies.yml @@ -52,3 +52,4 @@ jobs: source .venv-${{ matrix.python-version }}/bin/activate python --version pip --version + pip list