Skip to content

Commit

Permalink
Add comments explaining different hashFiles() argument
Browse files Browse the repository at this point in the history
The other cache keys for our GHA jobs are in the format '**/<filename>' so that
any file with that name is used in the repository. However, for Python packages
they may have a 'setup.py' as part of their internal codebase that does not
impact environment requirements. As a result we only want to use the 'setup.py'
that is in the root of the repository and is used to install the package.

Co-authored-by: dav3r <david.redmin@trio.dhs.gov>
  • Loading branch information
mcdonnnj and dav3r committed Jun 7, 2021
1 parent 249bbbb commit 449eef4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
path: |
${{ env.PIP_CACHE_DIR }}
${{ env.PRE_COMMIT_CACHE_DIR }}
# We do not use '**/setup.py' in the cache key so only the 'setup.py'
# file in the root of the repository is used. This is in case a Python
# package were to have a 'setup.py' as part of its internal codebase.
key: "${{ env.BASE_CACHE_KEY }}\
${{ hashFiles('**/requirements-test.txt') }}-\
${{ hashFiles('**/requirements.txt') }}-\
Expand Down Expand Up @@ -60,6 +63,9 @@ jobs:
py${{ steps.setup-python.outputs.python-version }}-"
with:
path: ${{ env.PIP_CACHE_DIR }}
# We do not use '**/setup.py' in the cache key so only the 'setup.py'
# file in the root of the repository is used. This is in case a Python
# package were to have a 'setup.py' as part of its internal codebase.
key: "${{ env.BASE_CACHE_KEY }}\
${{ hashFiles('**/requirements-test.txt') }}-\
${{ hashFiles('**/requirements.txt') }}-\
Expand Down Expand Up @@ -97,6 +103,9 @@ jobs:
py${{ steps.setup-python.outputs.python-version }}-"
with:
path: ${{ env.PIP_CACHE_DIR }}
# We do not use '**/setup.py' in the cache key so only the 'setup.py'
# file in the root of the repository is used. This is in case a Python
# package were to have a 'setup.py' as part of its internal codebase.
key: "${{ env.BASE_CACHE_KEY }}\
${{ hashFiles('**/requirements-test.txt') }}-\
${{ hashFiles('**/requirements.txt') }}-\
Expand Down Expand Up @@ -129,6 +138,9 @@ jobs:
py${{ steps.setup-python.outputs.python-version }}-"
with:
path: ${{ env.PIP_CACHE_DIR }}
# We do not use '**/setup.py' in the cache key so only the 'setup.py'
# file in the root of the repository is used. This is in case a Python
# package were to have a 'setup.py' as part of its internal codebase.
key: "${{ env.BASE_CACHE_KEY }}\
${{ hashFiles('**/requirements.txt') }}-\
${{ hashFiles('setup.py') }}"
Expand Down

0 comments on commit 449eef4

Please sign in to comment.