mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 02:56:56 +08:00
Install Python package and readout embedded package version.
This commit is contained in:
30
.github/workflows/CompletePipeline.yml
vendored
30
.github/workflows/CompletePipeline.yml
vendored
@@ -158,6 +158,18 @@ jobs:
|
|||||||
# exclude_list: ${{ inputs.apptest_exclude_list }}
|
# exclude_list: ${{ inputs.apptest_exclude_list }}
|
||||||
# disable_list: ${{ inputs.apptest_disable_list }}
|
# disable_list: ${{ inputs.apptest_disable_list }}
|
||||||
|
|
||||||
|
InstallParams:
|
||||||
|
uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev
|
||||||
|
with:
|
||||||
|
package_namespace: ${{ inputs.package_namespace }}
|
||||||
|
package_name: ${{ inputs.package_name }}
|
||||||
|
python_version: ${{ inputs.unittest_python_version }}
|
||||||
|
python_version_list: ''
|
||||||
|
system_list: ${{ inputs.unittest_system_list }}
|
||||||
|
include_list: ${{ inputs.unittest_include_list }}
|
||||||
|
exclude_list: ${{ inputs.unittest_exclude_list }}
|
||||||
|
disable_list: ${{ inputs.unittest_disable_list }}
|
||||||
|
|
||||||
UnitTesting:
|
UnitTesting:
|
||||||
uses: pyTooling/Actions/.github/workflows/UnitTesting.yml@dev
|
uses: pyTooling/Actions/.github/workflows/UnitTesting.yml@dev
|
||||||
needs:
|
needs:
|
||||||
@@ -199,11 +211,23 @@ jobs:
|
|||||||
uses: pyTooling/Actions/.github/workflows/Package.yml@dev
|
uses: pyTooling/Actions/.github/workflows/Package.yml@dev
|
||||||
needs:
|
needs:
|
||||||
- UnitTestingParams
|
- UnitTestingParams
|
||||||
- UnitTesting
|
# - UnitTesting
|
||||||
with:
|
with:
|
||||||
python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
|
python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
|
||||||
artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }}
|
artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }}
|
||||||
|
|
||||||
|
Install:
|
||||||
|
uses: pyTooling/Actions/.github/workflows/InstallPackage.yml@dev
|
||||||
|
needs:
|
||||||
|
- ConfigParams
|
||||||
|
- UnitTestingParams
|
||||||
|
- InstallParams
|
||||||
|
- Package
|
||||||
|
with:
|
||||||
|
jobs: ${{ needs.InstallParams.outputs.python_jobs }}
|
||||||
|
wheel: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }}
|
||||||
|
package_name: ${{ needs.ConfigParams.outputs.package_fullname }}
|
||||||
|
|
||||||
# AppTesting:
|
# AppTesting:
|
||||||
# uses: pyTooling/Actions/.github/workflows/ApplicationTesting.yml@dev
|
# uses: pyTooling/Actions/.github/workflows/ApplicationTesting.yml@dev
|
||||||
# needs:
|
# needs:
|
||||||
@@ -244,7 +268,7 @@ jobs:
|
|||||||
- UnitTestingParams
|
- UnitTestingParams
|
||||||
- UnitTesting
|
- UnitTesting
|
||||||
with:
|
with:
|
||||||
testsuite-summary-name: ${{ inputs.package_name }}
|
testsuite-summary-name: ${{ needs.ConfigParams.outputs.package_fullname }}
|
||||||
merged_junit_filename: ${{ needs.ConfigParams.outputs.unittest_merged_report_xml_filename }}
|
merged_junit_filename: ${{ needs.ConfigParams.outputs.unittest_merged_report_xml_filename }}
|
||||||
merged_junit_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }}
|
merged_junit_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }}
|
||||||
dorny: ${{ inputs.dorny }}
|
dorny: ${{ inputs.dorny }}
|
||||||
@@ -314,6 +338,7 @@ jobs:
|
|||||||
needs:
|
needs:
|
||||||
- Prepare
|
- Prepare
|
||||||
- UnitTesting
|
- UnitTesting
|
||||||
|
- Install
|
||||||
# - AppTesting
|
# - AppTesting
|
||||||
# - StaticTypeCheck
|
# - StaticTypeCheck
|
||||||
- Package
|
- Package
|
||||||
@@ -332,6 +357,7 @@ jobs:
|
|||||||
needs:
|
needs:
|
||||||
- Prepare
|
- Prepare
|
||||||
- UnitTesting
|
- UnitTesting
|
||||||
|
- Install
|
||||||
# - AppTesting
|
# - AppTesting
|
||||||
# - StaticTypeCheck
|
# - StaticTypeCheck
|
||||||
- Package
|
- Package
|
||||||
|
|||||||
22
.github/workflows/ExtractConfiguration.yml
vendored
22
.github/workflows/ExtractConfiguration.yml
vendored
@@ -145,6 +145,12 @@ jobs:
|
|||||||
namespace = "${{ inputs.package_namespace }}".strip()
|
namespace = "${{ inputs.package_namespace }}".strip()
|
||||||
name = "${{ inputs.package_name }}".strip()
|
name = "${{ inputs.package_name }}".strip()
|
||||||
|
|
||||||
|
print(dedent(f"""\
|
||||||
|
INPUTS:
|
||||||
|
package_namespace: {namespace}
|
||||||
|
package_name: {name}
|
||||||
|
"""))
|
||||||
|
|
||||||
if namespace == "" or namespace == ".":
|
if namespace == "" or namespace == ".":
|
||||||
fullname = f"{name}"
|
fullname = f"{name}"
|
||||||
directory = f"{name}"
|
directory = f"{name}"
|
||||||
@@ -154,6 +160,13 @@ jobs:
|
|||||||
directory = f"{namespace}/{name}"
|
directory = f"{namespace}/{name}"
|
||||||
mypy_prepare_command = f"touch {namespace}/__init__.py"
|
mypy_prepare_command = f"touch {namespace}/__init__.py"
|
||||||
|
|
||||||
|
print(dedent(f"""\
|
||||||
|
OUTPUTS:
|
||||||
|
package_fullname: {fullname}
|
||||||
|
package_directory: {directory}
|
||||||
|
mypy_prepare_command: {mypy_prepare_command}
|
||||||
|
"""))
|
||||||
|
|
||||||
github_output = Path(getenv("GITHUB_OUTPUT"))
|
github_output = Path(getenv("GITHUB_OUTPUT"))
|
||||||
print(f"GITHUB_OUTPUT: {github_output}")
|
print(f"GITHUB_OUTPUT: {github_output}")
|
||||||
with github_output.open("a+", encoding="utf-8") as f:
|
with github_output.open("a+", encoding="utf-8") as f:
|
||||||
@@ -234,4 +247,11 @@ jobs:
|
|||||||
coverage_report_json={coverageJSONFile.as_posix()}
|
coverage_report_json={coverageJSONFile.as_posix()}
|
||||||
"""))
|
"""))
|
||||||
|
|
||||||
print(f"DEBUG:\n unittest xml: {unittestXMLFile}\n merged unittest xml: {mergedUnittestXMLFile}\n coverage html: {coverageHTMLDirectory}\n coverage xml: {coverageXMLFile}\n coverage json: {coverageJSONFile}")
|
print(dedent(f"""\
|
||||||
|
DEBUG:
|
||||||
|
unittest xml: {unittestXMLFile}
|
||||||
|
merged unittest xml: {mergedUnittestXMLFile}
|
||||||
|
coverage html: {coverageHTMLDirectory}
|
||||||
|
coverage xml: {coverageXMLFile}
|
||||||
|
coverage json: {coverageJSONFile}
|
||||||
|
"""))
|
||||||
|
|||||||
128
.github/workflows/InstallPackage.yml
vendored
Normal file
128
.github/workflows/InstallPackage.yml
vendored
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
# ==================================================================================================================== #
|
||||||
|
# Authors: #
|
||||||
|
# Patrick Lehmann #
|
||||||
|
# #
|
||||||
|
# ==================================================================================================================== #
|
||||||
|
# Copyright 2025-2025 The pyTooling Authors #
|
||||||
|
# #
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); #
|
||||||
|
# you may not use this file except in compliance with the License. #
|
||||||
|
# You may obtain a copy of the License at #
|
||||||
|
# #
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||||
|
# #
|
||||||
|
# Unless required by applicable law or agreed to in writing, software #
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||||
|
# See the License for the specific language governing permissions and #
|
||||||
|
# limitations under the License. #
|
||||||
|
# #
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 #
|
||||||
|
# ==================================================================================================================== #
|
||||||
|
name: Install Package
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
jobs:
|
||||||
|
description: 'JSON list with environment fields, telling the system and Python versions to run tests with.'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
wheel:
|
||||||
|
description: "Wheel package as input artifact."
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
package_name:
|
||||||
|
description: "Name of the Python package."
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
PackageInstallation:
|
||||||
|
name: ${{ matrix.sysicon }} ${{ matrix.pyicon }} Package installation using Python ${{ matrix.python }}
|
||||||
|
runs-on: ${{ matrix.runs-on }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include: ${{ fromJson(inputs.jobs) }}
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: ${{ matrix.shell }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 📥 Download artifacts '${{ inputs.wheel }}' from 'Package' job
|
||||||
|
uses: pyTooling/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ inputs.wheel }}
|
||||||
|
path: install
|
||||||
|
|
||||||
|
- name: '🟦 Setup MSYS2 for ${{ matrix.runtime }}'
|
||||||
|
uses: msys2/setup-msys2@v2
|
||||||
|
if: matrix.system == 'msys2'
|
||||||
|
with:
|
||||||
|
msystem: ${{ matrix.runtime }}
|
||||||
|
update: true
|
||||||
|
pacboy: >-
|
||||||
|
python-pip:p python-wheel:p
|
||||||
|
python-lxml:p
|
||||||
|
python-ruamel-yaml:p python-ruamel.yaml.clib:p
|
||||||
|
python-tomli:p
|
||||||
|
|
||||||
|
- name: 🐍 Setup Python ${{ matrix.python }}
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
if: matrix.system != 'msys2'
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python }}
|
||||||
|
|
||||||
|
- name: 🔧 Install wheel and pip dependencies (native)
|
||||||
|
if: matrix.system != 'msys2'
|
||||||
|
run: |
|
||||||
|
python -m pip install --disable-pip-version-check -U wheel
|
||||||
|
|
||||||
|
- name: 🔧 Install wheel from artifact (Ubuntu/macOS)
|
||||||
|
if: matrix.system != 'windows'
|
||||||
|
run: |
|
||||||
|
python -m pip install --disable-pip-version-check -U install/*.whl
|
||||||
|
|
||||||
|
- name: 🔧 Install wheel from artifact (Windows)
|
||||||
|
if: matrix.system == 'windows'
|
||||||
|
run: |
|
||||||
|
python -m pip install -v --disable-pip-version-check (Get-Item .\install\*.whl).FullName
|
||||||
|
|
||||||
|
- name: 📦 Run application tests (Ubuntu/macOS)
|
||||||
|
if: matrix.system != 'windows'
|
||||||
|
run: |
|
||||||
|
set +e
|
||||||
|
|
||||||
|
ANSI_LIGHT_RED=$'\x1b[91m'
|
||||||
|
ANSI_LIGHT_GREEN=$'\x1b[92m'
|
||||||
|
ANSI_NOCOLOR=$'\x1b[0m'
|
||||||
|
|
||||||
|
printf "Import package and checking package version ...\n "
|
||||||
|
python3 - << EOF | tee ImportTest.log | grep -E "^Package version:\s+[0-9]+\.[0-9]+\.[0-9]+"
|
||||||
|
from ${{ inputs.package_name }} import __version__
|
||||||
|
|
||||||
|
print(f"Package version: {__version__}")
|
||||||
|
EOF
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
printf " ${ANSI_LIGHT_GREEN}[PASSED]${ANSI_NOCOLOR}\n"
|
||||||
|
else
|
||||||
|
printf " ${ANSI_LIGHT_RED}[FAILED]${ANSI_NOCOLOR}\n"
|
||||||
|
printf "::error title=%s::%s\n" "InstallPackage" "Couldn't check package version of '${{ inputs.package_name }}'."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: 📦 Run application tests (Windows)
|
||||||
|
if: matrix.system == 'windows'
|
||||||
|
run: |
|
||||||
|
$result=$(python -c "from ${{ inputs.package_name }} import __version__; print(f""Package version: {__version__}"")")
|
||||||
|
Write-Host $result
|
||||||
|
if ($result -match "Package version:\s+\d+\.\d+\.\d+") {
|
||||||
|
Write-Host -ForegroundColor Green "[PASSED]"
|
||||||
|
} else {
|
||||||
|
Write-Host -ForegroundColor Red "[FAILED]"
|
||||||
|
Write-Host ("::error title={0}::{1}" -f "InstallPackage", "Couldn't check package version of '${{ inputs.package_name }}'.")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
24
.github/workflows/_Checking_JobTemplates.yml
vendored
24
.github/workflows/_Checking_JobTemplates.yml
vendored
@@ -13,6 +13,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
package_name: pyDummy
|
package_name: pyDummy
|
||||||
|
|
||||||
|
InstallParams:
|
||||||
|
uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev
|
||||||
|
with:
|
||||||
|
package_name: pyDummy
|
||||||
|
python_version_list: ''
|
||||||
|
|
||||||
UnitTestingParams:
|
UnitTestingParams:
|
||||||
uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev
|
uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev
|
||||||
with:
|
with:
|
||||||
@@ -90,12 +96,24 @@ jobs:
|
|||||||
uses: pyTooling/Actions/.github/workflows/Package.yml@dev
|
uses: pyTooling/Actions/.github/workflows/Package.yml@dev
|
||||||
needs:
|
needs:
|
||||||
- UnitTestingParams
|
- UnitTestingParams
|
||||||
- UnitTesting
|
# - UnitTesting
|
||||||
- PlatformTesting
|
# - PlatformTesting
|
||||||
with:
|
with:
|
||||||
python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
|
python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
|
||||||
artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }}
|
artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }}
|
||||||
|
|
||||||
|
Install:
|
||||||
|
uses: pyTooling/Actions/.github/workflows/InstallPackage.yml@dev
|
||||||
|
needs:
|
||||||
|
- ConfigParams
|
||||||
|
- UnitTestingParams
|
||||||
|
- InstallParams
|
||||||
|
- Package
|
||||||
|
with:
|
||||||
|
jobs: ${{ needs.InstallParams.outputs.python_jobs }}
|
||||||
|
wheel: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }}
|
||||||
|
package_name: ${{ needs.ConfigParams.outputs.package_fullname }}
|
||||||
|
|
||||||
PublishCoverageResults:
|
PublishCoverageResults:
|
||||||
uses: pyTooling/Actions/.github/workflows/PublishCoverageResults.yml@dev
|
uses: pyTooling/Actions/.github/workflows/PublishCoverageResults.yml@dev
|
||||||
needs:
|
needs:
|
||||||
@@ -194,6 +212,7 @@ jobs:
|
|||||||
- Prepare
|
- Prepare
|
||||||
- UnitTesting
|
- UnitTesting
|
||||||
- PlatformTesting
|
- PlatformTesting
|
||||||
|
- Install
|
||||||
# - StaticTypeCheck
|
# - StaticTypeCheck
|
||||||
- Package
|
- Package
|
||||||
- PublishToGitHubPages
|
- PublishToGitHubPages
|
||||||
@@ -211,6 +230,7 @@ jobs:
|
|||||||
- Prepare
|
- Prepare
|
||||||
- UnitTesting
|
- UnitTesting
|
||||||
- PlatformTesting
|
- PlatformTesting
|
||||||
|
- Install
|
||||||
# - StaticTypeCheck
|
# - StaticTypeCheck
|
||||||
- Package
|
- Package
|
||||||
- PublishToGitHubPages
|
- PublishToGitHubPages
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ pushd %~dp0
|
|||||||
REM Command file for Sphinx documentation
|
REM Command file for Sphinx documentation
|
||||||
|
|
||||||
if "%SPHINXBUILD%" == "" (
|
if "%SPHINXBUILD%" == "" (
|
||||||
set SPHINXBUILD=sphinx-build
|
set SPHINXBUILD=py -3.13 -m sphinx.cmd.build
|
||||||
)
|
)
|
||||||
set SOURCEDIR=.
|
set SOURCEDIR=.
|
||||||
set BUILDDIR=_build
|
set BUILDDIR=_build
|
||||||
|
|||||||
Reference in New Issue
Block a user