-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: use optimized caching strategy for Poetry
- Loading branch information
1 parent
3cca72a
commit a6e902f
Showing
6 changed files
with
81 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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 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 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,50 @@ | ||
name: Poetry Install | ||
description: Run `poetry install` with optional artifact and metadata caching | ||
|
||
inputs: | ||
args: | ||
description: Arguments for `poetry install` | ||
cache: | ||
description: Enable transparent Poetry artifact and metadata caching | ||
default: 'true' | ||
|
||
outputs: | ||
cache-hit: | ||
description: Whether an exact cache hit occured | ||
value: ${{ steps.cache.outputs.cache-hit }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- run: printf 'cache-dir=%s\n' "$(poetry config cache-dir)" >> $GITHUB_OUTPUT | ||
id: poetry-config | ||
shell: bash | ||
|
||
# Bust the cache every 24 hours to prevent it from expanding over time. | ||
- run: printf 'date=%s\n' "$(date -I)" >> $GITHUB_OUTPUT | ||
id: get-date | ||
if: inputs.cache == 'true' | ||
shell: bash | ||
|
||
- uses: actions/cache@v4 | ||
id: cache | ||
if: inputs.cache == 'true' | ||
with: | ||
path: | | ||
${{ steps.poetry-config.outputs.cache-dir }}/artifacts | ||
${{ steps.poetry-config.outputs.cache-dir }}/cache | ||
key: poetry-${{ steps.get-date.outputs.date }}-${{ runner.os }}-${{ hashFiles('pyproject.toml', 'poetry.lock') }} | ||
# The cache is cross-platform, and other platforms are used to seed cache misses. | ||
restore-keys: | | ||
poetry-${{ steps.get-date.outputs.date }}-${{ runner.os }}- | ||
poetry-${{ steps.get-date.outputs.date }}- | ||
enableCrossOsArchive: true | ||
|
||
- run: poetry install ${{ inputs.args }} | ||
shell: bash | ||
|
||
- run: poetry env info | ||
shell: bash | ||
|
||
- run: poetry show | ||
shell: bash |
This file contains 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 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 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