Skip to content

Commit

Permalink
Report errors also to Pipeline message log.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels committed Sep 11, 2024
1 parent 0e9d878 commit 574562d
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 7 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ApplicationTesting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ jobs:
requirements = "${{ inputs.requirements }}"
if requirements.startswith("-r"):
requirementsFile = Path(requirements[2:].lstrip())
dependencies = loadRequirementsFile(requirementsFile)
try:
dependencies = loadRequirementsFile(requirementsFile)
except FileNotFoundError as ex:
print(f"::error title=FileNotFoundError::{ex}")
exit(1)
else:
dependencies = [req.strip() for req in requirements.split(" ")]
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/CoverageCollection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ jobs:
htmlDirectory = pyProjectSettings["tool"]["coverage"]["html"]["directory"]
xmlFile = pyProjectSettings["tool"]["coverage"]["xml"]["output"]
else:
print(f"File '{pyProjectFile}' not found and no ' .coveragerc' file specified.")
print(f"File '{pyProjectFile}' not found.")
print(f"::error title=FileNotFoundError::File '{pyProjectFile}' not found.")
exit(1)
# Read output paths from '.coveragerc' file
elif len(coverageRC) > 0:
Expand All @@ -115,6 +117,8 @@ jobs:
xmlFile = coverageRCSettings["xml"]["output"]
else:
print(f"File '{coverageRCFile}' not found.")
print(f"::error title=FileNotFoundError::File '{coverageRCFile}' not found.")
exit(1)
# Write jobs to special file
github_output = Path(getenv("GITHUB_OUTPUT"))
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/PublishCoverageResults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ jobs:
xmlFile = Path(pyProjectSettings["tool"]["coverage"]["xml"]["output"])
jsonFile = Path(pyProjectSettings["tool"]["coverage"]["json"]["output"])
else:
print(f"File '{pyProjectFile}' not found and no '.coveragerc' file specified.")
print(f"File '{pyProjectFile}' not found.")
print(f"::error title=FileNotFoundError::File '{pyProjectFile}' not found.")
exit(1)
# Read output paths from '.coveragerc' file
elif len(coverageRC) > 0:
Expand All @@ -116,6 +118,8 @@ jobs:
jsonFile = Path(coverageRCSettings["json"]["output"])
else:
print(f"File '{coverageRCFile}' not found.")
print(f"::error title=FileNotFoundError::File '{coverageRCFile}' not found.")
exit(1)
# Write jobs to special file
github_output = Path(getenv("GITHUB_OUTPUT"))
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/SphinxDocumentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ jobs:
xmlFile = Path(pyProjectSettings["tool"]["coverage"]["xml"]["output"])
jsonFile = Path(pyProjectSettings["tool"]["coverage"]["json"]["output"])
else:
print(f"File '{pyProjectFile}' not found and no '.coveragerc' file specified.")
print(f"File '{pyProjectFile}' not found.")
print(f"::error title=FileNotFoundError::File '{pyProjectFile}' not found.")
exit(1)
# Read output paths from '.coveragerc' file
elif len(coverageRC) > 0:
Expand All @@ -135,6 +137,8 @@ jobs:
jsonFile = Path(coverageRCSettings["json"]["output"])
else:
print(f"File '{coverageRCFile}' not found.")
print(f"::error title=FileNotFoundError::File '{coverageRCFile}' not found.")
exit(1)
# Write jobs to special file
github_output = Path(getenv("GITHUB_OUTPUT"))
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/UnitTesting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ jobs:
requirements = "${{ inputs.requirements }}"
if requirements.startswith("-r"):
requirementsFile = Path(requirements[2:].lstrip())
dependencies = loadRequirementsFile(requirementsFile)
try:
dependencies = loadRequirementsFile(requirementsFile)
except FileNotFoundError as ex:
print(f"::error title=FileNotFoundError::{ex}")
exit(1)
else:
dependencies = [req.strip() for req in requirements.split(" ")]
Expand Down Expand Up @@ -344,7 +348,9 @@ jobs:
xmlFile = Path(pyProjectSettings["tool"]["coverage"]["xml"]["output"])
jsonFile = Path(pyProjectSettings["tool"]["coverage"]["json"]["output"])
else:
print(f"File '{pyProjectFile}' not found and no '.coveragerc' file specified.")
print(f"File '{pyProjectFile}' not found.")
print(f"::error title=FileNotFoundError::File '{pyProjectFile}' not found.")
exit(1)
# Read output paths from '.coveragerc' file
elif len(coverageRC) > 0:
Expand All @@ -358,6 +364,8 @@ jobs:
jsonFile = Path(coverageRCSettings["json"]["output"])
else:
print(f"File '{coverageRCFile}' not found.")
print(f"::error title=FileNotFoundError::File '{coverageRCFile}' not found.")
exit(1)
# Write jobs to special file
github_output = Path(getenv("GITHUB_OUTPUT"))
Expand Down Expand Up @@ -452,6 +460,7 @@ jobs:
with:
name: ${{ inputs.coverage_sqlite_artifact }}-${{ matrix.system }}-${{ matrix.runtime }}-${{ matrix.python }}
path: .coverage
include-hidden-files: true
if-no-files-found: error
retention-days: 1

Expand Down
6 changes: 5 additions & 1 deletion tests/pacman_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ def loadRequirementsFile(requirementsFile: Path):
requirements = "-r ../tests/requirements.txt"
if requirements.startswith("-r"):
requirementsFile = Path(requirements[2:].lstrip())
dependencies = loadRequirementsFile(requirementsFile)
try:
dependencies = loadRequirementsFile(requirementsFile)
except FileNotFoundError as ex:
print(f"::error title=FileNotFound::{ex}")
exit(1)
else:
dependencies = [req.strip() for req in requirements.split(" ")]

Expand Down

0 comments on commit 574562d

Please sign in to comment.