Skip to content

Commit b2d77a6

Browse files
authored
CI: Reset cache weekly (#7686)
* Reset cache weekly * Update ci_test-base.yml * Update docs-checks.yml * Update ci_test-mnodes.yml * Update release-pypi.yml * Remove if latest
1 parent 7e2f7e9 commit b2d77a6

File tree

5 files changed

+32
-10
lines changed

5 files changed

+32
-10
lines changed

.github/workflows/ci_test-base.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ jobs:
3333
run: |
3434
brew install libomp # https://github.com/pytorch/pytorch/issues/20030
3535
36+
- name: Weekly reset caching
37+
run: echo "::set-output name=period::$(python -c 'import time ; days = time.time() / 60 / 60 / 24 ; print(int(days / 7))' 2>&1)"
38+
id: times
39+
3640
# Note: This uses an internal pip API and may not always work
3741
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
3842
- name: Get pip cache
@@ -44,9 +48,9 @@ jobs:
4448
uses: actions/cache@v2
4549
with:
4650
path: ${{ steps.pip-cache.outputs.dir }}
47-
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ hashFiles('requirements.txt') }}
51+
key: ${{ runner.os }}-pip-td${{ steps.times.outputs.period }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ hashFiles('requirements.txt') }}
4852
restore-keys: |
49-
${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.requires }}-
53+
${{ runner.os }}-pip-td${{ steps.times.outputs.period }}-py${{ matrix.python-version }}-${{ matrix.requires }}-
5054
5155
- name: Install dependencies
5256
run: |

.github/workflows/ci_test-full.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ jobs:
4141
with:
4242
python-version: ${{ matrix.python-version }}
4343

44+
- name: Weekly reset caching
45+
run: echo "::set-output name=period::$(python -c 'import time ; days = time.time() / 60 / 60 / 24 ; print(int(days / 7))' 2>&1)"
46+
id: times
47+
4448
- name: Update pip
4549
run: |
4650
# needed for `pip cache` command
@@ -87,9 +91,9 @@ jobs:
8791
uses: actions/cache@v2
8892
with:
8993
path: ${{ steps.pip-cache.outputs.dir }}
90-
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.release }}-${{ matrix.requires }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements/extra.txt') }}
94+
key: ${{ runner.os }}-pip-td${{ steps.times.outputs.period }}-py${{ matrix.python-version }}-${{ matrix.release }}-${{ matrix.requires }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements/extra.txt') }}
9195
restore-keys: |
92-
${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.release }}-${{ matrix.requires }}-
96+
${{ runner.os }}-pip-td${{ steps.times.outputs.period }}-py${{ matrix.python-version }}-${{ matrix.release }}-${{ matrix.requires }}-
9397
9498
- name: Pull checkpoints from S3
9599
run: |

.github/workflows/ci_test-mnodes.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,19 @@ jobs:
6565
with:
6666
python-version: ${{ matrix.python-version }}
6767

68+
- name: Weekly reset caching
69+
run: echo "::set-output name=period::$(python -c 'import time ; days = time.time() / 60 / 60 / 24 ; print(int(days / 7))' 2>&1)"
70+
id: times
71+
6872
# Note: This uses an internal pip API and may not always work
6973
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
7074
- name: Cache pip
7175
uses: actions/cache@v2
7276
with:
7377
path: ~/.cache/pip
74-
key: ${{ runner.os }}-pip-multi-node
78+
key: ${{ runner.os }}-pip-td${{ steps.times.outputs.period }}-multi-node
7579
restore-keys: |
76-
${{ runner.os }}-pip-
80+
${{ runner.os }}-pip-td${{ steps.times.outputs.period }}-
7781
7882
- name: Install dependencies
7983
run: |

.github/workflows/docs-checks.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,19 @@ jobs:
2929
with:
3030
python-version: 3.7
3131

32+
- name: Weekly reset caching
33+
run: echo "::set-output name=period::$(python -c 'import time ; days = time.time() / 60 / 60 / 24 ; print(int(days / 7))' 2>&1)"
34+
id: times
35+
3236
# Note: This uses an internal pip API and may not always work
3337
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
3438
- name: Cache pip
3539
uses: actions/cache@v2
3640
with:
3741
path: ~/.cache/pip
38-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
42+
key: ${{ runner.os }}-pip-td${{ steps.times.outputs.period }}-${{ hashFiles('requirements.txt') }}
3943
restore-keys: |
40-
${{ runner.os }}-pip-
44+
${{ runner.os }}-pip-td${{ steps.times.outputs.period }}-
4145
4246
- name: Install dependencies
4347
run: |

.github/workflows/release-pypi.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,23 @@ jobs:
8787
needs: [build-package, publish-package]
8888
steps:
8989
- uses: actions/checkout@v2
90+
9091
- uses: actions/setup-python@v2
9192
with:
9293
python-version: 3.7
94+
95+
- name: Weekly reset caching
96+
run: echo "::set-output name=period::$(python -c 'import time ; days = time.time() / 60 / 60 / 24 ; print(int(days / 7))' 2>&1)"
97+
id: times
98+
9399
# Note: This uses an internal pip API and may not always work
94100
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
95101
- name: Cache pip
96102
uses: actions/cache@v2
97103
with:
98104
path: ~/.cache/pip
99-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
100-
restore-keys: ${{ runner.os }}-pip-
105+
key: ${{ runner.os }}-pip-td${{ steps.times.outputs.period }}-${{ hashFiles('requirements.txt') }}
106+
restore-keys: ${{ runner.os }}-pip-td${{ steps.times.outputs.period }}-
101107

102108
- name: Install dependencies
103109
run: |

0 commit comments

Comments
 (0)