Skip to content

Commit ec8bf18

Browse files
committed
Install Python package and readout embedded package version.
1 parent 330a21e commit ec8bf18

File tree

5 files changed

+200
-6
lines changed

5 files changed

+200
-6
lines changed

.github/workflows/CompletePipeline.yml

+28-2
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,18 @@ jobs:
158158
# exclude_list: ${{ inputs.apptest_exclude_list }}
159159
# disable_list: ${{ inputs.apptest_disable_list }}
160160

161+
InstallParams:
162+
uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev
163+
with:
164+
package_namespace: ${{ inputs.package_namespace }}
165+
package_name: ${{ inputs.package_name }}
166+
python_version: ${{ inputs.unittest_python_version }}
167+
python_version_list: ''
168+
system_list: ${{ inputs.unittest_system_list }}
169+
include_list: ${{ inputs.unittest_include_list }}
170+
exclude_list: ${{ inputs.unittest_exclude_list }}
171+
disable_list: ${{ inputs.unittest_disable_list }}
172+
161173
UnitTesting:
162174
uses: pyTooling/Actions/.github/workflows/UnitTesting.yml@dev
163175
needs:
@@ -199,11 +211,23 @@ jobs:
199211
uses: pyTooling/Actions/.github/workflows/Package.yml@dev
200212
needs:
201213
- UnitTestingParams
202-
- UnitTesting
214+
# - UnitTesting
203215
with:
204216
python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
205217
artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }}
206218

219+
Install:
220+
uses: pyTooling/Actions/.github/workflows/InstallPackage.yml@dev
221+
needs:
222+
- ConfigParams
223+
- UnitTestingParams
224+
- InstallParams
225+
- Package
226+
with:
227+
jobs: ${{ needs.InstallParams.outputs.python_jobs }}
228+
wheel: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }}
229+
package_name: ${{ needs.ConfigParams.outputs.package_fullname }}
230+
207231
# AppTesting:
208232
# uses: pyTooling/Actions/.github/workflows/ApplicationTesting.yml@dev
209233
# needs:
@@ -244,7 +268,7 @@ jobs:
244268
- UnitTestingParams
245269
- UnitTesting
246270
with:
247-
testsuite-summary-name: ${{ inputs.package_name }}
271+
testsuite-summary-name: ${{ needs.ConfigParams.outputs.package_fullname }}
248272
merged_junit_filename: ${{ needs.ConfigParams.outputs.unittest_merged_report_xml_filename }}
249273
merged_junit_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }}
250274
dorny: ${{ inputs.dorny }}
@@ -314,6 +338,7 @@ jobs:
314338
needs:
315339
- Prepare
316340
- UnitTesting
341+
- Install
317342
# - AppTesting
318343
# - StaticTypeCheck
319344
- Package
@@ -332,6 +357,7 @@ jobs:
332357
needs:
333358
- Prepare
334359
- UnitTesting
360+
- Install
335361
# - AppTesting
336362
# - StaticTypeCheck
337363
- Package

.github/workflows/ExtractConfiguration.yml

