Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache poetry and dependencies steps and pin poetry version in config file #7

Merged
merged 7 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion .github/actions/ci-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,55 @@ runs:
with:
python-version: ${{ inputs.python-version }}


- name: Install pipx
run: |
sudo apt install pipx
pipx ensurepath
shell: bash

- name: Read Poetry Version
id: read-poetry-version
run: |
poetry_version=$(cat .github/actions/ci-setup/config.yml | grep poetry_version | awk '{print $2}')
echo "poetry_version=$poetry_version" >> $GITHUB_ENV
shell: bash

- name: Cache Poetry
id: cache-poetry
uses: actions/cache@v3
with:
path: ~/.local
key: ${{ runner.os }}-poetry-${{ env.poetry_version }}

- name: Install poetry
run: pipx install poetry==1.8.2
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: pipx install poetry==${{ env.poetry_version }}
shell: bash

- name: Add poetry to PATH
run: echo "export PATH=$PATH:$HOME/.local/bin" >> $GITHUB_ENV
shell: bash

- name: Configure Poetry
run: poetry config virtualenvs.in-project true
shell: bash

- name: Set python version
run: poetry env use python
shell: bash

- name: Cache Poetry Dependencies
id: cache-poetry-dependencies
uses: actions/cache@v3
with:
path: |
~/.local
**/poetry.lock
.venv
key: ${{ runner.os }}-poetry-dependencies-${{ hashFiles('**/pyproject.toml') }}

- name: Install dependencies
if: steps.cache-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install
shell: bash
1 change: 1 addition & 0 deletions .github/actions/ci-setup/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
poetry_version: "1.8.2"
Loading