Skip to content

Commit

Permalink
Update CI script to the latest verion of Poetry installer (1.2.0) (#188)
Browse files Browse the repository at this point in the history
* Update CI script to the latest verion of Poetry installer (1.2.0)

* Remove unnecessary code
  • Loading branch information
whitphx authored Aug 31, 2022
1 parent 32c0a78 commit ea99c51
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,30 @@ jobs:
with:
python-version: ${{ env.python-version }}

- name: Install poetry
run: |
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
# Ref: https://github.com/python-poetry/poetry/blob/de0b32c245c72568cf546090600d4626917cd3a4/.github/workflows/main.yml#L46-L60
# Ref: https://github.com/python-poetry/poetry/blob/f51a2c7427a046bcb71434e8ff29f6ce137301f7/.github/workflows/main.yml#L51-L79
- 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: Bootstrap poetry
run: |
curl -sL https://install.python-poetry.org | python - -y
- name: Update PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

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

- name: Set up cache
uses: actions/cache@v3
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}

- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
shell: bash
run: timeout 10s pip --version || rm -rf .venv

## Set up Node environment
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,27 +189,30 @@ jobs:
with:
python-version: ${{ env.python-version }}

- name: Install poetry
run: |
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
# Ref: https://github.com/python-poetry/poetry/blob/de0b32c245c72568cf546090600d4626917cd3a4/.github/workflows/main.yml#L46-L60
# Ref: https://github.com/python-poetry/poetry/blob/f51a2c7427a046bcb71434e8ff29f6ce137301f7/.github/workflows/main.yml#L51-L79
- 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: Bootstrap poetry
run: |
curl -sL https://install.python-poetry.org | python - -y
- name: Update PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

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

- name: Set up cache
uses: actions/cache@v3
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}

- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
shell: bash
run: timeout 10s pip --version || rm -rf .venv

## Set up Node environment
Expand Down

0 comments on commit ea99c51

Please sign in to comment.