+21-1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ jobs:
145145
namespace = "${{ inputs.package_namespace }}".strip()
146146
name = "${{ inputs.package_name }}".strip()
147147
148+
print(dedent(f"""\
149+
INPUTS:
150+
package_namespace: {namespace}
151+
package_name: {name}
152+
"""))
153+
148154
if namespace == "" or namespace == ".":
149155
fullname = f"{name}"
150156
directory = f"{name}"
@@ -154,6 +160,13 @@ jobs:
154160
directory = f"{namespace}/{name}"
155161
mypy_prepare_command = f"touch {namespace}/__init__.py"
156162
163+
print(dedent(f"""\
164+
OUTPUTS:
165+
package_fullname: {fullname}
166+
package_directory: {directory}
167+
mypy_prepare_command: {mypy_prepare_command}
168+
"""))
169+
157170
github_output = Path(getenv("GITHUB_OUTPUT"))
158171
print(f"GITHUB_OUTPUT: {github_output}")
159172
with github_output.open("a+", encoding="utf-8") as f:
@@ -234,4 +247,11 @@ jobs:
234247
coverage_report_json={coverageJSONFile.as_posix()}
235248
"""))
236249
237-
print(f"DEBUG:\n unittest xml: {unittestXMLFile}\n merged unittest xml: {mergedUnittestXMLFile}\n coverage html: {coverageHTMLDirectory}\n coverage xml: {coverageXMLFile}\n coverage json: {coverageJSONFile}")
250+
print(dedent(f"""\
251+
DEBUG:
252+
unittest xml: {unittestXMLFile}
253+
merged unittest xml: {mergedUnittestXMLFile}
254+
coverage html: {coverageHTMLDirectory}
255+
coverage xml: {coverageXMLFile}
256+
coverage json: {coverageJSONFile}
257+
"""))

.github/workflows/InstallPackage.yml

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# ==================================================================================================================== #
2+
# Authors: #
3+
# Patrick Lehmann #
4+
# #
5+
# ==================================================================================================================== #
6+
# Copyright 2025-2025 The pyTooling Authors #
7+
# #
8+
# Licensed under the Apache License, Version 2.0 (the "License"); #
9+
# you may not use this file except in compliance with the License. #
10+
# You may obtain a copy of the License at #
11+
# #
12+
# http://www.apache.org/licenses/LICENSE-2.0 #
13+
# #
14+
# Unless required by applicable law or agreed to in writing, software #
15+
# distributed under the License is distributed on an "AS IS" BASIS, #
16+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
17+
# See the License for the specific language governing permissions and #
18+
# limitations under the License. #
19+
# #
20+
# SPDX-License-Identifier: Apache-2.0 #
21+
# ==================================================================================================================== #
22+
name: Install Package
23+
24+
on:
25+
workflow_call:
26+
inputs:
27+
jobs:
28+
description: 'JSON list with environment fields, telling the system and Python versions to run tests with.'
29+
required: true
30+
type: string
31+
wheel:
32+
description: "Wheel package as input artifact."
33+
required: true
34+
type: string
35+
package_name:
36+
description: "Name of the Python package."
37+
required: true
38+
type: string
39+
40+
jobs:
41+
PackageInstallation:
42+
name: ${{ matrix.sysicon }} ${{ matrix.pyicon }} Package installation using Python ${{ matrix.python }}
43+
runs-on: ${{ matrix.runs-on }}
44+
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
include: ${{ fromJson(inputs.jobs) }}
49+
50+
defaults:
51+
run:
52+
shell: ${{ matrix.shell }}
53+
54+
steps:
55+
- name: 📥 Download artifacts '${{ inputs.wheel }}' from 'Package' job
56+
uses: pyTooling/download-artifact@v4
57+
with:
58+
name: ${{ inputs.wheel }}
59+
path: install
60+
61+
- name: '🟦 Setup MSYS2 for ${{ matrix.runtime }}'
62+
uses: msys2/setup-msys2@v2
63+
if: matrix.system == 'msys2'
64+
with:
65+
msystem: ${{ matrix.runtime }}
66+
update: true
67+
pacboy: >-
68+
python-pip:p python-wheel:p
69+
python-lxml:p
70+
python-ruamel-yaml:p python-ruamel.yaml.clib:p
71+
python-tomli:p
72+
73+
- name: 🐍 Setup Python ${{ matrix.python }}
74+
uses: actions/setup-python@v5
75+
if: matrix.system != 'msys2'
76+
with:
77+
python-version: ${{ matrix.python }}
78+
79+
- name: 🔧 Install wheel and pip dependencies (native)
80+
if: matrix.system != 'msys2'
81+
run: |
82+
python -m pip install --disable-pip-version-check -U wheel
83+
84+
- name: 🔧 Install wheel from artifact (Ubuntu/macOS)
85+
if: matrix.system != 'windows'
86+
run: |
87+
python -m pip install --disable-pip-version-check -U install/*.whl
88+
89+
- name: 🔧 Install wheel from artifact (Windows)
90+
if: matrix.system == 'windows'
91+
run: |
92+
python -m pip install -v --disable-pip-version-check (Get-Item .\install\*.whl).FullName
93+
94+
- name: 📦 Run application tests (Ubuntu/macOS)
95+
if: matrix.system != 'windows'
96+
run: |
97+
set +e
98+
99+
ANSI_LIGHT_RED=$'\x1b[91m'
100+
ANSI_LIGHT_GREEN=$'\x1b[92m'
101+
ANSI_NOCOLOR=$'\x1b[0m'
102+
103+
printf "Import package and checking package version ...\n "
104+
python3 - << EOF | tee ImportTest.log | grep -E "^Package version:\s+[0-9]+\.[0-9]+\.[0-9]+"
105+
from ${{ inputs.package_name }} import __version__
106+
107+
print(f"Package version: {__version__}")
108+
EOF
109+
if [[ $? -eq 0 ]]; then
110+
printf " ${ANSI_LIGHT_GREEN}[PASSED]${ANSI_NOCOLOR}\n"
111+
else
112+
printf " ${ANSI_LIGHT_RED}[FAILED]${ANSI_NOCOLOR}\n"
113+
printf "::error title=%s::%s\n" "InstallPackage" "Couldn't check package version of '${{ inputs.package_name }}'."
114+
exit 1
115+
fi
116+
117+
- name: 📦 Run application tests (Windows)
118+
if: matrix.system == 'windows'
119+
run: |
120+
$result=$(python -c "from pyEDAA.Reports import __version__; print(f""Package version: {__version__}"")")
121+
Write-Host $result
122+
if ($result -match "Package version:\s+\d+\.\d+\.\d+") {
123+
Write-Host -ForegroundColor Green "[PASSED]"
124+
} else {
125+
Write-Host -ForegroundColor Red "[FAILED]"
126+
Write-Host ("::error title={0}::{1}" -f "InstallPackage", "Couldn't check package version of '${{ inputs.package_name }}'.")
127+
exit 1
128+
}

.github/workflows/_Checking_JobTemplates.yml

+22-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ jobs:
1313
with:
1414
package_name: pyDummy
1515

16+
InstallParams:
17+
uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev
18+
with:
19+
package_name: pyDummy
20+
python_version_list: ''
21+
1622
UnitTestingParams:
1723
uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev
1824
with:
@@ -90,12 +96,24 @@ jobs:
9096
uses: pyTooling/Actions/.github/workflows/Package.yml@dev
9197
needs:
9298
- UnitTestingParams
93-
- UnitTesting
94-
- PlatformTesting
99+
# - UnitTesting
100+
# - PlatformTesting
95101
with:
96102
python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
97103
artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }}
98104

105+
Install:
106+
uses: pyTooling/Actions/.github/workflows/InstallPackage.yml@dev
107+
needs:
108+
- ConfigParams
109+
- UnitTestingParams
110+
- InstallParams
111+
- Package
112+
with:
113+
jobs: ${{ needs.InstallParams.outputs.python_jobs }}
114+
wheel: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }}
115+
package_name: ${{ needs.ConfigParams.outputs.package_fullname }}
116+
99117
PublishCoverageResults:
100118
uses: pyTooling/Actions/.github/workflows/PublishCoverageResults.yml@dev
101119
needs:
@@ -194,6 +212,7 @@ jobs:
194212
- Prepare
195213
- UnitTesting
196214
- PlatformTesting
215+
- Install
197216
# - StaticTypeCheck
198217
- Package
199218
- PublishToGitHubPages
@@ -211,6 +230,7 @@ jobs:
211230
- Prepare
212231
- UnitTesting
213232
- PlatformTesting
233+
- Install
214234
# - StaticTypeCheck
215235
- Package
216236
- PublishToGitHubPages

doc/make.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pushd %~dp0
55
REM Command file for Sphinx documentation
66

77
if "%SPHINXBUILD%" == "" (
8-
set SPHINXBUILD=sphinx-build
8+
set SPHINXBUILD=py -3.13 -m sphinx.cmd.build
99
)
1010
set SOURCEDIR=.
1111
set BUILDDIR=_build

0 commit comments

Comments
 (0)