-
Notifications
You must be signed in to change notification settings - Fork 212
[MNT] CI add pip dependency caching #1352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
chrisholder
wants to merge
17
commits into
main
Choose a base branch
from
ci-pip-cache
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
54e669b
added precomputation capability
hadifawaz1999 a544afa
docstrings
hadifawaz1999 57dd19e
bug fix
hadifawaz1999 7038aa1
fixes copy and optional
hadifawaz1999 ab6e724
fixes copy and optional
hadifawaz1999 f33673e
added shape_dtw to param tests
chrisholder e146ce0
moved to utils
chrisholder 4a6fa39
added bounding tests to shape_dtw
chrisholder a659648
removed redundent test file
chrisholder 44707a6
added comment
chrisholder 8a765f6
pyproject
chrisholder 43fcc6e
merge main
chrisholder d9a54df
CI setup for pip caching
chrisholder 78a1e97
reset changes accidently committed
chrisholder a1a5f21
added spaces
chrisholder 6b9fbbd
address comments
chrisholder 172ac58
remove tar
chrisholder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Sets up optimal pip environment and restores cache | ||
description: "Sets up optimal pip environment and restores cache" | ||
|
||
inputs: | ||
runner_os: | ||
description: "The runner os" | ||
required: true | ||
python_version: | ||
description: "The python version" | ||
required: true | ||
restore_cache: | ||
description: "Whether to restore the cache" | ||
required: false | ||
|
||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
# Get current date for cache restore | ||
- name: Get Current Date | ||
run: echo "CURRENT_DATE=$(date +'%d/%m/%Y')" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
# For some reason on windows I/O on the C drive is really slow. To get around this | ||
# we set the python, and the cache directories to the D drive which doesn't | ||
# have slow I/O. | ||
# See: https://github.com/actions/runner-images/issues/8755 for more details | ||
- name: Set Python environment for Windows in powershell | ||
if: ${{ inputs.runner_os == 'Windows' }} | ||
shell: pwsh | ||
# See https://docs.python.org/3/using/cmdline.html for env variable details | ||
run: | | ||
$Env:PYTHONUSERBASE = "D:\python\userbase" | ||
$Env:PIP_CACHE_DIR = "D:\pip\cache" | ||
$Env:PYTHONPYCACHEPREFIX = "D:\pycache" | ||
|
||
- if: ${{ inputs.runner_os == 'Windows' }} | ||
name: Set Python environment for windows | ||
shell: bash | ||
run: | | ||
echo "PYTHONUSERBASE=D:\python\userbase" >> $GITHUB_ENV | ||
echo "PIP_CACHE_DIR=D:\pip\cache" >> $GITHUB_ENV | ||
echo "PYTHONPYCACHEPREFIX=D:\pycache" >> $GITHUB_ENV | ||
- if: ${{ inputs.runner_os == 'Linux' }} | ||
name: Set Python environment for linux | ||
run: echo "PIP_CACHE_DIR=~/.cache/pip" >> $GITHUB_ENV | ||
shell: bash | ||
- if: ${{ inputs.runner_os == 'macOS' }} | ||
name: Set Python environment for macos | ||
run: echo "PIP_CACHE_DIR=~/Library/Caches/pip" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Restore cache | ||
uses: actions/cache/restore@v3 | ||
if: ${{ inputs.restore_cache == 'true' }} | ||
with: | ||
path: ${{ env.PIP_CACHE_DIR }} | ||
key: ${{ inputs.runner_os }}-${{ inputs.python_version }}-pip-${{ env.CURRENT_DATE }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Update pip cache every night | ||
|
||
on: | ||
schedule: | ||
# every day at 1:30 AM UTC | ||
- cron: "30 1 * * *" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
create-dependency-cache: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ ubuntu-20.04, macOS-13, windows-2022 ] | ||
python-version: [ "3.8", "3.10", "3.12" ] | ||
|
||
steps: | ||
- name: Checkout main | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set optimal environment variables for pip cache | ||
uses: ./.github/actions/pip_cache | ||
with: | ||
runner_os: ${{ runner.os }} | ||
python_version: ${{ matrix.python-version }} | ||
restore_cache: "false" | ||
|
||
- name: Setup Python 3.10 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install CPU version of pytorch on linux | ||
uses: nick-fields/retry@v3 | ||
if: steps.cache.outputs.cache-hit != 'true' && runner.os == 'Linux' | ||
with: | ||
timeout_minutes: 30 | ||
max_attempts: 3 | ||
command: python -m pip install torch --index-url https://download.pytorch.org/whl/cpu | ||
|
||
# Install extras and dev on everything except Linux 3.10 | ||
- name: Install aeon and dependencies | ||
uses: nick-fields/retry@v3 | ||
if: runner.os != 'Linux' || matrix.python-version != '3.10' | ||
with: | ||
timeout_minutes: 30 | ||
max_attempts: 3 | ||
command: python -m pip install .[all_extras,dev] | ||
|
||
# Install extras, dev and binder on Linux 3.10 (Examples run on this) | ||
- name: Install notebook if on linux 3.10 | ||
uses: nick-fields/retry@v3 | ||
if: runner.os == 'Linux' && matrix.python-version == '3.10' | ||
with: | ||
timeout_minutes: 30 | ||
max_attempts: 3 | ||
command: python -m pip install .[all_extras,dev,binder] | ||
|
||
- name: Show dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: python -m pip list | ||
|
||
- name: Save new cache | ||
uses: actions/cache/save@v4 | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
with: | ||
path: ${{ env.PIP_CACHE_DIR }} | ||
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ env.CURRENT_DATE }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,6 +104,13 @@ jobs: | |
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Set optimal environment variables for pip cache and restore | ||
uses: ./.github/actions/pip_cache | ||
with: | ||
runner_os: ${{ runner.os }} | ||
python_version: ${{ matrix.python-version }} | ||
restore_cache: "true" | ||
Comment on lines
+107
to
+112
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason for these two jobs only? |
||
|
||
- name: Use numba cache to set env variables and restore cache | ||
uses: ./.github/actions/numba_cache | ||
with: | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why? Is this the only action which does this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed this completely now since it doesn't make a difference now we're using the windows D drive (it seems to have fixed all the cache restoring issues)