mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-11 18:46:55 +08:00
Fix application testing and how requirements.txt files are searched (introduced for UnitTesting in v7.0.0).
This commit is contained in:
47
.github/workflows/ApplicationTesting.yml
vendored
47
.github/workflows/ApplicationTesting.yml
vendored
@@ -37,7 +37,7 @@ on:
|
|||||||
requirements:
|
requirements:
|
||||||
description: 'Python dependencies to be installed through pip.'
|
description: 'Python dependencies to be installed through pip.'
|
||||||
required: false
|
required: false
|
||||||
default: '-r tests/requirements.txt'
|
default: '-r ./requirements.txt'
|
||||||
type: string
|
type: string
|
||||||
pacboy:
|
pacboy:
|
||||||
description: 'MSYS2 dependencies to be installed through pacboy (pacman).'
|
description: 'MSYS2 dependencies to be installed through pacboy (pacman).'
|
||||||
@@ -94,6 +94,39 @@ jobs:
|
|||||||
name: ${{ inputs.wheel }}
|
name: ${{ inputs.wheel }}
|
||||||
path: install
|
path: install
|
||||||
|
|
||||||
|
# TODO: extract step to an Action so package, so code can be shared with UnitTesting.yml
|
||||||
|
- 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.apptest_directory || '.' }}") / Path(requirements[2:])
|
||||||
|
else:
|
||||||
|
requirementsFile = Path(requirements)
|
||||||
|
|
||||||
|
if not requirementsFile.exists():
|
||||||
|
print(f"::error title=FileNotFoundError::{requirementsFile}")
|
||||||
|
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}")
|
||||||
|
|
||||||
# TODO: extract step to an Action so package lists are shared with UnitTesting (and GHDL?)
|
# TODO: extract step to an Action so package lists are shared with UnitTesting (and GHDL?)
|
||||||
- name: Compute pacman/pacboy packages
|
- name: Compute pacman/pacboy packages
|
||||||
id: pacboy
|
id: pacboy
|
||||||
@@ -122,7 +155,7 @@ jobs:
|
|||||||
|
|
||||||
return requirements
|
return requirements
|
||||||
|
|
||||||
requirements = "${{ inputs.requirements }}"
|
requirements = "${{ steps.requirements.outputs.requirements }}"
|
||||||
if requirements.startswith("-r"):
|
if requirements.startswith("-r"):
|
||||||
requirementsFile = Path(requirements[2:].lstrip())
|
requirementsFile = Path(requirements[2:].lstrip())
|
||||||
try:
|
try:
|
||||||
@@ -191,6 +224,8 @@ jobs:
|
|||||||
with github_output.open("a+") as f:
|
with github_output.open("a+") as f:
|
||||||
f.write(f"pacboy_packages={' '.join(pacboyPackages)}\n")
|
f.write(f"pacboy_packages={' '.join(pacboyPackages)}\n")
|
||||||
|
|
||||||
|
# Python setup
|
||||||
|
|
||||||
- name: '🟦 Setup MSYS2 for ${{ matrix.runtime }}'
|
- name: '🟦 Setup MSYS2 for ${{ matrix.runtime }}'
|
||||||
uses: msys2/setup-msys2@v2
|
uses: msys2/setup-msys2@v2
|
||||||
if: matrix.system == 'msys2'
|
if: matrix.system == 'msys2'
|
||||||
@@ -207,6 +242,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python }}
|
python-version: ${{ matrix.python }}
|
||||||
|
|
||||||
|
# Python Dependency steps
|
||||||
|
|
||||||
- name: 🔧 Install wheel and pip dependencies (native)
|
- name: 🔧 Install wheel and pip dependencies (native)
|
||||||
if: matrix.system != 'msys2'
|
if: matrix.system != 'msys2'
|
||||||
run: |
|
run: |
|
||||||
@@ -222,6 +259,8 @@ jobs:
|
|||||||
python -m pip install --disable-pip-version-check --break-system-packages ${{ inputs.requirements }}
|
python -m pip install --disable-pip-version-check --break-system-packages ${{ inputs.requirements }}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# TODO: Before scripts?
|
||||||
|
|
||||||
- name: 🔧 Install wheel from artifact (Ubuntu/macOS)
|
- name: 🔧 Install wheel from artifact (Ubuntu/macOS)
|
||||||
if: ( matrix.system != 'windows' && matrix.system != 'windows-arm' )
|
if: ( matrix.system != 'windows' && matrix.system != 'windows-arm' )
|
||||||
run: |
|
run: |
|
||||||
@@ -232,6 +271,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
python -m pip install -v --disable-pip-version-check (Get-Item .\install\*.whl).FullName
|
python -m pip install -v --disable-pip-version-check (Get-Item .\install\*.whl).FullName
|
||||||
|
|
||||||
|
# Run pytests
|
||||||
|
|
||||||
- name: ✅ Run application tests (Ubuntu/macOS)
|
- name: ✅ Run application tests (Ubuntu/macOS)
|
||||||
if: ( matrix.system != 'windows' && matrix.system != 'windows-arm' )
|
if: ( matrix.system != 'windows' && matrix.system != 'windows-arm' )
|
||||||
run: |
|
run: |
|
||||||
@@ -262,6 +303,8 @@ jobs:
|
|||||||
python -m pytest -raP $PYTEST_ARGS --color=yes ${{ inputs.tests_directory || '.' }}/${{ inputs.apptest_directory }}
|
python -m pytest -raP $PYTEST_ARGS --color=yes ${{ inputs.tests_directory || '.' }}/${{ inputs.apptest_directory }}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Upload artifacts
|
||||||
|
|
||||||
- name: 📤 Upload 'TestReportSummary.xml' artifact
|
- name: 📤 Upload 'TestReportSummary.xml' artifact
|
||||||
if: inputs.apptest_xml_artifact != ''
|
if: inputs.apptest_xml_artifact != ''
|
||||||
uses: pyTooling/upload-artifact@v6
|
uses: pyTooling/upload-artifact@v6
|
||||||
|
|||||||
2
.github/workflows/UnitTesting.yml
vendored
2
.github/workflows/UnitTesting.yml
vendored
@@ -215,6 +215,7 @@ jobs:
|
|||||||
# run: |
|
# run: |
|
||||||
# py -3.12 -m pip install --disable-pip-version-check --break-system-packages -U tomli
|
# py -3.12 -m pip install --disable-pip-version-check --break-system-packages -U tomli
|
||||||
|
|
||||||
|
# TODO: extract step to an Action so package, so code can be shared with AppTesting.yml
|
||||||
- name: Compute path to requirements file
|
- name: Compute path to requirements file
|
||||||
id: requirements
|
id: requirements
|
||||||
shell: python
|
shell: python
|
||||||
@@ -247,6 +248,7 @@ jobs:
|
|||||||
else:
|
else:
|
||||||
print(f"requirements list: {requirements}")
|
print(f"requirements list: {requirements}")
|
||||||
|
|
||||||
|
# TODO: extract step to an Action so package lists are shared with UnitTesting (and GHDL?)
|
||||||
- name: Compute pacman/pacboy packages
|
- name: Compute pacman/pacboy packages
|
||||||
id: pacboy
|
id: pacboy
|
||||||
if: matrix.system == 'msys2'
|
if: matrix.system == 'msys2'
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ __author__ = "Patrick Lehmann"
|
|||||||
__email__ = "Paebbels@gmail.com"
|
__email__ = "Paebbels@gmail.com"
|
||||||
__copyright__ = "2017-2026, Patrick Lehmann"
|
__copyright__ = "2017-2026, Patrick Lehmann"
|
||||||
__license__ = "Apache License, Version 2.0"
|
__license__ = "Apache License, Version 2.0"
|
||||||
__version__ = "7.4.1"
|
__version__ = "7.4.2"
|
||||||
__keywords__ = ["GitHub Actions"]
|
__keywords__ = ["GitHub Actions"]
|
||||||
__issue_tracker__ = "https://GitHub.com/pyTooling/Actions/issues"
|
__issue_tracker__ = "https://GitHub.com/pyTooling/Actions/issues"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user