Skip to content

Commit

Permalink
Improve Pip/Poetry caching strategy in CI context
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmayer committed Apr 24, 2023
1 parent 0a8ad9e commit 804964e
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,22 @@ jobs:
retry: true
linksToSkip: "https://pypi.org/project/pelican-touch/"

- name: Set up Pipx cache
uses: actions/cache/save@v3
id: pipx-cache
with:
path: ~/.local/pipx/.cache
key: pipx-cache

- name: Install Poetry
run: pipx install poetry

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: Set Poetry cache
uses: actions/cache@v3
id: poetry-cache
with:
path: ~/.cache/pypoetry/virtualenvs
key: poetry-${{ hashFiles('**/poetry.lock') }}

- name: Install Poetry
run: python -m pip install poetry
cache: "poetry"
cache-dependency-path: "pyproject.toml"

- name: Install dependencies
run: |
Expand All @@ -52,6 +54,16 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Restore Pipx cache
uses: actions/cache/restore@v3
id: pipx-cache
with:
path: ~/.cache/pip
key: pipx-cache

- name: Install Poetry
run: pipx install poetry

- name: Setup Python
uses: actions/setup-python@v4
with:
Expand All @@ -60,9 +72,9 @@ jobs:
- name: Check release
id: check_release
run: |
python -m pip install --upgrade pip
python -m pip install poetry githubrelease httpx==0.18.2 autopub
python -m pip install githubrelease httpx==0.18.2 autopub
echo "release=$(autopub check)" >> $GITHUB_OUTPUT
- name: Publish
if: ${{ steps.check_release.outputs.release=='' }}
env:
Expand Down

0 comments on commit 804964e

Please sign in to comment.