Skip to content

Commit

Permalink
Add example use to README, and add TOC
Browse files Browse the repository at this point in the history
  • Loading branch information
connortann committed Feb 14, 2022
1 parent 35ca911 commit 9c3e1f7
Showing 1 changed file with 54 additions and 16 deletions.
70 changes: 54 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ The action installs Poetry, adds executables to the runner system path, and sets

> Inspired by [dschep's](https://github.com/dschep) [archived poetry action](https://github.com/dschep/install-poetry-action).
- [Usage](#usage)
- [Defaults](#defaults)
- [Workflow examples and tips](#workflow-examples-and-tips)
- [Testing](#testing)
- [Testing using a matrix](#testing-using-a-matrix)
- [Codecov upload](#codecov-upload)
- [Running on Windows](#running-on-windows)
- [Caching on Windows runners](#caching-on-windows-runners)
- [Virtualenv variations](#virtualenv-variations)
- [Caching the Poetry installation](#caching-the-poetry-installation)
- [Installing Poetry Plugins](#installing-poetry-plugins)
- [Contributing](#contributing)
- [License](#license)
- [Showing your support](#showing-your-support)

## Usage

If all you need is default Poetry, simply add this to your workflow:
Expand Down Expand Up @@ -73,16 +88,7 @@ This section contains a collection of workflow examples to try and help
- Demonstrate how to implement caching for performance improvements
- Clarify the implications of different settings

Some examples are a bit long, so here are some links

- [Testing](#testing)
- [Testing (using an OS matrix)](#testing-using-a-matrix)
- [Codecov upload](#codecov-upload)
- [Running on Windows](#running-on-windows)
- [Virtualenv variations](#virtualenv-variations)
- [Caching the Poetry installation](#caching-the-poetry-installation)

#### Testing
### Testing

A basic example workflow for running your test-suite can be structured like this.

Expand Down Expand Up @@ -145,7 +151,7 @@ jobs:
coverage report
```

#### Testing using a matrix
### Testing using a matrix

A more extensive example for running your test-suite on combinations of multiple operating systems, python versions, or
package-versions, can be structured like this.
Expand Down Expand Up @@ -244,7 +250,7 @@ jobs:
coverage report
```

#### Codecov upload
### Codecov upload

This section contains a simple codecov upload. See the
[codecov action](https://github.com/codecov/codecov-action) for more information.
Expand Down Expand Up @@ -314,7 +320,7 @@ jobs:
fail_ci_if_error: true
```

#### Running on Windows
### Running on Windows

Running this action on Windows is supported, but two things are important to note:

Expand All @@ -325,6 +331,7 @@ Running this action on Windows is supported, but two things are important to not
run:
shell: bash
```

2. If you are running an OS matrix, and want to activate your venv `in-project`
you have to deal with different folder structures on different operating systems. To make this work, you *can* do
this
Expand Down Expand Up @@ -393,7 +400,7 @@ jobs:
pytest --version
```

##### Caching on Windows runners
#### Caching on Windows runners

For some reason, caching your `venv` does not seem to work as expected on Windows runners. You can see an example of
what happens [here](https://github.com/snok/install-poetry/actions/runs/507576956), where a workflow stalls and runs for
Expand All @@ -402,7 +409,7 @@ over 3 hours before it was manually cancelled.
If you do want to cache your dependencies on a Windows runner, you should look into caching your pip wheels instead of
your venv; this seems to work fine.

#### Virtualenv variations
### Virtualenv variations

All of the examples we've added use these Poetry settings

Expand Down Expand Up @@ -469,7 +476,7 @@ There are two other relevant scenarios:
caching will, however, still save you the time it would take to download the wheels (and it will reduce the strain on
PyPi).

#### Caching the Poetry installation
### Caching the Poetry installation

In addition to caching your python dependencies you might find it useful to cache the Poetry installation itself. This
should cut ~10 seconds of your total runtime and roughly 95% of this action's runtime.
Expand Down Expand Up @@ -500,6 +507,37 @@ jobs:

The directory to cache will depend on the operating system of the runner.

### Installing Poetry Plugins

With Poetry 1.2 or later, you can use this action to install plugins:

```yaml
- uses: snok/install-poetry@v1
with:
version: 1.2.0a2
plugins: poetry-plugin-a
```

You can use a comma delimited list:

```yaml
- uses: snok/install-poetry@v1
with:
version: 1.2.0a2
plugins: poetry-plugin-a, poetry-plugin-b
```

or a whitespace delimited list:

```yaml
- uses: snok/install-poetry@v1
with:
version: 1.2.0a2
plugins: |
poetry-plugin-a
poetry-plugin-b
```

## Contributing

Contributions are always welcome; submit a PR!
Expand Down

0 comments on commit 9c3e1f7

Please sign in to comment.