Skip to content

Commit 3ea4014

Browse files
huydhnkulinseth
authored andcommitted
Set check-latest to false when setup python and pip cache in CI (pytorch#87621)
I missed the fine print in https://github.com/actions/setup-python/blob/main/README.md#caching-packages-dependencies when setting up the cache using setup-python GHA > Restored cache will not be used if the requirements.txt file is not updated for a long time and a newer version of the dependency is available which can lead to an increase in total build time. The latter part is important because it implies that even with the cache, pip will still try to check if a newer version exists and that part can be flaky, i.e. https://github.com/pytorch/pytorch/actions/runs/3313764038/jobs/5472180293 This undesired behavior can be turned off by setting the advance option `check-latest` to false https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#check-latest-version. Per my understanding, this should tell pip install in these workflows to use the local cached copy of the package avoiding the need to query pypi every single time. `check-latest` was added quite recently actions/setup-python#406, so `actionlint-1.6.15` fails to recognize it. Thus, this PR also upgrades `actionlint` to the latest 1.6.21 to pass the linter check. Here is an example error from 1.6.15 from https://github.com/pytorch/pytorch/actions/runs/3315388073/jobs/5475918454: ``` >>> Lint for .github/workflows/lint.yml: Error (ACTIONLINT) [action] input "check-latest" is not defined in action "actions/setup-python@v4". available inputs are "architecture", "cache", "cache-dependency-path", "python-version", "python-version-file", "token" 25 | with: 26 | python-version: 3.8 27 | architecture: x64 >>> 28 | check-latest: false 29 | cache: pip 30 | cache-dependency-path: | 31 | **/.github/requirements-gha-cache.txt ``` Pull Request resolved: pytorch#87621 Approved by: https://github.com/ZainRizvi
1 parent c65a40d commit 3ea4014

8 files changed

Lines changed: 29 additions & 18 deletions

File tree

‎.github/actions/setup-win/action.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ runs:
5757
- name: Setup Python3
5858
uses: actions/setup-python@v4
5959
with:
60-
python-version: "3.x"
60+
python-version: 3.x
61+
check-latest: false
6162
cache: pip
6263
cache-dependency-path: |
6364
**/requirements.txt

‎.github/workflows/lint.yml‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,14 @@ jobs:
2525
with:
2626
python-version: 3.8
2727
architecture: x64
28+
check-latest: false
2829
cache: pip
2930
cache-dependency-path: |
3031
**/.github/requirements-gha-cache.txt
3132
32-
- name: Install lintrunner
33-
uses: nick-fields/retry@3e91a01664abd3c5cd539100d10d33b9c5b68482
34-
with:
35-
timeout_minutes: 5
36-
max_attempts: 3
37-
command: pip install lintrunner==0.9.2
33+
- name: Install requirements
34+
run: |
35+
pip install -r .github/requirements-gha-cache.txt --user
3836
3937
- name: Initialize lint dependencies
4038
run: lintrunner init
@@ -87,6 +85,7 @@ jobs:
8785
with:
8886
python-version: 3.x
8987
architecture: x64
88+
check-latest: false
9089
cache: pip
9190
cache-dependency-path: |
9291
**/requirements.txt
@@ -151,6 +150,7 @@ jobs:
151150
with:
152151
python-version: 3.x
153152
architecture: x64
153+
check-latest: false
154154
cache: pip
155155
cache-dependency-path: |
156156
**/requirements.txt
@@ -242,7 +242,8 @@ jobs:
242242
with:
243243
python-version: 3.8
244244
architecture: x64
245-
cache: 'pip'
245+
check-latest: false
246+
cache: pip
246247
cache-dependency-path: |
247248
**/.github/requirements-gha-cache.txt
248249
@@ -275,6 +276,7 @@ jobs:
275276
with:
276277
python-version: 3.8
277278
architecture: x64
279+
check-latest: false
278280
cache: pip
279281
cache-dependency-path: |
280282
**/requirements.txt
@@ -320,21 +322,24 @@ jobs:
320322
with:
321323
python-version: 3.5
322324
architecture: x64
325+
check-latest: false
323326
cache: pip
324327
cache-dependency-path: |
325-
**/.github/requirements-gha-cache.txt
328+
**/requirements.txt
326329
- name: Setup Python 3.8
327330
if: matrix.test_type != 'older_python_version'
328331
uses: actions/setup-python@v4
329332
with:
330333
python-version: 3.8
331334
architecture: x64
335+
check-latest: false
332336
cache: pip
333337
cache-dependency-path: |
334-
**/.github/requirements-gha-cache.txt
338+
**/requirements.txt
335339
- name: Install torch
336340
if: matrix.test_type == 'with_torch'
337341
run: |
342+
pip install -r requirements.txt
338343
# Doesn't really matter what torch version, we just need ANY torch installed
339344
pip install 'torch==1.*'
340345
- name: Run collect_env.py

‎.github/workflows/pr-labels.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ jobs:
1717
- name: Set up python
1818
uses: actions/setup-python@v4
1919
with:
20-
python-version: '3.10'
20+
python-version: 3.10
21+
check-latest: false
2122
cache: pip
2223
cache-dependency-path: |
2324
**/.github/requirements-gha-cache.txt

‎.github/workflows/revert.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ jobs:
2323
with:
2424
python-version: 3.8
2525
architecture: x64
26-
cache: 'pip'
26+
check-latest: false
27+
cache: pip
2728
- run: pip install pyyaml==6.0
2829

2930
- name: Setup committer id

‎.github/workflows/trymerge.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ jobs:
2222
uses: actions/setup-python@v4
2323
with:
2424
python-version: 3.8
25-
cache: 'pip'
25+
check-latest: false
26+
cache: pip
2627
architecture: x64
2728
- run: pip install pyyaml==6.0
2829

‎.github/workflows/tryrebase.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ jobs:
2222
with:
2323
python-version: 3.8
2424
architecture: x64
25-
cache: 'pip'
25+
check-latest: false
26+
cache: pip
2627
- run: pip install pyyaml==6.0
2728

2829
- name: Setup committer id

‎.github/workflows/update-viablestrict.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
with:
2525
python-version: 3.8
2626
architecture: x64
27+
check-latest: false
2728
cache: pip
2829
cache-dependency-path: |
2930
**/.circleci/docker/requirements-ci.txt

‎tools/linter/adapters/s3_init_config.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
},
2828
"actionlint": {
2929
"Darwin": {
30-
"download_url": "https://oss-clang-format.s3.us-east-2.amazonaws.com/actionlint/1.6.15/Darwin_amd64/actionlint",
31-
"hash": "e9a0e0b17e54cfefe7964b6aa1da8921b1f8f2318c31c0eb1a17ea3e8ab10db2"
30+
"download_url": "https://oss-clang-format.s3.us-east-2.amazonaws.com/actionlint/1.6.21/Darwin_amd64/actionlint",
31+
"hash": "b354db83815384d3c3a07f68f44b30cb0a70899757a0d185d7322de9952e8813"
3232
},
3333
"Linux": {
34-
"download_url": "https://oss-clang-format.s3.us-east-2.amazonaws.com/actionlint/1.6.15/Linux_arm64/actionlint",
35-
"hash": "d6b45ae67f29a2bf9ddd226071ddd8f158fdf2992e8515a06838e5fef90f3a2d"
34+
"download_url": "https://oss-clang-format.s3.us-east-2.amazonaws.com/actionlint/1.6.21/Linux_arm64/actionlint",
35+
"hash": "025ac157db121b33971ef24af72d73d71cda3cb1e3a94795bb2708ef4032ca76"
3636
}
3737
}
3838
}

0 commit comments

Comments
 (0)