From 324b00a1db2bab156238351e7a60c43e1786d7c7 Mon Sep 17 00:00:00 2001 From: coreone Date: Mon, 26 Feb 2024 15:52:37 -0500 Subject: [PATCH] feat: allow passing options to poetry install (#61) --- .github/workflows/python-deploy-to-pypi.yaml | 13 ++++++---- .github/workflows/python-lint.yaml | 17 ++++++++----- .../workflows/python-test-deploy-to-pypi.yaml | 7 +++++- .github/workflows/python-unit-test.yaml | 7 +++++- README.md | 24 ++++++++++++------- 5 files changed, 48 insertions(+), 20 deletions(-) diff --git a/.github/workflows/python-deploy-to-pypi.yaml b/.github/workflows/python-deploy-to-pypi.yaml index 812f5d0..9f842b4 100644 --- a/.github/workflows/python-deploy-to-pypi.yaml +++ b/.github/workflows/python-deploy-to-pypi.yaml @@ -14,19 +14,24 @@ name: pypi_deploy description: The runner group on which jobs will run. required: false type: string + poetry_install_options: + default: '--no-root' + description: Extra options to pass to Poetry when doing an install. + required: false + type: string python_version: - description: The version of Python to use for the run. default: '3.11' + description: The version of Python to use for the run. required: false type: string timeout_minutes: - description: The maximum time (in minutes) for a job to run. default: 5 + description: The maximum time (in minutes) for a job to run. required: false type: number working_directory: - description: The working directory where all jobs should be executed. default: '.' + description: The working directory where all jobs should be executed. required: false type: string secrets: @@ -56,7 +61,7 @@ jobs: - name: Configure Poetry run: poetry config virtualenvs.in-project true - name: Install dependencies - run: poetry install + run: poetry install ${{ inputs.poetry_install_options }} - name: Setup PyPi credential env: PYPI_TOKEN: ${{ secrets.pypi_token }} diff --git a/.github/workflows/python-lint.yaml b/.github/workflows/python-lint.yaml index c103e6f..75ac51b 100644 --- a/.github/workflows/python-lint.yaml +++ b/.github/workflows/python-lint.yaml @@ -14,9 +14,14 @@ name: python-linting description: The runner group on which jobs will run. required: false type: string + poetry_install_options: + default: '--no-root' + description: Extra options to pass to Poetry when doing an install. + required: false + type: string python_version: - description: The version of Python to use for the run. default: '3.11' + description: The version of Python to use for the run. required: false type: string ruff_version: @@ -25,23 +30,23 @@ name: python-linting required: false type: string timeout_minutes: - description: The maximum time (in minutes) for a job to run. default: 5 + description: The maximum time (in minutes) for a job to run. required: false type: number use_pylama: - description: If true, use pylama to lint the repository. default: true + description: If true, use pylama to lint the repository. required: false type: boolean use_ruff: - description: If true, use ruff to lint the repository. default: false + description: If true, use ruff to lint the repository. required: false type: boolean working_directory: - description: The working directory where all jobs should be executed. default: '.' + description: The working directory where all jobs should be executed. required: false type: string @@ -67,7 +72,7 @@ jobs: - name: Configure Poetry run: poetry config virtualenvs.in-project true - name: Install dependencies - run: poetry install + run: poetry install ${{ inputs.poetry_install_options }} - name: Lint with yamllint run: poetry run yamllint . -s - name: Lint with pylama diff --git a/.github/workflows/python-test-deploy-to-pypi.yaml b/.github/workflows/python-test-deploy-to-pypi.yaml index d8734b5..ec62895 100644 --- a/.github/workflows/python-test-deploy-to-pypi.yaml +++ b/.github/workflows/python-test-deploy-to-pypi.yaml @@ -14,6 +14,11 @@ name: pypi_test_deploy description: The runner group on which jobs will run. required: false type: string + poetry_install_options: + default: '--no-root' + description: Extra options to pass to Poetry when doing an install. + required: false + type: string python_version: description: The version of Python to use for the run. default: '3.11' @@ -56,7 +61,7 @@ jobs: - name: Configure Poetry run: poetry config virtualenvs.in-project true - name: Install dependencies - run: poetry install + run: poetry install ${{ inputs.poetry_install_options }} - name: Setup PyPi credential env: PYPI_TOKEN: ${{ secrets.pypi_test_token }} diff --git a/.github/workflows/python-unit-test.yaml b/.github/workflows/python-unit-test.yaml index 7c90def..6e2466a 100644 --- a/.github/workflows/python-unit-test.yaml +++ b/.github/workflows/python-unit-test.yaml @@ -14,6 +14,11 @@ name: Python Checks description: The runner group on which jobs will run. required: false type: string + poetry_install_options: + default: '--no-root' + description: Extra options to pass to Poetry when doing an install. + required: false + type: string python_versions: default: '{ "versions": [ "3.7", "3.8", "3.9", "3.10", "3.11" ] }' description: The versions of Python on which the unit tests should run. @@ -67,7 +72,7 @@ jobs: - name: Check pyproject.toml run: poetry check - name: Install dependencies - run: poetry install + run: poetry install ${{ inputs.poetry_install_options }} - name: Test with green run: | poetry run green ${{ inputs.test_targets }} diff --git a/README.md b/README.md index a00e163..92f03da 100644 --- a/README.md +++ b/README.md @@ -136,8 +136,10 @@ This workflow will setup [Python][5] (`3.11`) and do a build and deploy of the #### python-deploy-to-pypi Inputs -* `additional_packages`: String of additional packages that should be - installed. Default: `` +* `additional_packages`: String of additional packages that should be installed. + Default: `` +* `poetry_install_options`: Extra options to pass to Poetry when doing an install. + Default: `--no-root` * `python_version`: The version of [Python][5] to use. Default: `3.11` #### python-deploy-to-pypi Secrets @@ -157,8 +159,10 @@ by setting the `use_ruff` input to `true`. #### python-lint Inputs -* `additional_packages`: String of additional packages that should be - installed. Default: `` +* `additional_packages`: String of additional packages that should be installed. + Default: `` +* `poetry_install_options`: Extra options to pass to Poetry when doing an install. + Default: `--no-root` * `python_version`: The version of [Python][5] to use. Default: `3.11` * `ruff_version`: The version of [Ruff](https://github.com/astral-sh/ruff) to run. Default: `0.1.0` @@ -175,8 +179,10 @@ This workflow will setup [Python][5] (`3.11`) and do a build and deploy of the #### python-test-deploy-to-pypi Inputs -* `additional_packages`: String of additional packages that should be - installed. Default: `` +* `additional_packages`: String of additional packages that should be installed. + Default: `` +* `poetry_install_options`: Extra options to pass to Poetry when doing an install. + Default: `--no-root` * `python_version`: The version of [Python][5] to use. Default: `3.11` #### python-test-deploy-to-pypi Secrets @@ -192,8 +198,10 @@ install any [Python][5] dependencies. #### python-unit-test Inputs -* `additional_packages`: String of additional packages that should be - installed. Default: `` +* `additional_packages`: String of additional packages that should be installed. + Default: `` +* `poetry_install_options`: Extra options to pass to Poetry when doing an install. + Default: `--no-root` * `python_package_name`: The name of the [PyPi][2] package the repo will create. Default: `` * `python_versions`: The versions of [Python][5] to use in the unit tests, passed as a