feat: Add option to create isolated virtual environment in Python setup action
This commit is contained in:
@@ -26,6 +26,10 @@ inputs:
|
|||||||
description: Execute setup script dry run before live run when true.
|
description: Execute setup script dry run before live run when true.
|
||||||
required: false
|
required: false
|
||||||
default: 'true'
|
default: 'true'
|
||||||
|
create-venv:
|
||||||
|
description: Create an isolated virtual environment when using the system Python.
|
||||||
|
required: false
|
||||||
|
default: 'false'
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
@@ -48,7 +52,7 @@ runs:
|
|||||||
python -m pip --version >/dev/null 2>&1 || python -m ensurepip --upgrade
|
python -m pip --version >/dev/null 2>&1 || python -m ensurepip --upgrade
|
||||||
python -m pip --version
|
python -m pip --version
|
||||||
- name: Create virtual environment
|
- name: Create virtual environment
|
||||||
if: ${{ inputs.use-system-python == 'true' }}
|
if: ${{ inputs.use-system-python == 'true' && inputs.create-venv == 'true' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
use-system-python: 'true'
|
use-system-python: 'true'
|
||||||
run-db-setup: 'false'
|
run-db-setup: 'false'
|
||||||
|
create-venv: 'true'
|
||||||
|
|
||||||
- name: Run lint checks
|
- name: Run lint checks
|
||||||
run: ruff check .
|
run: ruff check .
|
||||||
@@ -65,6 +66,7 @@ jobs:
|
|||||||
uses: ./.gitea/actions/setup-python-env
|
uses: ./.gitea/actions/setup-python-env
|
||||||
with:
|
with:
|
||||||
use-system-python: 'true'
|
use-system-python: 'true'
|
||||||
|
create-venv: 'true'
|
||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: pytest tests/unit
|
run: pytest tests/unit
|
||||||
|
|||||||
Reference in New Issue
Block a user