mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 02:56:56 +08:00
Compute path to requirements.txt.
This commit is contained in:
48
.github/workflows/UnitTesting.yml
vendored
48
.github/workflows/UnitTesting.yml
vendored
@@ -205,6 +205,38 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
py -3.9 -m pip install --disable-pip-version-check --break-system-packages -U tomli
|
py -3.9 -m pip install --disable-pip-version-check --break-system-packages -U tomli
|
||||||
|
|
||||||
|
- name: Compute path to requirements file
|
||||||
|
id: requirements
|
||||||
|
shell: python
|
||||||
|
run: |
|
||||||
|
from os import getenv
|
||||||
|
from pathlib import Path
|
||||||
|
from sys import version
|
||||||
|
|
||||||
|
print(f"Python: {version}")
|
||||||
|
|
||||||
|
requirements = "${{ inputs.requirements }}"
|
||||||
|
if requirements.startswith("-r"):
|
||||||
|
requirements = requirements[2:].lstrip()
|
||||||
|
if requirements.startswith("./"):
|
||||||
|
requirementsFile = Path("${{ inputs.root_directory || '.' }}") / Path("${{ inputs.tests_directory || '.' }}") / Path("${{ inputs.unittest_directory || '.' }}") / Path(requirements[2:])
|
||||||
|
else:
|
||||||
|
requirementsFile = Path(requirements)
|
||||||
|
|
||||||
|
if not requirementsFile.exists():
|
||||||
|
print(f"::error title=FileNotFoundError::{ex}")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
print(f"requirements file: {requirementsFile.as_posix()}")
|
||||||
|
|
||||||
|
# Write requirements path to special file
|
||||||
|
github_output = Path(getenv("GITHUB_OUTPUT"))
|
||||||
|
print(f"GITHUB_OUTPUT: {github_output}")
|
||||||
|
with github_output.open("a+") as f:
|
||||||
|
f.write(f"requirements=-r {requirementsFile.as_posix()}\n")
|
||||||
|
else:
|
||||||
|
print(f"requirements list: {requirements}")
|
||||||
|
|
||||||
- name: Compute pacman/pacboy packages
|
- name: Compute pacman/pacboy packages
|
||||||
id: pacboy
|
id: pacboy
|
||||||
if: matrix.system == 'msys2'
|
if: matrix.system == 'msys2'
|
||||||
@@ -215,8 +247,6 @@ jobs:
|
|||||||
from re import compile
|
from re import compile
|
||||||
from sys import version
|
from sys import version
|
||||||
|
|
||||||
print(f"Python: {version}")
|
|
||||||
|
|
||||||
def loadRequirementsFile(requirementsFile: Path):
|
def loadRequirementsFile(requirementsFile: Path):
|
||||||
requirements = []
|
requirements = []
|
||||||
with requirementsFile.open("r") as file:
|
with requirementsFile.open("r") as file:
|
||||||
@@ -232,16 +262,10 @@ jobs:
|
|||||||
|
|
||||||
return requirements
|
return requirements
|
||||||
|
|
||||||
requirements = "${{ inputs.requirements }}"
|
requirements = "${{ steps.requirements.outputs.requirements }}"
|
||||||
if requirements.startswith("-r"):
|
if requirements.startswith("-r"):
|
||||||
requirements = requirements[2:].lstrip()
|
|
||||||
if requirements.startswith("./"):
|
|
||||||
requirementsFile = Path("${{ inputs.root_directory || '.' }}") / Path("${{ inputs.tests_directory || '.' }}") / Path("${{ inputs.unittest_directory || '.' }}") / Path(requirements[2:])
|
|
||||||
else:
|
|
||||||
requirementsFile = Path(requirements)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
dependencies = loadRequirementsFile(requirementsFile)
|
dependencies = loadRequirementsFile(Path(requirements[2:].lstrip()))
|
||||||
except FileNotFoundError as ex:
|
except FileNotFoundError as ex:
|
||||||
print(f"::error title=FileNotFoundError::{ex}")
|
print(f"::error title=FileNotFoundError::{ex}")
|
||||||
exit(1)
|
exit(1)
|
||||||
@@ -329,7 +353,7 @@ jobs:
|
|||||||
if: matrix.system != 'msys2'
|
if: matrix.system != 'msys2'
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --disable-pip-version-check -U wheel tomli
|
python -m pip install --disable-pip-version-check -U wheel tomli
|
||||||
python -m pip install --disable-pip-version-check ${{ inputs.requirements }}
|
python -m pip install --disable-pip-version-check ${{ steps.requirements.outputs.requirements }}
|
||||||
|
|
||||||
- name: 🔧 Install pip dependencies (MSYS2)
|
- name: 🔧 Install pip dependencies (MSYS2)
|
||||||
if: matrix.system == 'msys2'
|
if: matrix.system == 'msys2'
|
||||||
@@ -337,7 +361,7 @@ jobs:
|
|||||||
if [ -n '${{ inputs.mingw_requirements }}' ]; then
|
if [ -n '${{ inputs.mingw_requirements }}' ]; then
|
||||||
python -m pip install --disable-pip-version-check --break-system-packages ${{ inputs.mingw_requirements }}
|
python -m pip install --disable-pip-version-check --break-system-packages ${{ inputs.mingw_requirements }}
|
||||||
else
|
else
|
||||||
python -m pip install --disable-pip-version-check --break-system-packages ${{ inputs.requirements }}
|
python -m pip install --disable-pip-version-check --break-system-packages ${{ steps.requirements.outputs.requirements }}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Before scripts
|
# Before scripts
|
||||||
|
|||||||
@@ -15,5 +15,5 @@ sphinxcontrib-mermaid ~= 1.2
|
|||||||
autoapi >= 2.0.1
|
autoapi >= 2.0.1
|
||||||
sphinx_design ~= 0.6
|
sphinx_design ~= 0.6
|
||||||
sphinx-copybutton >= 0.5
|
sphinx-copybutton >= 0.5
|
||||||
sphinx_autodoc_typehints ~= 3.6
|
sphinx_autodoc_typehints ~= 3.5 # 3.6 is conflicting with old sphinx_design and rtd theme due to sphinx<9 and docutils<0.22
|
||||||
sphinx_reports ~= 0.9
|
sphinx_reports ~= 0.9
|
||||||
|
|||||||
Reference in New Issue
Block a user