Skip to content

Commit

Permalink
Merge pull request #28 from zyv/feature/separate-python-setup
Browse files Browse the repository at this point in the history
fix(action): separate Python setup for action and repository use
  • Loading branch information
marns93 authored Apr 30, 2024
2 parents 63387ea + 9944e4c commit 1a1abe4
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,42 @@ runs:
- uses: moneymeets/moneymeets-composite-actions/block-poetry-version-downgrade@master
if: ${{ inputs.with_checks == 'true' }}

- uses: moneymeets/moneymeets-composite-actions/detect-python-version@master
- name: Detect Python and Poetry versions for repository
uses: moneymeets/moneymeets-composite-actions/detect-python-version@master
id: detect-versions
with:
poetry_version: ${{ inputs.poetry_version }}
python_version: ${{ inputs.python_version }}
working_directory: ${{ inputs.working_directory }}

- name: Detect Python and Poetry versions for action
uses: moneymeets/moneymeets-composite-actions/detect-python-version@master
id: detect-versions-action
with:
working_directory: ${{ github.action_path }}

- name: Install and configure Poetry
shell: bash
run: pipx install poetry==${{ steps.detect-versions.outputs.poetry-version }}

- uses: actions/setup-python@v5
- name: Setup Python for action
uses: actions/setup-python@v5
id: setup-python-action
with:
python-version: '${{ steps.detect-versions-action.outputs.python-version-constraint }}'
# ToDo: Enable when https://github.com/actions/setup-python/issues/361 is fixed
# cache: 'poetry'
# cache-dependency-path: ${{ format('{0}/poetry.lock', github.action_path) }}

- name: Check for invalid package versions in pyproject.toml
run: |
poetry install
poetry run invalid_package_versions ${{ inputs.working_directory }}/pyproject.toml
shell: bash
working-directory: ${{ github.action_path }}

- name: Setup Python for repository
uses: actions/setup-python@v5
id: setup-python
with:
python-version: '${{ steps.detect-versions.outputs.python-version-constraint }}'
Expand All @@ -67,13 +91,6 @@ runs:
shell: bash
working-directory: ${{ inputs.working_directory }}
- name: Check for invalid package versions in pyproject.toml
run: |
poetry install
poetry run invalid_package_versions ${{ inputs.working_directory }}/pyproject.toml
shell: bash
working-directory: ${{ github.action_path }}

- name: Create virtualenv and install dependencies
shell: bash
working-directory: ${{ inputs.working_directory }}
Expand Down

0 comments on commit 1a1abe4

Please sign in to comment.