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

feat: Adds working_directory Input to Action #14

Merged
merged 6 commits into from
Jan 1, 2020
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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
with:
python_version: ${{ matrix.python_version }}
poetry_version: ${{ matrix.poetry_version }}
working_directory: '.'
release:
needs: ci
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ jobs:
with:
python_version: 3.8.0
poetry_version: 0.12.17
working_directory: ./working_dir # Optional, defaults to '.'
args: install
- name: Run pytest
uses: abatilo/[email protected]
with:
python_version: 3.8.0
poetry_version: 0.12.17
working_directory: ./working_dir
args: run python -m pytest --cov=src --cov-branch --cov-fail-under=100 tests/
```

Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ inputs:
description: 'The version of poetry to install'
required: true
default: '0.12.17'
working_directory:
description: 'The directory to run poetry commands in.'
required: false
default: '.'
20 changes: 14 additions & 6 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
#!/bin/sh
#!/bin/bash
set -e
pythonVersion="$INPUT_PYTHON_VERSION"
poetryVersion="$INPUT_POETRY_VERSION"
pyenv latest install $pythonVersion
pyenv latest global $pythonVersion
pyenv latest install "$INPUT_PYTHON_VERSION"
pyenv latest global "$INPUT_PYTHON_VERSION"
pip install -r /requirements.txt
pip install poetry==$poetryVersion
pip install poetry=="$INPUT_POETRY_VERSION"
pyenv rehash

# Push current directory on to stack and cd (if possible) into working dir.
pushd . > /dev/null 2>&1 || return
cd "$INPUT_WORKING_DIRECTORY" || return

# Fix for virtualenvs defined in .python-version.
pyenv local "$INPUT_PYTHON_VERSION"

sh -c "poetry $*"

# Step back to starting directory.
popd > /dev/null 2>&1 || return