3737 requirements :
3838 description : ' Python dependencies to be installed through pip.'
3939 required : false
40- default : ' -r tests /requirements.txt'
40+ default : ' -r . /requirements.txt'
4141 type : string
4242 pacboy :
4343 description : ' MSYS2 dependencies to be installed through pacboy (pacman).'
9494 name : ${{ inputs.wheel }}
9595 path : install
9696
97+ # TODO: extract step to an Action so package, so code can be shared with UnitTesting.yml
98+ - name : Compute path to requirements file
99+ id : requirements
100+ shell : python
101+ run : |
102+ from os import getenv
103+ from pathlib import Path
104+ from sys import version
105+
106+ print(f"Python: {version}")
107+
108+ requirements = "${{ inputs.requirements }}"
109+ if requirements.startswith("-r"):
110+ requirements = requirements[2:].lstrip()
111+ if requirements.startswith("./"):
112+ requirementsFile = Path("${{ inputs.root_directory || '.' }}") / Path("${{ inputs.tests_directory || '.' }}") / Path("${{ inputs.apptest_directory || '.' }}") / Path(requirements[2:])
113+ else:
114+ requirementsFile = Path(requirements)
115+
116+ if not requirementsFile.exists():
117+ print(f"::error title=FileNotFoundError::{requirementsFile}")
118+ exit(1)
119+
120+ print(f"requirements file: {requirementsFile.as_posix()}")
121+
122+ # Write requirements path to special file
123+ github_output = Path(getenv("GITHUB_OUTPUT"))
124+ print(f"GITHUB_OUTPUT: {github_output}")
125+ with github_output.open("a+") as f:
126+ f.write(f"requirements=-r {requirementsFile.as_posix()}\n")
127+ else:
128+ print(f"requirements list: {requirements}")
129+
97130 # TODO: extract step to an Action so package lists are shared with UnitTesting (and GHDL?)
98131 - name : Compute pacman/pacboy packages
99132 id : pacboy
@@ -122,7 +155,7 @@ jobs:
122155
123156 return requirements
124157
125- requirements = "${{ inputs .requirements }}"
158+ requirements = "${{ steps.requirements.outputs .requirements }}"
126159 if requirements.startswith("-r"):
127160 requirementsFile = Path(requirements[2:].lstrip())
128161 try:
@@ -191,6 +224,8 @@ jobs:
191224 with github_output.open("a+") as f:
192225 f.write(f"pacboy_packages={' '.join(pacboyPackages)}\n")
193226
227+ # Python setup
228+
194229 - name : ' 🟦 Setup MSYS2 for ${{ matrix.runtime }}'
195230 uses : msys2/setup-msys2@v2
196231 if : matrix.system == 'msys2'
@@ -207,6 +242,8 @@ jobs:
207242 with :
208243 python-version : ${{ matrix.python }}
209244
245+ # Python Dependency steps
246+
210247 - name : 🔧 Install wheel and pip dependencies (native)
211248 if : matrix.system != 'msys2'
212249 run : |
@@ -222,6 +259,8 @@ jobs:
222259 python -m pip install --disable-pip-version-check --break-system-packages ${{ inputs.requirements }}
223260 fi
224261
262+ # TODO: Before scripts?
263+
225264 - name : 🔧 Install wheel from artifact (Ubuntu/macOS)
226265 if : ( matrix.system != 'windows' && matrix.system != 'windows-arm' )
227266 run : |
@@ -232,6 +271,8 @@ jobs:
232271 run : |
233272 python -m pip install -v --disable-pip-version-check (Get-Item .\install\*.whl).FullName
234273
274+ # Run pytests
275+
235276 - name : ✅ Run application tests (Ubuntu/macOS)
236277 if : ( matrix.system != 'windows' && matrix.system != 'windows-arm' )
237278 run : |
@@ -262,6 +303,8 @@ jobs:
262303 python -m pytest -raP $PYTEST_ARGS --color=yes ${{ inputs.tests_directory || '.' }}/${{ inputs.apptest_directory }}
263304 }
264305
306+ # Upload artifacts
307+
265308 - name : 📤 Upload 'TestReportSummary.xml' artifact
266309 if : inputs.apptest_xml_artifact != ''
267310 uses : pyTooling/upload-artifact@v6
0 commit comments