Skip to content

Commit

Permalink
ci: cache poetry install
Browse files Browse the repository at this point in the history
  • Loading branch information
mariugul committed Aug 25, 2024
1 parent a1c59bd commit 5e43713
Showing 1 changed file with 54 additions and 22 deletions.
76 changes: 54 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,26 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}

- uses: Gr1N/setup-poetry@v9
- name: Cache Poetry Install
id: cache-poetry
uses: actions/cache@v4
with:
poetry-version: ${{ env.POETRY_VERSION }}

path: |
/opt/poetry
~/.cache/pypoetry
.venv
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('**/pyproject.toml') }}

- name: Install Poetry
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
export POETRY_HOME=/opt/poetry
python3 -m venv $POETRY_HOME
$POETRY_HOME/bin/pip install poetry==1.8.2
$POETRY_HOME/bin/poetry --version
- uses: actions/cache@v4
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
- run: poetry --version
- name: Add Poetry to PATH
run: echo "/opt/poetry/bin" >> $GITHUB_PATH

- name: Install dev dependencies
id: install
Expand Down Expand Up @@ -82,15 +92,26 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}

- uses: Gr1N/setup-poetry@v9
- name: Cache Poetry Install
id: cache-poetry
uses: actions/cache@v4
with:
poetry-version: ${{ env.POETRY_VERSION }}
path: |
/opt/poetry
~/.cache/pypoetry
.venv
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('**/pyproject.toml') }}

- name: Install Poetry
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
export POETRY_HOME=/opt/poetry
python3 -m venv $POETRY_HOME
$POETRY_HOME/bin/pip install poetry==1.8.2
$POETRY_HOME/bin/poetry --version
- uses: actions/cache@v4
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
- run: poetry --version
- name: Add Poetry to PATH
run: echo "/opt/poetry/bin" >> $GITHUB_PATH

- name: Install dependencies
id: install
Expand Down Expand Up @@ -123,15 +144,26 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}

- uses: Gr1N/setup-poetry@v9
- name: Cache Poetry Install
id: cache-poetry
uses: actions/cache@v4
with:
poetry-version: ${{ env.POETRY_VERSION }}
path: |
/opt/poetry
~/.cache/pypoetry
.venv
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('**/pyproject.toml') }}

- name: Install Poetry
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
export POETRY_HOME=/opt/poetry
python3 -m venv $POETRY_HOME
$POETRY_HOME/bin/pip install poetry==1.8.2
$POETRY_HOME/bin/poetry --version
- uses: actions/cache@v4
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
- run: poetry --version
- name: Add Poetry to PATH
run: echo "/opt/poetry/bin" >> $GITHUB_PATH

- name: Run Poetry Lock
run: poetry lock
Expand Down

0 comments on commit 5e43713

Please sign in to comment.