Skip to content

Commit 80c4cc5

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

File tree

3 files changed

+268
-1
lines changed

3 files changed

+268
-1
lines changed

.github/workflows/CompletePipeline.yml

+21
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:
@@ -204,6 +216,15 @@ jobs:
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+
- InstallParams
223+
- Package
224+
with:
225+
jobs: ${{ needs.InstallParams.outputs.python_jobs }}
226+
wheel: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }}
227+
207228
# AppTesting:
208229
# uses: pyTooling/Actions/.github/workflows/ApplicationTesting.yml@dev
209230
# needs:

.github/workflows/InstallPackage.yml

+246
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
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: false
34+
default: ''
35+
type: string
36+
# requirements:
37+
# description: 'Python dependencies to be installed through pip.'
38+
# required: false
39+
# default: '-r tests/requirements.txt'
40+
# type: string
41+
# pacboy:
42+
# description: 'MSYS2 dependencies to be installed through pacboy (pacman).'
43+
# required: false
44+
# default: ""
45+
# type: string
46+
# mingw_requirements:
47+
# description: 'Override Python dependencies to be installed through pip on MSYS2 (MINGW64) only.'
48+
# required: false
49+
# default: ''
50+
# type: string
51+
# root_directory:
52+
# description: 'Working directory for running tests.'
53+
# required: false
54+
# default: ''
55+
# type: string
56+
# tests_directory:
57+
# description: 'Path to the directory containing tests (relative to root_directory).'
58+
# required: false
59+
# default: 'tests'
60+
# type: string
61+
# apptest_directory:
62+
# description: 'Path to the directory containing application tests (relative to tests_directory).'
63+
# required: false
64+
# default: 'app'
65+
# type: string
66+
# apptest_xml_artifact:
67+
# description: "Generate application test report with junitxml and upload results as an artifact."
68+
# required: false
69+
# default: ''
70+
# type: string
71+
72+
jobs:
73+
PackageInstallation:
74+
name: ${{ matrix.sysicon }} ${{ matrix.pyicon }} Package installation using Python ${{ matrix.python }}
75+
runs-on: ${{ matrix.runs-on }}
76+
77+
strategy:
78+
fail-fast: false
79+
matrix:
80+
include: ${{ fromJson(inputs.jobs) }}
81+
82+
defaults:
83+
run:
84+
shell: ${{ matrix.shell }}
85+
86+
steps:
87+
- name: 📥 Download artifacts '${{ inputs.wheel }}' from 'Package' job
88+
uses: pyTooling/download-artifact@v4
89+
with:
90+
name: ${{ inputs.wheel }}
91+
path: install
92+
93+
# - name: Compute pacman/pacboy packages
94+
# id: pacboy
95+
# if: matrix.system == 'msys2'
96+
# shell: python
97+
# run: |
98+
# from os import getenv
99+
# from pathlib import Path
100+
# from re import compile
101+
# from sys import version
102+
#
103+
# print(f"Python: {version}")
104+
#
105+
# def loadRequirementsFile(requirementsFile: Path):
106+
# requirements = []
107+
# with requirementsFile.open("r") as file:
108+
# for line in file.readlines():
109+
# line = line.strip()
110+
# if line.startswith("#") or line.startswith("https") or line == "":
111+
# continue
112+
# elif line.startswith("-r"):
113+
# # Remove the first word/argument (-r)
114+
# requirements += loadRequirementsFile(requirementsFile.parent / line[2:].lstrip())
115+
# else:
116+
# requirements.append(line)
117+
#
118+
# return requirements
119+
#
120+
# requirements = "${{ inputs.requirements }}"
121+
# if requirements.startswith("-r"):
122+
# requirementsFile = Path(requirements[2:].lstrip())
123+
# try:
124+
# dependencies = loadRequirementsFile(requirementsFile)
125+
# except FileNotFoundError as ex:
126+
# print(f"::error title=FileNotFoundError::{ex}")
127+
# exit(1)
128+
# else:
129+
# dependencies = [req.strip() for req in requirements.split(" ")]
130+
#
131+
# packages = {
132+
# "coverage": "python-coverage:p",
133+
# "docstr_coverage": "python-pyyaml:p",
134+
# "igraph": "igraph:p",
135+
# "jinja2": "python-markupsafe:p",
136+
# "lxml": "python-lxml:p",
137+
# "numpy": "python-numpy:p",
138+
# "markupsafe": "python-markupsafe:p",
139+
# "pip": "python-pip:p",
140+
# "pyyaml": "python-pyyaml:p",
141+
# "ruamel.yaml": "python-ruamel-yaml:p python-ruamel.yaml.clib:p",
142+
# "sphinx": "python-markupsafe:p",
143+
# "tomli": "python-tomli:p",
144+
# "wheel": "python-wheel:p",
145+
# "pyEDAA.ProjectModel": "python-ruamel-yaml:p python-ruamel.yaml.clib:p python-lxml:p",
146+
# "pyEDAA.Reports": "python-ruamel-yaml:p python-ruamel.yaml.clib:p python-lxml:p",
147+
# }
148+
# subPackages = {
149+
# "pytooling": {
150+
# "yaml": "python-ruamel-yaml:p python-ruamel.yaml.clib:p",
151+
# }
152+
# }
153+
#
154+
# regExp = compile(r"(?P<PackageName>[\w_\-\.]+)(?:\[(?P<SubPackages>(?:\w+)(?:\s*,\s*\w+)*)\])?(?:\s*(?P<Comperator>[<>~=]+)\s*)(?P<Version>\d+(?:\.\d+)*)(?:-(?P<VersionExtension>\w+))?")
155+
#
156+
# pacboyPackages = set(("python-pip:p", "python-wheel:p", "python-tomli:p"))
157+
# print(f"Processing dependencies ({len(dependencies)}):")
158+
# for dependency in dependencies:
159+
# print(f" {dependency}")
160+
#
161+
# match = regExp.match(dependency.lower())
162+
# if not match:
163+
# print(f" Wrong format: {dependency}")
164+
# print(f"::error title=Identifying Pacboy Packages::Unrecognized dependency format '{dependency}'")
165+
# continue
166+
#
167+
# package = match["PackageName"]
168+
# if package in packages:
169+
# rewrite = packages[package]
170+
# print(f" Found rewrite rule for '{package}': {rewrite}")
171+
# pacboyPackages.add(rewrite)
172+
#
173+
# if match["SubPackages"] and package in subPackages:
174+
# for subPackage in match["SubPackages"].split(","):
175+
# if subPackage in subPackages[package]:
176+
# rewrite = subPackages[package][subPackage]
177+
# print(f" Found rewrite rule for '{package}[..., {subPackage}, ...]': {rewrite}")
178+
# pacboyPackages.add(rewrite)
179+
#
180+
# # Write jobs to special file
181+
# github_output = Path(getenv("GITHUB_OUTPUT"))
182+
# print(f"GITHUB_OUTPUT: {github_output}")
183+
# with github_output.open("a+") as f:
184+
# f.write(f"pacboy_packages={' '.join(pacboyPackages)}\n")
185+
186+
- name: '🟦 Setup MSYS2 for ${{ matrix.runtime }}'
187+
uses: msys2/setup-msys2@v2
188+
if: matrix.system == 'msys2'
189+
with:
190+
msystem: ${{ matrix.runtime }}
191+
update: true
192+
# pacboy: >-
193+
# ${{ steps.pacboy.outputs.pacboy_packages }}
194+
# ${{ inputs.pacboy }}
195+
196+
- name: 🐍 Setup Python ${{ matrix.python }}
197+
uses: actions/setup-python@v5
198+
if: matrix.system != 'msys2'
199+
with:
200+
python-version: ${{ matrix.python }}
201+
202+
- name: 🔧 Install wheel and pip dependencies (native)
203+
if: matrix.system != 'msys2'
204+
run: |
205+
python -m pip install --disable-pip-version-check -U wheel
206+
# python -m pip install --disable-pip-version-check ${{ inputs.requirements }}
207+
208+
# - name: 🔧 Install pip dependencies (MSYS2)
209+
# if: matrix.system == 'msys2'
210+
# run: |
211+
# if [ -n '${{ inputs.mingw_requirements }}' ]; then
212+
# python -m pip install --disable-pip-version-check ${{ inputs.mingw_requirements }}
213+
# else
214+
# python -m pip install --disable-pip-version-check ${{ inputs.requirements }}
215+
# fi
216+
217+
- name: 🔧 Install wheel from artifact
218+
run: |
219+
ls -l install
220+
python -m pip install --disable-pip-version-check -U install/*.whl
221+
222+
- name: ✅ Run application tests (Ubuntu/macOS)
223+
if: matrix.system != 'windows'
224+
run: |
225+
python3 - << EOF | tee ImportTest.log
226+
from pyEDAA.Reports import __version__
227+
228+
print(f"Package version: {__version__}")
229+
EOF
230+
231+
ls -lAh .
232+
233+
- name: ✅ Run application tests (Windows)
234+
if: matrix.system == 'windows'
235+
run: |
236+
python --version
237+
238+
# - name: 📤 Upload 'TestReportSummary.xml' artifact
239+
# if: inputs.apptest_xml_artifact != ''
240+
# uses: pyTooling/upload-artifact@v4
241+
# with:
242+
# name: ${{ inputs.apptest_xml_artifact }}-${{ matrix.system }}-${{ matrix.runtime }}-${{ matrix.python }}
243+
# working-directory: report/unit
244+
# path: TestReportSummary.xml
245+
# if-no-files-found: error
246+
# retention-days: 1

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)