Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: abatilo/actions-poetry
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.0.0
Choose a base ref
...
head repository: abatilo/actions-poetry
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.0.0
Choose a head ref

Commits on Oct 13, 2020

  1. feat(deps): update default poetry version to 1.1.2 (#35)

    Thank you for the contribution!
    browniebroke authored Oct 13, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8284d20 View commit details

Commits on Apr 19, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0cd0771 View commit details

Commits on Apr 20, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3a9b64c View commit details

Commits on Jul 17, 2021

  1. Update FUNDING.yml

    abatilo authored Jul 17, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a7ae9e2 View commit details

Commits on Sep 13, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f982f32 View commit details

Commits on Oct 18, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7044c9c View commit details

Commits on Jun 16, 2022

  1. quote versions (#47)

    duarte-pompeu authored Jun 16, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a6d22c8 View commit details

Commits on Jun 26, 2022

  1. fix: quote versions to fix parsing errors

    Commit with header vs just pr title to trigger release of:
    #47
    abatilo committed Jun 26, 2022
    Copy the full SHA
    c1aba0c View commit details

Commits on Aug 23, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0816ab2 View commit details
  2. docs: Bump default version in all locations (#50)

    #49 upgraded the actual code content. We want to update the documentation content as well.
    abatilo authored Aug 23, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    9b38e00 View commit details

Commits on Aug 30, 2022

  1. Try to update a major only tag

    In theory, should address #51.
    Aaron Batilo committed Aug 30, 2022
    Copy the full SHA
    7f129ac View commit details

Commits on Sep 7, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0e9948e View commit details

Commits on Oct 2, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b64bee1 View commit details

Commits on Nov 26, 2022

  1. feat: update default Poetry version to 1.2.2 (#57)

    * feat: update default Poetry version to 1.2.2
    
    * ci: remove Python 3.6 from CI
    browniebroke authored Nov 26, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f295866 View commit details

Commits on Jan 15, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    68f3b1e View commit details
  2. Add poetry version 1.3.1 to ci matrix (#58)

    Co-authored-by: Aaron Batilo <AaronBatilo@gmail.com>
    jennydaman and abatilo authored Jan 15, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    df9b14c View commit details
  3. Upgrade to ubuntu-20.04 (#59)

    Deprecation notice: actions/runner-images#6002
    
    Co-authored-by: Aaron Batilo <AaronBatilo@gmail.com>
    jennydaman and abatilo authored Jan 15, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8a269b6 View commit details

Commits on Feb 24, 2023

  1. feat: by default use the latest poetry version (#62)

    * by default install the latest poetry version
    
    * 'poetry-version' input is not required anymore
    
    * added test install case for the 'latest' version
    
    * move if expression above run statement
    mammo0 authored Feb 24, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    192395c View commit details

Commits on Jul 11, 2023

  1. docs: caching venv (#65)

    * refactor(readme): split markdown contents based on ponctuation to ease doc maintenance
    
    * doc(readme): add workflow example which caches the virtual environment
    lucsorel authored Jul 11, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    437d4fa View commit details

Commits on Dec 29, 2023

  1. feat: Add ability to install plugins as part of the action setup (#66)

    * Use latest SemVer PR
    
    * Drop EOL Python 3.7. Use more modern Poetry versions in tests
    
    * Update examples
    
    * Add ability to install plugins and install export plugin by default
    
    * Do not install any plugins by default
    
    * Only run steps if some plugins are specified
    xSAVIKx authored Dec 29, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a5643c6 View commit details
  2. ci: Create catch-all GHA job (#67)

    This will make it so that I can make the success of ci-all be the
    required step for branch protection rules. That way, if the combination
    of versions of Python and OS change, then I don't have to change the
    branch protection rules themselves.
    abatilo authored Dec 29, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c31426b View commit details

Commits on Jan 12, 2024

  1. feat!: use pipx to isolate poetry (#63)

    * use pipx to isolate poetry
    
    * Update action.yml
    
    * fix syntax error
    
    * trigger build
    
    * Update action.yml
    NargiT authored Jan 12, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7b6d33e View commit details
Showing with 116 additions and 33 deletions.
  1. +1 −12 .github/FUNDING.yml
  2. +21 −6 .github/workflows/ci.yml
  3. +1 −1 .github/workflows/lint-pr.yml
  4. +70 −11 README.md
  5. +23 −3 action.yml
13 changes: 1 addition & 12 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: abatilo
open_collective: # Replace with a single Open Collective username
ko_fi: abatilo
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: abatilo
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
custom: ['https://www.buymeacoffee.com/abatilo']
27 changes: 21 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -10,13 +10,13 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8]
poetry-version: [1.0, 1.0.10]
os: [ubuntu-18.04, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
poetry-version: ["latest", "1.2.2", "1.3.2", "1.4.2", "1.5.1", "1.6.1"]
os: [ubuntu-22.04, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Run image
@@ -25,13 +25,28 @@ jobs:
poetry-version: ${{ matrix.poetry-version }}
- name: View poetry --help
run: poetry --help
ci-all:
runs-on: ubuntu-latest
needs: [ci]
steps:
- run: |
echo "All matrix jobs have completed successfully!"
release:
if: github.event_name == 'push'
needs: ci
needs: ci-all
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Generate release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
- name: Update major tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git tag -d v2
git push --delete origin v2
git push origin :refs/tags/v2
git tag v2
git push --tags
2 changes: 1 addition & 1 deletion .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
@@ -10,6 +10,6 @@ jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v1.2.0
- uses: amannn/action-semantic-pull-request@v5.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81 changes: 70 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -10,12 +10,16 @@ GitHub Actions for Python projects using poetry
## Getting started

### Breaking changes for v2
We've drastically simplified this GitHub Action for v2. This is no longer a
Docker action that runs as its own container, it's just a simplified way for
you to install poetry. This action now makes an assumption that you've already
setup Python via `setup-python` or some other way. Since we're installing poetry directly to your environment, this also means that you can cache your dependencies more easily since everything is running on the host runner instead of an isolated container environment.

We've drastically simplified this GitHub Action for v2.
This is no longer a Docker action that runs as its own container,
it's just a simplified way for you to install poetry.
This action now makes an assumption that you've already setup Python via `setup-python` or some other way.
Since we're installing poetry directly to your environment,
this also means that you can cache your dependencies more easily since everything is running on the host runner instead of an isolated container environment.

### Create your workflow

```yaml
name: CI
on: pull_request
@@ -25,30 +29,85 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8]
poetry-version: [1.0, 1.0.10]
os: [ubuntu-18.04, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
poetry-version: ["1.2.2", "1.7.1"]
os: [ubuntu-22.04, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Run image
uses: abatilo/actions-poetry@v2.0.0
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- name: View poetry --help
run: poetry --help
```
### Workflow example: cache the virtual environment
It is possible to combine `actions/poetry` with [actions/cache](https://github.com/actions/cache) to speed up the installation of dependencies.
The recipe is:

1. to ask `poetry` to create a virtual environment inside the project:
it creates a local `.venv/` folder that can be cached
2. to create a cache key that involves the contents of the `poetry.lock` file:
if the contents change (meaning that dependencies have changed), then the cache needs to be invalidated and recreated

For the 1st step, you either need:

- to have a `poetry.toml` file at the root of your project with these 2 settings:

```ini
[virtualenvs]
create = true
in-project = true
```

- or to run the following commands in the github actions to create the `poetry.toml` file:

```sh
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
```

Here is an example of how the steps must be declared:

```yaml
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
# see details (matrix, python-version, python-version-file, etc.)
# https://github.com/actions/setup-python
- name: Install poetry
uses: abatilo/actions-poetry@v2
- name: Setup a local virtual environment (if no poetry.toml file)
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- uses: actions/cache@v3
name: Define a cache for the virtual environment based on the dependencies lock file
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install the project dependencies
run: poetry install
- name: Run the automated tests (for example)
run: poetry run pytest -v
```

## License

[MIT License - abatilo/actions-poetry]

[MIT License - abatilo/actions-poetry]: https://github.com/abatilo/actions-poetry/blob/master/LICENSE

## About the author

- [abatilo's homepage](https://www.aaronbatilo.dev/)
26 changes: 23 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
@@ -7,11 +7,31 @@ branding:
inputs:
poetry-version:
description: "The version of poetry to install"
required: true
default: "1.0"
required: false
default: "latest"
poetry-plugins:
description: "The whitespace/newline-separated list of poetry plugins to install."
required: false
default: ""
runs:
using: "composite"
steps:
- run: |
pip install poetry==${{ inputs.poetry-version }}
pip install --user pipx
pipx ensurepath
shell: bash
- if: ${{ inputs.poetry-version == 'latest' }}
run: |
pipx install poetry
shell: bash
- if: ${{ inputs.poetry-version != 'latest' }}
run: |
pipx install poetry==${{ inputs.poetry-version }}
shell: bash
- if: ${{ inputs.poetry-plugins != '' }}
run: |
ALL_PLUGINS=$(echo "${{ inputs.poetry-plugins }}")
for PLUGIN in $ALL_PLUGINS; do
poetry self add $PLUGIN
done
shell: bash