Skip to content

Commit

Permalink
Merge pull request #16 from HassanAbouelela/checkout-option
Browse files Browse the repository at this point in the history
Checkout Option
  • Loading branch information
HassanAbouelela authored Jun 26, 2023
2 parents 9e49798 + ce01205 commit f2deb38
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ linked in the index below.
> {name}_v{version}
Example:
> setup-python_v1.4.0
> setup-python_v1.4.1

### Support Policy
Expand All @@ -33,13 +33,13 @@ An index of all the currently maintained scripts, their description, and the lat

| Name | Version | Status | Description |
|--------------------------------|---------|-------------------------------|------------------------------------------------------|
| [Setup Python](./setup-python) | 1.4.0 | [![tests][sp_badge]][sp_link] | Setup a [poetry][Poetry]-managed python environment. |
| [Setup Python](./setup-python) | 1.4.1 | [![tests][sp_badge]][sp_link] | Setup a [poetry][Poetry]-managed python environment. |


[License]: https://shields.io/github/license/HassanAbouelela/actions
[Semver-Logo]: https://img.shields.io/badge/versioning-semver-informational
[Semver]: https://semver.org/
[Poetry]: https://python-poetry.org/

[sp_badge]: https://img.shields.io/github/workflow/status/HassanAbouelela/actions/Test%20Setup-Python/main?label=Tests
[sp_badge]: https://img.shields.io/github/actions/workflow/status/HassanAbouelela/actions/test_setup_python.yaml?label=Tests&branch=main
[sp_link]: https://github.com/HassanAbouelela/actions/actions/workflows/test_setup_python.yaml?query=branch%3Amain
5 changes: 3 additions & 2 deletions setup-python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It also handles caching of pre-commit if you happen to be using that.
You can use this action as follows:
```yaml
- name: Install Python Dependencies
uses: HassanAbouelela/actions/setup-python@setup-python_v1.4.0
uses: HassanAbouelela/actions/setup-python@setup-python_v1.4.1
with:
install_args: "--without dev"
python_version: '3.10'
Expand All @@ -25,6 +25,7 @@ The following inputs are required to use this action.
| use_cache | bool | true | Enable or disable the usage of cache, even if it is available. |
| cache_pre-commit | bool | true | Enable caching and restoring pre-commit installs. Only a pre-commit config at the root workspace will be cached properly. |
| install_args | string | | A string placed after the `poetry install` command, which can contain extra options. |
| checkout | bool | true | Perform a checkout of the repository in the action. If this is false, this must be done manually before running the action. |
| dev (deprecated) | bool | true | This argument is deprecated. Please use `install_args` with the appropriate options. This option will be removed in the next major release. |

### Outputs
Expand All @@ -36,5 +37,5 @@ The following outputs are produced by the action:
| python-version | string | The full Python semver version used. |


[badge]: https://img.shields.io/github/workflow/status/HassanAbouelela/actions/Test%20Setup-Python/main?label=Tests
[badge]: https://img.shields.io/github/actions/workflow/status/HassanAbouelela/actions/test_setup_python.yaml?label=Tests&branch=main
[link]: https://github.com/HassanAbouelela/actions/actions/workflows/test_setup_python.yaml?query=branch%3Amain
10 changes: 8 additions & 2 deletions setup-python/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ inputs:
required: false
default: "poetry"

checkout:
description: "Perform a checkout of the repository in the action. If this is false, this must be done manually before running the action."
required: false
default: "true"

dev:
description: "Install developer dependencies."
required: false
Expand All @@ -51,6 +56,7 @@ runs:
steps:
# Checkout the code to get access to project files such as poetry and pre-commit configs
- uses: actions/checkout@v3
if: ${{ inputs.checkout }} == true

# Install python in our workflow
- name: Setup python
Expand All @@ -67,7 +73,7 @@ runs:
path: |
~/.cache/pypoetry
~/.cache/pip
key: "python-${{ runner.os }}-v1.4.0-\
key: "python-${{ runner.os }}-v1.4.1-\
${{ steps.python_setup.outputs.python-version }}-${{ inputs.dev }}-${{ inputs.working_dir }}-${{ inputs.poetry_version }}-${{ inputs.install_args }}-\
${{ hashFiles(format('{0}/pyproject.toml', inputs.working_dir), format('{0}/poetry.lock', inputs.working_dir)) }}"

Expand All @@ -77,7 +83,7 @@ runs:
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: "precommit-${{ runner.os }}-v1.4.0-\
key: "precommit-${{ runner.os }}-v1.4.1-\
${{ steps.python_setup.outputs.python-version }}-${{ inputs.dev }}-${{ inputs.working_dir }}-${{ inputs.poetry_version }}-\
${{ hashFiles('./.pre-commit-config.yaml') }}"

Expand Down
2 changes: 1 addition & 1 deletion setup-python/tests/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "project"
version = "1.4.0"
version = "1.4.1"
description = "Simple project to test the setup-python action."
authors = ["Hassan Abouelela <hassan@hassanamr.com>"]
license = "MIT"
Expand Down

0 comments on commit f2deb38

Please sign in to comment.