-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(docs): Use checkout@v3's (v3.1) poetry cache
- Loading branch information
Showing
1 changed file
with
7 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ jobs: | |
matrix: | ||
python-version: ["3.10"] | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/checkout@v3 | ||
- name: Filter changed file paths to outputs | ||
uses: dorny/[email protected] | ||
id: changes | ||
|
@@ -33,49 +33,21 @@ jobs: | |
if: steps.changes.outputs.docs == 'true' || steps.changes.outputs.root_docs == 'true' || steps.changes.outputs.python_files == 'true' | ||
run: echo "PUBLISH=$(echo true)" >> $GITHUB_ENV | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Get full Python version | ||
id: full-python-version | ||
shell: bash | ||
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") | ||
|
||
- name: Install poetry | ||
run: | | ||
curl -O -sSL https://install.python-poetry.org/install-poetry.py | ||
python install-poetry.py -y --version 1.1.12 | ||
echo "PATH=${HOME}/.poetry/bin:${PATH}" >> $GITHUB_ENV | ||
rm install-poetry.py | ||
- name: Add ~/.local/bin to PATH | ||
run: echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
|
||
- name: Get poetry cache paths from config | ||
run: | | ||
echo "poetry_virtualenvs_path=$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV | ||
echo "poetry_virtualenvs_path=$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV | ||
- name: Configure poetry | ||
shell: bash | ||
run: poetry config virtualenvs.in-project true | ||
|
||
- name: Set up cache | ||
uses: actions/cache@v2 | ||
id: cache | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
path: | | ||
.venv | ||
{{ env.poetry_cache_dir }} | ||
{{ env.poetry_virtualenvs_path }} | ||
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'poetry' | ||
|
||
- name: Ensure cache is healthy | ||
if: steps.cache.outputs.cache-hit == 'true' | ||
shell: bash | ||
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv | ||
- name: Add ~/.local/bin to PATH | ||
run: echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
|
||
- name: Install dependencies [w/ docs] | ||
run: poetry install --extras "docs lint" | ||
|