From 839044ccdcb8b5150a349d530826bd06dc79ce99 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Tue, 20 Feb 2024 12:12:55 +0100 Subject: [PATCH 01/38] fix: general file changes --- .gitignore | 3 +++ .pre-commit-config.yaml | 10 +++++----- README.rst | 2 +- doc/source/conf.py | 23 ++--------------------- 4 files changed, 11 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index 2b2f3c3..f02ad18 100644 --- a/.gitignore +++ b/.gitignore @@ -129,3 +129,6 @@ dmypy.json .pyre/ doc/_build/ *-rendered-example.yml + +# vscode +.vscode/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9f1ec9b..80efe46 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,24 +1,24 @@ repos: - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 24.2.0 hooks: - id: black - repo: https://github.com/pycqa/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort args: - --line-length=88 - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 + rev: 7.0.0 hooks: - id: flake8 - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-merge-conflict - id: check-yaml @@ -28,6 +28,6 @@ repos: # Validate our github workflow files - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.22.0 + rev: 0.28.0 hooks: - id: check-github-workflows \ No newline at end of file diff --git a/README.rst b/README.rst index 63c4df3..4361c78 100644 --- a/README.rst +++ b/README.rst @@ -26,7 +26,7 @@ For more information on available actions and how to use them, see Purpose -======= +------- The Ansys SCADE actions prepare a SCADE environment for executing tests. diff --git a/doc/source/conf.py b/doc/source/conf.py index f49fcb1..521bf7a 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -17,10 +17,6 @@ ACTIONS_SUFFIXES = "" ACTIONS_INPUTS_FIELDS = ("description", "required", "type", "default") ACTIONS_OUTPUTS_FIELDS = ("description",) -ACCEPTED_LICENSES = BASE_DIR / "check-licenses" / "accepted-licenses.txt" -IGNORED_PACKAGES = BASE_DIR / "check-licenses" / "ignored-packages.txt" -IGNORED_SAFETY = BASE_DIR / "check-vulnerabilities" / "ignored-safety.txt" - # Project information project = "Ansys SCADE Actions" copyright = f"(c) 2023-{datetime.today().year} ANSYS, Inc. and/or its affiliates." @@ -61,7 +57,6 @@ "use_edit_page_button": True, "additional_breadcrumbs": [ ("PyAnsys", "https://docs.pyansys.com/"), - ("PyAnsys Developer’s Guide", "https://dev.docs.pyansys.com/"), ], "switcher": { "json_url": f"https://{cname}/versions.json", @@ -73,6 +68,7 @@ f"actions-v{get_version_match(__version__).replace('.', '-')}": "Ansys-scade-actions", }, }, + "check_switcher": False, } # Specify Sphinx extensions to use @@ -367,19 +363,4 @@ def load_file_lines_as_list(file_path): """ with open(file_path) as accepted_licenses_file: - return list(accepted_licenses_file.read().split("\n")) - - -if False: - # TODO: should that be replicated this in this context? - # Check licenses - for var, file in zip( - ["accepted_licenses", "ignored_packages"], [ACCEPTED_LICENSES, IGNORED_PACKAGES] - ): - jinja_contexts["check-licenses"][var] = load_file_lines_as_list(file) - - # Check vulnerabilities - jinja_contexts["check-vulnerabilities"]["ignored_safety"] = load_file_lines_as_list( - IGNORED_SAFETY - ) - print(jinja_contexts["check-vulnerabilities"]["ignored_safety"]) + return list(accepted_licenses_file.read().split("\n")) \ No newline at end of file From a3f07ff773abbb73793063707bce9754fc56ab57 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Tue, 20 Feb 2024 12:17:49 +0100 Subject: [PATCH 02/38] fix: ci-cd --- .github/workflows/ci_cd.yml | 12 ++++++------ doc/source/conf.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index f12f4e2..0850740 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -73,11 +73,11 @@ jobs: body: | Please add one of the following labels to add this contribution to the Release Notes :point_down: - [bug](https://github.com/ansys/actions/pulls?q=label%3Abug+) - - [documentation](https://github.com/ansys/actions/pulls?q=label%3Adocumentation+) - - [enhancement](https://github.com/ansys/actions/pulls?q=label%3Aenhancement+) - - [good first issue](https://github.com/ansys/actions/pulls?q=label%3Agood+first+issue) - - [maintenance](https://github.com/ansys/actions/pulls?q=label%3Amaintenance+) - - [release](https://github.com/ansys/actions/pulls?q=label%3Arelease+) + - [documentation](https://github.com/ansys/scade-actions/pulls?q=label%3Adocumentation+) + - [enhancement](https://github.com/ansys/scade-actions/pulls?q=label%3Aenhancement+) + - [good first issue](https://github.com/ansys/scade-actions/pulls?q=label%3Agood+first+issue) + - [maintenance](https://github.com/ansys/scade-actions/pulls?q=label%3Amaintenance+) + - [release](https://github.com/ansys/scade-actions/pulls?q=label%3Arelease+) commit-and-branch-style: name: "Commit and branch style" @@ -143,7 +143,7 @@ jobs: steps: # - name: Checkout # uses: actions/checkout@v4 - # + # - name: Execute tests uses: ./scade-tests-pytest with: diff --git a/doc/source/conf.py b/doc/source/conf.py index 521bf7a..3365414 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -363,4 +363,4 @@ def load_file_lines_as_list(file_path): """ with open(file_path) as accepted_licenses_file: - return list(accepted_licenses_file.read().split("\n")) \ No newline at end of file + return list(accepted_licenses_file.read().split("\n")) From c0683441080c959651b86d39ba6f4d56edb4a722 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Tue, 20 Feb 2024 12:28:27 +0100 Subject: [PATCH 03/38] doc: update the docs check --- doc/source/conf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/source/conf.py b/doc/source/conf.py index 3365414..4916432 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -96,6 +96,9 @@ # Generate section labels for up to four levels autosectionlabel_maxdepth = 2 +linkcheck_ignore = [ + r"https://github.com/ansys/scade-actions*", +] # Auxiliary routines for automatic documentation generation From 0c0a3646d4d3f12124fd6eca56327e2c4f93a2b4 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Tue, 20 Feb 2024 15:29:46 +0100 Subject: [PATCH 04/38] doc: update the test requirement --- tests-pytest/action.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tests-pytest/action.yml b/tests-pytest/action.yml index 2bd78bf..986bb51 100644 --- a/tests-pytest/action.yml +++ b/tests-pytest/action.yml @@ -47,6 +47,12 @@ inputs: default: 'true' required: false + requirements-tests-file: + description: > + Flag to indicate if the requirements_tests.txt file exists. + default: 'false' + required: false + runs: using: "composite" @@ -90,11 +96,14 @@ runs: echo Install test dependencies from the requirements file %PYTHON_EXE% -m pip install -r ${{ inputs.library-dir }}/requirements/requirements_tests.txt ) + echo EXISTS_TESTS_REQUIREMENTS=%ERRORLEVEL%>> %GITHUB_ENV% - # - name: "Install test dependencies from pyproject.toml" - # shell: cmd - # if: env.EXISTS_TESTS_REQUIREMENTS == 'false' - # run: python -m pip install .[tests] + - name: "Install test dependencies from pyproject.toml" + shell: cmd + if: env.EXISTS_TESTS_REQUIREMENTS == 'false' + run: | + :: Add the requirements + %PYTHON_EXE% -m pip install ${{ inputs.library-dir }}[tests] - name: "Executing test suite" shell: cmd From 43bdb3813414d7570380d41a3ecca0da70901f93 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 21 Feb 2024 10:07:32 +0100 Subject: [PATCH 05/38] debug: test requirement --- README.rst | 7 +- tests/{python => python-pyproject}/.gitignore | 0 tests/python-pyproject/pyproject.toml | 14 + .../src/test_package/__init__.py | 0 .../src/test_package/script.py | 0 .../tests/conftest.py | 0 .../tests/resources/Model.etp | 0 .../tests/resources/P.xscade | 0 .../tests/test_script.py | 0 tests/python-setup/.gitignore | 32 ++ .../requirements/requirements_tests.txt | 0 tests/{python => python-setup}/setup.py | 0 .../python-setup/src/test_package/__init__.py | 21 + tests/python-setup/src/test_package/script.py | 45 +++ tests/python-setup/tests/conftest.py | 90 +++++ tests/python-setup/tests/resources/Model.etp | 364 ++++++++++++++++++ tests/python-setup/tests/resources/P.xscade | 130 +++++++ tests/python-setup/tests/test_script.py | 54 +++ 18 files changed, 754 insertions(+), 3 deletions(-) rename tests/{python => python-pyproject}/.gitignore (100%) create mode 100644 tests/python-pyproject/pyproject.toml rename tests/{python => python-pyproject}/src/test_package/__init__.py (100%) rename tests/{python => python-pyproject}/src/test_package/script.py (100%) rename tests/{python => python-pyproject}/tests/conftest.py (100%) rename tests/{python => python-pyproject}/tests/resources/Model.etp (100%) rename tests/{python => python-pyproject}/tests/resources/P.xscade (100%) rename tests/{python => python-pyproject}/tests/test_script.py (100%) create mode 100644 tests/python-setup/.gitignore rename tests/{python => python-setup}/requirements/requirements_tests.txt (100%) rename tests/{python => python-setup}/setup.py (100%) create mode 100644 tests/python-setup/src/test_package/__init__.py create mode 100644 tests/python-setup/src/test_package/script.py create mode 100644 tests/python-setup/tests/conftest.py create mode 100644 tests/python-setup/tests/resources/Model.etp create mode 100644 tests/python-setup/tests/resources/P.xscade create mode 100644 tests/python-setup/tests/test_script.py diff --git a/README.rst b/README.rst index 4361c78..2b28cbc 100644 --- a/README.rst +++ b/README.rst @@ -7,8 +7,8 @@ Ansys SCADE actions :target: https://actions.docs.ansys.com/ :alt: Ansys -.. |CI-CD| image:: https://github.com/ansys/actions/actions/workflows/ci_cd.yml/badge.svg - :target: https://github.com/ansys/actions/actions/workflows/ci_cd.yml +.. |CI-CD| image:: https://github.com/ansys/scade-actions/actions/workflows/ci_cd.yml/badge.svg + :target: https://github.com/ansys/scade-actions/actions/workflows/ci_cd.yml :alt: CI-CD .. |MIT| image:: https://img.shields.io/badge/License-MIT-blue.svg @@ -30,4 +30,5 @@ Purpose The Ansys SCADE actions prepare a SCADE environment for executing tests. -They are driven by a Ansys SCADE version, such as ``23.1`` or ``24.1``, instead of a Python version, such as ``3.7`` or ``3.10``. +They are driven by a Ansys SCADE version, such as ``23.1`` or ``24.1``, +instead of a Python version, such as ``3.7`` or ``3.10``. diff --git a/tests/python/.gitignore b/tests/python-pyproject/.gitignore similarity index 100% rename from tests/python/.gitignore rename to tests/python-pyproject/.gitignore diff --git a/tests/python-pyproject/pyproject.toml b/tests/python-pyproject/pyproject.toml new file mode 100644 index 0000000..fe776fb --- /dev/null +++ b/tests/python-pyproject/pyproject.toml @@ -0,0 +1,14 @@ +[build-system] +requires = ["flit_core >=3.2,<4"] +build-backend = "flit_core.buildapi" + +[project] +name="test_package" +version="0.1.dev0" +description ="Test purpose" + +[project.optional-dependencies] +test = [ + "pytest==7.1.2", + "pytest-cov==3.0.0" +] diff --git a/tests/python/src/test_package/__init__.py b/tests/python-pyproject/src/test_package/__init__.py similarity index 100% rename from tests/python/src/test_package/__init__.py rename to tests/python-pyproject/src/test_package/__init__.py diff --git a/tests/python/src/test_package/script.py b/tests/python-pyproject/src/test_package/script.py similarity index 100% rename from tests/python/src/test_package/script.py rename to tests/python-pyproject/src/test_package/script.py diff --git a/tests/python/tests/conftest.py b/tests/python-pyproject/tests/conftest.py similarity index 100% rename from tests/python/tests/conftest.py rename to tests/python-pyproject/tests/conftest.py diff --git a/tests/python/tests/resources/Model.etp b/tests/python-pyproject/tests/resources/Model.etp similarity index 100% rename from tests/python/tests/resources/Model.etp rename to tests/python-pyproject/tests/resources/Model.etp diff --git a/tests/python/tests/resources/P.xscade b/tests/python-pyproject/tests/resources/P.xscade similarity index 100% rename from tests/python/tests/resources/P.xscade rename to tests/python-pyproject/tests/resources/P.xscade diff --git a/tests/python/tests/test_script.py b/tests/python-pyproject/tests/test_script.py similarity index 100% rename from tests/python/tests/test_script.py rename to tests/python-pyproject/tests/test_script.py diff --git a/tests/python-setup/.gitignore b/tests/python-setup/.gitignore new file mode 100644 index 0000000..c024220 --- /dev/null +++ b/tests/python-setup/.gitignore @@ -0,0 +1,32 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST +TestResults +*.pyproj +*.sln +*.vsw diff --git a/tests/python/requirements/requirements_tests.txt b/tests/python-setup/requirements/requirements_tests.txt similarity index 100% rename from tests/python/requirements/requirements_tests.txt rename to tests/python-setup/requirements/requirements_tests.txt diff --git a/tests/python/setup.py b/tests/python-setup/setup.py similarity index 100% rename from tests/python/setup.py rename to tests/python-setup/setup.py diff --git a/tests/python-setup/src/test_package/__init__.py b/tests/python-setup/src/test_package/__init__.py new file mode 100644 index 0000000..3bc3c8e --- /dev/null +++ b/tests/python-setup/src/test_package/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/tests/python-setup/src/test_package/script.py b/tests/python-setup/src/test_package/script.py new file mode 100644 index 0000000..458e59d --- /dev/null +++ b/tests/python-setup/src/test_package/script.py @@ -0,0 +1,45 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +""" +Simple script to verify the correct execution of the actions. +""" + +from pathlib import Path + +from scade import output +from scade.model.project.stdproject import get_roots as get_projects +from scade.model.suite import get_roots as get_sessions + + +def get_project_names(projects): + return [Path(_.pathname).name for _ in projects] + + +def get_operator_paths(model): + return [_.get_full_path() for _ in model.all_operators] + + +if __name__ == "__main__": + output(str(get_project_names(get_projects())) + "\n") + # assume one and only one SCADE project + output(str(get_operator_paths(get_sessions()[0].model)) + "\n") diff --git a/tests/python-setup/tests/conftest.py b/tests/python-setup/tests/conftest.py new file mode 100644 index 0000000..95db65f --- /dev/null +++ b/tests/python-setup/tests/conftest.py @@ -0,0 +1,90 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +"""Unit tests fixtures.""" + +import os +import re +import sys +from inspect import getsourcefile +from pathlib import Path + +# import pytest + +# set sys.path from the python interpreter location (/SCADE/contrib/Python3xx) +# note: these tests are executed in the context of a virtual environment +# on top of a SCADE's Python distribution + +for line in (Path(sys.executable).parent.parent / "pyvenv.cfg").open("r"): + m = re.match(r"^home\s*=\s*(.*)$", line) + if m: + contrib = Path(m.groups()[0]).parent + break + +assert contrib +base = contrib.parent / "SCADE" +bin = base / "bin" +assert bin.exists() +sys.path.append(str(bin)) +lib = base / "APIs" / "Python" / "lib" +assert lib.exists() +sys.path.append(str(lib)) + + +# can be imported since sys.path is updated +# isort: split +# activate the SCADE Python APIs by importing scade_env +import scade_env # noqa: E402, F401 + +# must be imported after scade_env +# isort: split +import scade # noqa: E402 +import scade.model.suite as suite # noqa: E402 + + +def get_resources_dir() -> Path: + """Return the directory ./resources relative to this file's directory.""" + script_path = Path(os.path.abspath(getsourcefile(lambda: 0))) + return script_path.parent + + +def load_session(pathname: Path): + """ + Load a Scade model in a separate environment. + + Note: The model can have unresolved references since the libraries + are not loaded. + """ + session = suite.Session() + session.load2(str(pathname)) + assert session.model + return session + + +def load_project(pathname: Path): + """ + Load a Scade project in a separate environment. + + Note: Undocumented API. + """ + project_ = scade.load_project(str(pathname)) + return project_ diff --git a/tests/python-setup/tests/resources/Model.etp b/tests/python-setup/tests/resources/Model.etp new file mode 100644 index 0000000..50af156 --- /dev/null +++ b/tests/python-setup/tests/resources/Model.etp @@ -0,0 +1,364 @@ + + + + + SC + + + SCADE65 + + + $(Configuration) + 14 + + + /nologo /ML /O2 + 14 + + + C QUAL663 + 14 + + + char + float32 + float64 + int8 + int16 + int32 + int64 + uint8 + uint16 + uint32 + uint64 + size + 14 + + + $(TargetDir)\user_macros.h + 14 + + + false + 14 + + + win64 + 14 + + + Code Generator + 14 + 23 + 44 + 57 + + + $(Configuration) + 23 + + + /nologo /ML /O2 + 23 + + + C QUAL663 + 23 + + + char + float32 + float64 + int8 + int16 + int32 + int64 + uint8 + uint16 + uint32 + uint64 + size + 23 + + + true + 23 + + + true + 23 + + + true + 23 + + + Simulator + 23 + + + $(TargetDir)\user_macros.h + 23 + + + win64 + 23 + + + Reporter/ScadeReport.tcl + 34 + + + true + 34 + + + Flat + 34 + + + Reporter + 34 + 39 + 44 + 65 + + + rtf + 39 + + + Reporter/ScadeReport.tcl + 39 + + + true + 39 + + + Flat + 39 + + + $(Configuration) + 44 + + + /nologo /ML /O2 + 44 + + + C QUAL663 + 44 + + + char + float32 + float64 + int8 + int16 + int32 + int64 + uint8 + uint16 + uint32 + uint64 + size + 44 + + + $(TargetDir)\user_macros.h + 44 + + + true + 44 + + + + 44 + + + Simulator + 44 + + + win64 + 44 + + + $(SCADE)/scripts/MetricRule/DefaultMetrics.py + $(SCADE)/scripts/MetricRule/DefaultRules.py + + + Metrics and Rules Checker + 54 + + + $(Configuration) + 57 + + + /nologo /ML /O2 + 57 + + + C QUAL663 + 57 + + + char + float32 + float64 + int8 + int16 + int32 + int64 + uint8 + uint16 + uint32 + uint64 + size + 57 + + + $(TargetDir)\user_macros.h + 57 + + + T&S Optimizer + 57 + + + Timing and Stack Verifiers + 57 + + + rtf + 65 + + + Reporter/ScadeQualifiedReport.tcl + 65 + + + true + 65 + + + Flat + 65 + + + true + 65 + + + true + 65 + + + true + 65 + + + Model.xscade + + + Model.err + + + $(SCADE)/lib/DefaultAty.aty + + + true + + + <title> + + + <subtitle> + + + <description> + + + <authors> + + + <company> + + + <date> + + + <index> + + + <reference> + + + Timing and Stack Analysis Tools + 14 + 23 + 34 + 39 + 44 + 54 + 57 + 65 + + + DiffAnalyzer + 14 + 23 + 34 + 39 + 44 + 54 + 57 + 65 + + + Synchronization + 14 + 23 + 34 + 39 + 44 + 54 + 57 + 65 + + + Import/Export + 14 + 23 + 34 + 39 + 44 + 54 + 57 + 65 + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/python-setup/tests/resources/P.xscade b/tests/python-setup/tests/resources/P.xscade new file mode 100644 index 0000000..fb969fe --- /dev/null +++ b/tests/python-setup/tests/resources/P.xscade @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/python-setup/tests/test_script.py b/tests/python-setup/tests/test_script.py new file mode 100644 index 0000000..dad14ed --- /dev/null +++ b/tests/python-setup/tests/test_script.py @@ -0,0 +1,54 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +""" +Test suite for script.py. + +Test strategy: + +* Verify the returned values for a simple Scade model. +""" + +import pytest +from conftest import get_resources_dir, load_project, load_session +from test_package import script + + +@pytest.fixture(scope="session") +def roots(): + """Unique instance of the test model Model.""" + path = get_resources_dir() / "resources" / "Model.etp" + project = load_project(path) + session = load_session(path) + return project, session + + +def test_get_project_names(roots): + project, _ = roots + names = script.get_project_names([project]) + assert names == ["Model.etp"] + + +def test_get_operator_paths(roots): + _, session = roots + paths = script.get_operator_paths(session.model) + assert paths == ["P::Root/"] From c2e900b75ad6c620ffa603592120d317c4e6a0f9 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 21 Feb 2024 10:33:37 +0100 Subject: [PATCH 06/38] fix: revert ci-cd --- .github/workflows/ci_cd.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 0850740..353a6b9 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -144,12 +144,19 @@ jobs: # - name: Checkout # uses: actions/checkout@v4 # - - name: Execute tests + - name: Execute pyproject tests uses: ./scade-tests-pytest with: scade-version: ${{ matrix.scade-version }} - library-dir: "tests/python" - pytest-postargs: "tests/python/tests -vv" + library-dir: "tests/python-pyproject" + pytest-postargs: "tests/python-pyproject/tests -vv" + checkout: false + - name: Execute setup.py tests + uses: ./scade-tests-pytest + with: + scade-version: ${{ matrix.scade-version }} + library-dir: "tests/python-setup" + pytest-postargs: "tests/python-setup/tests -vv" checkout: false doc-deploy-dev: From 5a6a4901f0efdb709fbe34b72b0f551bc02a158c Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 21 Feb 2024 10:39:25 +0100 Subject: [PATCH 07/38] fix: checkout the lib --- .github/workflows/ci_cd.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 353a6b9..680a48e 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -144,19 +144,19 @@ jobs: # - name: Checkout # uses: actions/checkout@v4 # - - name: Execute pyproject tests + - name: Execute setup.py tests uses: ./scade-tests-pytest with: scade-version: ${{ matrix.scade-version }} - library-dir: "tests/python-pyproject" - pytest-postargs: "tests/python-pyproject/tests -vv" + library-dir: "tests/python-setup" + pytest-postargs: "tests/python-setup/tests -vv" checkout: false - - name: Execute setup.py tests + - name: Execute pyproject tests uses: ./scade-tests-pytest with: scade-version: ${{ matrix.scade-version }} - library-dir: "tests/python-setup" - pytest-postargs: "tests/python-setup/tests -vv" + library-dir: "tests/python-pyproject" + pytest-postargs: "tests/python-pyproject/tests -vv" checkout: false doc-deploy-dev: From 2dd4ee4bd4f7da64d1b454135515aa4053a98bbd Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 21 Feb 2024 10:55:42 +0100 Subject: [PATCH 08/38] fix: requirements from pyproject --- tests-pytest/action.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tests-pytest/action.yml b/tests-pytest/action.yml index 986bb51..31c508e 100644 --- a/tests-pytest/action.yml +++ b/tests-pytest/action.yml @@ -47,13 +47,6 @@ inputs: default: 'true' required: false - requirements-tests-file: - description: > - Flag to indicate if the requirements_tests.txt file exists. - default: 'false' - required: false - - runs: using: "composite" steps: @@ -96,13 +89,13 @@ runs: echo Install test dependencies from the requirements file %PYTHON_EXE% -m pip install -r ${{ inputs.library-dir }}/requirements/requirements_tests.txt ) - echo EXISTS_TESTS_REQUIREMENTS=%ERRORLEVEL%>> %GITHUB_ENV% + echo EXISTS_TESTS_REQUIREMENTS='true'>> %GITHUB_ENV% - name: "Install test dependencies from pyproject.toml" shell: cmd - if: env.EXISTS_TESTS_REQUIREMENTS == 'false' + if: env.EXISTS_TESTS_REQUIREMENTS != 'true' run: | - :: Add the requirements + :: Add the requirements from pyproject.toml %PYTHON_EXE% -m pip install ${{ inputs.library-dir }}[tests] - name: "Executing test suite" From 1cca9a66baf3ddccdbc39cbc25afb8e035f44bb1 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 21 Feb 2024 11:08:54 +0100 Subject: [PATCH 09/38] fix: vale warning --- doc/styles/Vocab/ANSYS/accept.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/styles/Vocab/ANSYS/accept.txt b/doc/styles/Vocab/ANSYS/accept.txt index d70bb4b..591c295 100644 --- a/doc/styles/Vocab/ANSYS/accept.txt +++ b/doc/styles/Vocab/ANSYS/accept.txt @@ -6,3 +6,5 @@ GitHub pytest PyPI TXT +(?!)scade +(?!)python From 21d7e2da82374cd2513b696bbc4fff57a3976a4c Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 21 Feb 2024 11:27:28 +0100 Subject: [PATCH 10/38] fix: test docs deploy --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 680a48e..05f5101 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -162,7 +162,7 @@ jobs: doc-deploy-dev: name: "Deploy developers documentation" runs-on: ubuntu-latest - if: github.event_name == 'push' && !contains(github.ref, 'refs/tags') + #if: github.event_name == 'push' && !contains(github.ref, 'refs/tags') needs: [doc-build, tests] steps: - uses: ansys/actions/doc-deploy-dev@v5 From 63cd0166e450fd34ba823cd2f706155d3fdbdbde Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 21 Feb 2024 11:35:07 +0100 Subject: [PATCH 11/38] fix: revert test docs deploy --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 05f5101..680a48e 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -162,7 +162,7 @@ jobs: doc-deploy-dev: name: "Deploy developers documentation" runs-on: ubuntu-latest - #if: github.event_name == 'push' && !contains(github.ref, 'refs/tags') + if: github.event_name == 'push' && !contains(github.ref, 'refs/tags') needs: [doc-build, tests] steps: - uses: ansys/actions/doc-deploy-dev@v5 From e45a486e06c3e97712320da0633c414f89f0d9bd Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 21 Feb 2024 12:02:37 +0100 Subject: [PATCH 12/38] docs:change readme target --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 2b28cbc..1497097 100644 --- a/README.rst +++ b/README.rst @@ -4,7 +4,7 @@ Ansys SCADE actions |ansys| |CI-CD| |MIT| .. |ansys| image:: https://img.shields.io/badge/Ansys-ffc107.svg?labelColor=black&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABDklEQVQ4jWNgoDfg5mD8vE7q/3bpVyskbW0sMRUwofHD7Dh5OBkZGBgW7/3W2tZpa2tLQEOyOzeEsfumlK2tbVpaGj4N6jIs1lpsDAwMJ278sveMY2BgCA0NFRISwqkhyQ1q/Nyd3zg4OBgYGNjZ2ePi4rB5loGBhZnhxTLJ/9ulv26Q4uVk1NXV/f///////69du4Zdg78lx//t0v+3S88rFISInD59GqIH2esIJ8G9O2/XVwhjzpw5EAam1xkkBJn/bJX+v1365hxxuCAfH9+3b9/+////48cPuNehNsS7cDEzMTAwMMzb+Q2u4dOnT2vWrMHu9ZtzxP9vl/69RVpCkBlZ3N7enoDXBwEAAA+YYitOilMVAAAAAElFTkSuQmCC - :target: https://actions.docs.ansys.com/ + :target: https://actions.scade.docs.pyansys.com/ :alt: Ansys .. |CI-CD| image:: https://github.com/ansys/scade-actions/actions/workflows/ci_cd.yml/badge.svg From 3949bd9765ca1b6085fe1df55c1ac9adf7b4f3ae Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 21 Feb 2024 12:06:14 +0100 Subject: [PATCH 13/38] fix: test docs deploy --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 680a48e..05f5101 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -162,7 +162,7 @@ jobs: doc-deploy-dev: name: "Deploy developers documentation" runs-on: ubuntu-latest - if: github.event_name == 'push' && !contains(github.ref, 'refs/tags') + #if: github.event_name == 'push' && !contains(github.ref, 'refs/tags') needs: [doc-build, tests] steps: - uses: ansys/actions/doc-deploy-dev@v5 From f2f64deda6f254be8fd0b8b53b94de0b6554d1e2 Mon Sep 17 00:00:00 2001 From: Revathy Venugopal <104772255+Revathyvenugopal162@users.noreply.github.com> Date: Wed, 21 Feb 2024 12:14:41 +0100 Subject: [PATCH 14/38] Update .github/workflows/ci_cd.yml --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 05f5101..680a48e 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -162,7 +162,7 @@ jobs: doc-deploy-dev: name: "Deploy developers documentation" runs-on: ubuntu-latest - #if: github.event_name == 'push' && !contains(github.ref, 'refs/tags') + if: github.event_name == 'push' && !contains(github.ref, 'refs/tags') needs: [doc-build, tests] steps: - uses: ansys/actions/doc-deploy-dev@v5 From c761529e50b33062d94213b56d009bba8045aa46 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 21 Feb 2024 12:16:36 +0100 Subject: [PATCH 15/38] fix: spacing --- .github/workflows/ci_cd.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 680a48e..e8345b2 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -143,7 +143,6 @@ jobs: steps: # - name: Checkout # uses: actions/checkout@v4 - # - name: Execute setup.py tests uses: ./scade-tests-pytest with: From 3b63725472d062631d3e5e6d2ea5e90b502d2e60 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 21 Feb 2024 13:59:34 +0100 Subject: [PATCH 16/38] fix: combine the requirement action --- tests-pytest/action.yml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/tests-pytest/action.yml b/tests-pytest/action.yml index 31c508e..a1348b6 100644 --- a/tests-pytest/action.yml +++ b/tests-pytest/action.yml @@ -84,19 +84,14 @@ runs: - name: "Check if requirements_tests.txt file exists" shell: cmd run: | - :: Add the requirements - if exist ${{ inputs.library-dir }}/requirements/requirements_tests.txt ( - echo Install test dependencies from the requirements file - %PYTHON_EXE% -m pip install -r ${{ inputs.library-dir }}/requirements/requirements_tests.txt + :: Check if requirements_tests.txt file exists + if exist {{ inputs.library-dir }}/requirements/requirements_tests.txt ( + echo Installing test dependencies from requirements_tests.txt + %PYTHON_EXE% -m pip install -r %GITHUB_WORKSPACE%\${{ inputs.library-dir }}/requirements/requirements_tests.txt + ) else ( + echo Installing test dependencies from pyproject.toml + %PYTHON_EXE% -m pip install ${{ inputs.library-dir }}[tests] ) - echo EXISTS_TESTS_REQUIREMENTS='true'>> %GITHUB_ENV% - - - name: "Install test dependencies from pyproject.toml" - shell: cmd - if: env.EXISTS_TESTS_REQUIREMENTS != 'true' - run: | - :: Add the requirements from pyproject.toml - %PYTHON_EXE% -m pip install ${{ inputs.library-dir }}[tests] - name: "Executing test suite" shell: cmd From 52649c18177a7db31e805f8652fd6095521b1216 Mon Sep 17 00:00:00 2001 From: Jorge Martinez Date: Thu, 22 Feb 2024 08:06:01 +0100 Subject: [PATCH 17/38] doc: improve action description --- get-scade-python/action.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/get-scade-python/action.yml b/get-scade-python/action.yml index 7e19de6..9c1f623 100644 --- a/get-scade-python/action.yml +++ b/get-scade-python/action.yml @@ -8,9 +8,8 @@ description: > inputs: scade-dir: description: > - Ansys SCADE Installation directory, e.g.:: - - C:\Program Files\Ansys Inc\v231\SCADE + Ansys SCADE Installation directory, for instance + ``C:\Program Files\Ansys Inc\v231\SCADE`` required: true outputs: From 7bbd57ee3ac7493eb53697611e386703e5673087 Mon Sep 17 00:00:00 2001 From: Jorge Martinez Date: Thu, 22 Feb 2024 08:07:07 +0100 Subject: [PATCH 18/38] ci: fix link for labels --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index e8345b2..472b91b 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -72,7 +72,7 @@ jobs: issue-number: ${{ github.event.pull_request.number }} body: | Please add one of the following labels to add this contribution to the Release Notes :point_down: - - [bug](https://github.com/ansys/actions/pulls?q=label%3Abug+) + - [bug](https://github.com/ansys/scade-actions/pulls?q=label%3Abug+) - [documentation](https://github.com/ansys/scade-actions/pulls?q=label%3Adocumentation+) - [enhancement](https://github.com/ansys/scade-actions/pulls?q=label%3Aenhancement+) - [good first issue](https://github.com/ansys/scade-actions/pulls?q=label%3Agood+first+issue) From 0215c763e361e2d5278eb7660525c0c9ae2c55f7 Mon Sep 17 00:00:00 2001 From: Jorge Martinez Date: Thu, 22 Feb 2024 08:15:38 +0100 Subject: [PATCH 19/38] ci: add release step --- .github/workflows/ci_cd.yml | 70 ++++++++++++++++++++++++++++++++----- 1 file changed, 61 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 472b91b..a564ed4 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -84,12 +84,13 @@ jobs: runs-on: ubuntu-latest needs: labeler steps: - - - uses: ansys/actions/commit-style@main + - name: "Check commit style" + uses: ansys/actions/commit-style@v5 with: token: ${{ secrets.GITHUB_TOKEN }} - - uses: ansys/actions/branch-name-style@main + - name: "Check branch naming convention" + uses: ansys/actions/branch-name-style@v5 code-style: name: "Code style" @@ -137,20 +138,17 @@ jobs: runs-on: [self-hosted, 'SCADE'] strategy: matrix: - # scade-version: ['23.1', '23.2'] scade-version: ['23.2'] fail-fast: false steps: - # - name: Checkout - # uses: actions/checkout@v4 - - name: Execute setup.py tests + - name: "Execute setup.py tests" uses: ./scade-tests-pytest with: scade-version: ${{ matrix.scade-version }} library-dir: "tests/python-setup" pytest-postargs: "tests/python-setup/tests -vv" checkout: false - - name: Execute pyproject tests + - name: "Execute pyproject tests" uses: ./scade-tests-pytest with: scade-version: ${{ matrix.scade-version }} @@ -160,11 +158,65 @@ jobs: doc-deploy-dev: name: "Deploy developers documentation" + needs: [doc-build, tests] runs-on: ubuntu-latest if: github.event_name == 'push' && !contains(github.ref, 'refs/tags') - needs: [doc-build, tests] steps: - uses: ansys/actions/doc-deploy-dev@v5 with: cname: ${{ env.DOCUMENTATION_CNAME }} token: ${{ secrets.GITHUB_TOKEN }} + + release: + name: "Release to GitHub" + runs-on: ubuntu-latest + if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + needs: [doc-build, tests] + steps: + + - name: "Download HTML documentation" + uses: actions/download-artifact@v4 + with: + name: documentation-html + path: documentation-html + + - name: "Zip HTML documentation" + uses: vimtor/action-zip@v1.2 + with: + files: documentation-html + dest: documentation-html.zip + + - name: "Download PDF documentation" + uses: actions/download-artifact@v4 + with: + name: documentation-pdf + path: documentation-pdf + + - name: "Zip PDF documentation" + uses: vimtor/action-zip@v1.2 + with: + files: documentation-pdf + dest: documentation-pdf.zip + + - name: "Display the structure of downloaded files" + shell: bash + run: ls -R + + - name: "Release to GitHub" + uses: softprops/action-gh-release@v1 + with: + generate_release_notes: true + files: | + documentation-html.zip + documentation-pdf.zip + + doc-deploy-stable: + name: "Upload stable documentation" + if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + runs-on: ubuntu-latest + needs: release + steps: + - uses: ansys/actions/doc-deploy-stable@v5 + with: + cname: ${{ env.DOCUMENTATION_CNAME }} + token: ${{ secrets.GITHUB_TOKEN }} From 61c60610c44b0eecb0948927a416e7c51c4a474c Mon Sep 17 00:00:00 2001 From: Jorge Martinez Date: Thu, 22 Feb 2024 08:20:31 +0100 Subject: [PATCH 20/38] fix: actions indentation --- .pre-commit-config.yaml | 2 +- create-scade-venv/action.yml | 32 ++++++++++++------------- get-scade-dir/action.yml | 26 ++++++++++----------- get-scade-python/action.yml | 44 +++++++++++++++++------------------ scade-tests-pytest/action.yml | 2 +- tests-pytest/action.yml | 40 +++++++++++++++---------------- 6 files changed, 73 insertions(+), 73 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 80efe46..e28ace4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,4 +30,4 @@ repos: - repo: https://github.com/python-jsonschema/check-jsonschema rev: 0.28.0 hooks: - - id: check-github-workflows \ No newline at end of file + - id: check-github-workflows diff --git a/create-scade-venv/action.yml b/create-scade-venv/action.yml index f39a182..6ec3ce3 100644 --- a/create-scade-venv/action.yml +++ b/create-scade-venv/action.yml @@ -28,24 +28,24 @@ runs: - name: Pass Inputs to Shell shell: cmd run: | - :: Pass inputs to the shell - echo INPUT_PYTHON_DIR=${{ inputs.python-dir }}>> %GITHUB_ENV% - echo INPUT_TARGET_DIR=${{ inputs.target-dir }}>> %GITHUB_ENV% - echo INPUT_TARGET_NAME=${{ inputs.target-name}}>> %GITHUB_ENV% + :: Pass inputs to the shell + echo INPUT_PYTHON_DIR=${{ inputs.python-dir }}>> %GITHUB_ENV% + echo INPUT_TARGET_DIR=${{ inputs.target-dir }}>> %GITHUB_ENV% + echo INPUT_TARGET_NAME=${{ inputs.target-name}}>> %GITHUB_ENV% - name: Create environment id: venv shell: cmd run: | - :: Create virtual environment - set VENV=%INPUT_TARGET_DIR%\%INPUT_TARGET_NAME% - if not exist "%VENV%" ( - echo Create virtual environment "%VENV%" - "%INPUT_PYTHON_DIR%\python.exe" -m venv "%VENV%" - ) else ( - echo Skip existing virtual environment "%VENV%" - ) - rem add the environment to the path - set PATH=%VENV%\Scripts;%PATH% - python --version - echo scripts-dir=%VENV%\Scripts>> %GITHUB_OUTPUT% + :: Create virtual environment + set VENV=%INPUT_TARGET_DIR%\%INPUT_TARGET_NAME% + if not exist "%VENV%" ( + echo Create virtual environment "%VENV%" + "%INPUT_PYTHON_DIR%\python.exe" -m venv "%VENV%" + ) else ( + echo Skip existing virtual environment "%VENV%" + ) + rem add the environment to the path + set PATH=%VENV%\Scripts;%PATH% + python --version + echo scripts-dir=%VENV%\Scripts>> %GITHUB_OUTPUT% diff --git a/get-scade-dir/action.yml b/get-scade-dir/action.yml index ea44f62..9bf6f92 100644 --- a/get-scade-dir/action.yml +++ b/get-scade-dir/action.yml @@ -19,21 +19,21 @@ runs: - name: Pass Inputs to Shell shell: cmd run: | - :: Pass Inputs to Shell - echo INPUT_SCADE_VERSION=${{ inputs.scade-version }}>> %GITHUB_ENV% + :: Pass Inputs to Shell + echo INPUT_SCADE_VERSION=${{ inputs.scade-version }}>> %GITHUB_ENV% - name: Find SCADE_DIR id: find-scade-dir shell: cmd run: | - :: Find SCADE_DIR - echo Searching for Ansys SCADE "%INPUT_SCADE_VERSION%" - if "%INPUT_SCADE_VERSION%" lss "21.2" (set SCADE_COMPANY=Esterel Technologies) else (set SCADE_COMPANY=Ansys Inc) - echo SCADE registry company is "%SCADE_COMPANY%" - for /f "usebackq skip=2 tokens=2,*" %%A in (`REG QUERY "HKLM\SOFTWARE\%SCADE_COMPANY%\SCADE\%INPUT_SCADE_VERSION%" /v InstallDir 2^>nul`) do (set SCADE_DIR=%%B) - if "%SCADE_DIR%" == "" ( - echo Ansys SCADE "%INPUT_SCADE_VERSION%" not available - exit /b 1 - ) - echo Ansys SCADE %INPUT_SCADE_VERSION% found in "%SCADE_DIR%" - echo scade-dir=%SCADE_DIR%>> %GITHUB_OUTPUT% + :: Find SCADE_DIR + echo Searching for Ansys SCADE "%INPUT_SCADE_VERSION%" + if "%INPUT_SCADE_VERSION%" lss "21.2" (set SCADE_COMPANY=Esterel Technologies) else (set SCADE_COMPANY=Ansys Inc) + echo SCADE registry company is "%SCADE_COMPANY%" + for /f "usebackq skip=2 tokens=2,*" %%A in (`REG QUERY "HKLM\SOFTWARE\%SCADE_COMPANY%\SCADE\%INPUT_SCADE_VERSION%" /v InstallDir 2^>nul`) do (set SCADE_DIR=%%B) + if "%SCADE_DIR%" == "" ( + echo Ansys SCADE "%INPUT_SCADE_VERSION%" not available + exit /b 1 + ) + echo Ansys SCADE %INPUT_SCADE_VERSION% found in "%SCADE_DIR%" + echo scade-dir=%SCADE_DIR%>> %GITHUB_OUTPUT% diff --git a/get-scade-python/action.yml b/get-scade-python/action.yml index 9c1f623..0522c9a 100644 --- a/get-scade-python/action.yml +++ b/get-scade-python/action.yml @@ -33,30 +33,30 @@ runs: id: set shell: cmd run: | - :: Pass Inputs to Shell - echo INPUT_SCADE_DIR=${{ inputs.scade-dir }}>> %GITHUB_ENV% + :: Pass Inputs to Shell + echo INPUT_SCADE_DIR=${{ inputs.scade-dir }}>> %GITHUB_ENV% - name: Retrieve Python name/directory/version id: get shell: cmd run: | - :: Retrieve Python name/directory - setlocal ENABLEDELAYEDEXPANSION - echo Get Python interpreter for "%INPUT_SCADE_DIR%" - set PYTHON_VERSION=0 - for /f "usebackq" %%A in (`dir /B "%INPUT_SCADE_DIR%\contrib\Python*"`) do ( - set CURRENT_VERSION=%%A - set CURRENT_VERSION=!CURRENT_VERSION:Python=%! - if !CURRENT_VERSION! GTR !PYTHON_VERSION! ( - set PYTHON_VERSION=!CURRENT_VERSION! - ) - ) - set PYTHON_NAME=Python%PYTHON_VERSION% - echo Python name="%PYTHON_NAME%" - echo python-name=%PYTHON_NAME%>> %GITHUB_OUTPUT% - set PYTHON_DIR=%INPUT_SCADE_DIR%\contrib\%PYTHON_NAME% - echo Python directory="%PYTHON_DIR%" - echo python-dir=%PYTHON_DIR%>> %GITHUB_OUTPUT% - for /f "usebackq tokens=2,3 delims=. " %%A in (`"%PYTHON_DIR%\python" --version`) do (set PYTHON_VERSION=%%A.%%B) - echo Python version="%PYTHON_VERSION%" - echo python-version=%PYTHON_VERSION%>> %GITHUB_OUTPUT% + :: Retrieve Python name/directory + setlocal ENABLEDELAYEDEXPANSION + echo Get Python interpreter for "%INPUT_SCADE_DIR%" + set PYTHON_VERSION=0 + for /f "usebackq" %%A in (`dir /B "%INPUT_SCADE_DIR%\contrib\Python*"`) do ( + set CURRENT_VERSION=%%A + set CURRENT_VERSION=!CURRENT_VERSION:Python=%! + if !CURRENT_VERSION! GTR !PYTHON_VERSION! ( + set PYTHON_VERSION=!CURRENT_VERSION! + ) + ) + set PYTHON_NAME=Python%PYTHON_VERSION% + echo Python name="%PYTHON_NAME%" + echo python-name=%PYTHON_NAME%>> %GITHUB_OUTPUT% + set PYTHON_DIR=%INPUT_SCADE_DIR%\contrib\%PYTHON_NAME% + echo Python directory="%PYTHON_DIR%" + echo python-dir=%PYTHON_DIR%>> %GITHUB_OUTPUT% + for /f "usebackq tokens=2,3 delims=. " %%A in (`"%PYTHON_DIR%\python" --version`) do (set PYTHON_VERSION=%%A.%%B) + echo Python version="%PYTHON_VERSION%" + echo python-version=%PYTHON_VERSION%>> %GITHUB_OUTPUT% diff --git a/scade-tests-pytest/action.yml b/scade-tests-pytest/action.yml index db6d697..7d80f47 100644 --- a/scade-tests-pytest/action.yml +++ b/scade-tests-pytest/action.yml @@ -56,7 +56,7 @@ runs: uses: ./get-scade-dir id: get-scade-dir with: - scade-version: ${{ inputs.scade-version }} + scade-version: ${{ inputs.scade-version }} - name: "Retrieve SCADE Python interpreter" uses: ./get-scade-python diff --git a/tests-pytest/action.yml b/tests-pytest/action.yml index a1348b6..b76b4cc 100644 --- a/tests-pytest/action.yml +++ b/tests-pytest/action.yml @@ -58,43 +58,43 @@ runs: - name: Pass Inputs to Shell shell: cmd run: | - :: Pass inputs to the shell - echo INPUT_PYTHON_DIR=${{ inputs.python-dir }}>> %GITHUB_ENV% + :: Pass inputs to the shell + echo INPUT_PYTHON_DIR=${{ inputs.python-dir }}>> %GITHUB_ENV% - name: Check python shell: cmd run: | - :: Check python - echo Activate the environment %INPUT_PYTHON_DIR% - call %INPUT_PYTHON_DIR%\activate.bat - python.exe --version - :: store the "exe for the next steps" - echo PYTHON_EXE=%INPUT_PYTHON_DIR%\python.exe>> %GITHUB_ENV% + :: Check python + echo Activate the environment %INPUT_PYTHON_DIR% + call %INPUT_PYTHON_DIR%\activate.bat + python.exe --version + :: store the "exe for the next steps" + echo PYTHON_EXE=%INPUT_PYTHON_DIR%\python.exe>> %GITHUB_ENV% - name: "Update pip" shell: cmd run: | - %PYTHON_EXE% -m pip install -U pip + %PYTHON_EXE% -m pip install -U pip - name: "Install Python library" shell: cmd run: | - %PYTHON_EXE% -m pip install ${{ inputs.library-dir }} + %PYTHON_EXE% -m pip install ${{ inputs.library-dir }} - name: "Check if requirements_tests.txt file exists" shell: cmd run: | - :: Check if requirements_tests.txt file exists - if exist {{ inputs.library-dir }}/requirements/requirements_tests.txt ( - echo Installing test dependencies from requirements_tests.txt - %PYTHON_EXE% -m pip install -r %GITHUB_WORKSPACE%\${{ inputs.library-dir }}/requirements/requirements_tests.txt - ) else ( - echo Installing test dependencies from pyproject.toml - %PYTHON_EXE% -m pip install ${{ inputs.library-dir }}[tests] - ) + :: Check if requirements_tests.txt file exists + if exist {{ inputs.library-dir }}/requirements/requirements_tests.txt ( + echo Installing test dependencies from requirements_tests.txt + %PYTHON_EXE% -m pip install -r %GITHUB_WORKSPACE%\${{ inputs.library-dir }}/requirements/requirements_tests.txt + ) else ( + echo Installing test dependencies from pyproject.toml + %PYTHON_EXE% -m pip install ${{ inputs.library-dir }}[tests] + ) - name: "Executing test suite" shell: cmd run: | - :: Run tests - %PYTHON_EXE% -m pytest ${{ inputs.pytest-markers }} ${{ inputs.pytest-extra-args }} ${{ inputs.pytest-postargs }} + :: Run tests + %PYTHON_EXE% -m pytest ${{ inputs.pytest-markers }} ${{ inputs.pytest-extra-args }} ${{ inputs.pytest-postargs }} From bec8b7430d773b13eb33d02adb1d220648142e1b Mon Sep 17 00:00:00 2001 From: Jorge Martinez Date: Thu, 22 Feb 2024 08:23:37 +0100 Subject: [PATCH 21/38] fix: warnings as errors for sphinx build --- doc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Makefile b/doc/Makefile index 1d2170d..dd02e17 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -3,7 +3,7 @@ # You can set these variables from the command line. You can also # set the first two from the environment. -SPHINXOPTS ?= +SPHINXOPTS ?= -j auto -W SPHINXBUILD ?= sphinx-build SOURCEDIR = source BUILDDIR = _build From 080ffd45360adc8b400f3080fd8da3141cf5ad00 Mon Sep 17 00:00:00 2001 From: Jorge Martinez Date: Thu, 22 Feb 2024 08:25:34 +0100 Subject: [PATCH 22/38] maint: include dependabot.yml --- .github/dependabot.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..b640fb0 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,20 @@ +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/requirements" + schedule: + interval: "daily" + commit-message: + prefix: "build" + labels: + - "maintenance" + - "dependencies" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + commit-message: + prefix: "build" + labels: + - "maintenance" From 9a0bb22da6d941d0c6a9c33f2fa054a5a05d9ea6 Mon Sep 17 00:00:00 2001 From: Jorge Martinez Date: Thu, 22 Feb 2024 08:26:48 +0100 Subject: [PATCH 23/38] ci: add release.yml workflow --- .github/workflows/release.yml | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..111c460 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,55 @@ +name: Rolling release +on: + push: + tags: + - "v*.*.*" + +permissions: write-all + +jobs: + automate-tagging: + name: "Perform rolling release" + runs-on: ubuntu-latest + steps: + - name: "Checkout repository" + uses: actions/checkout@v4 + + - name: "Configure git" + run: | + git config user.name github-actions + git config user.email github-actions@github.com + + - name: "Decompose tag into components" + run: | + if [[ ${{ github.ref_name }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + # Split the tag into its components + IFS='.' read -ra PARTS <<< "${{ github.ref_name }}" + echo "X=${PARTS[0]}" >> $GITHUB_ENV + echo "Y=${PARTS[1]}" >> $GITHUB_ENV + echo "Z=${PARTS[2]}" >> $GITHUB_ENV + else + echo "Invalid tag format. Expected vX.Y.Z but got ${{ github.ref_name }}" + exit 1 + fi + + - name: "Verify tag was created in the proper release branch" + run: | + # Remove leading "v" from env.X + X_NO_V="${X:1}" + # Check if the tag was created in the proper branch + if [[ ${{ github.event.base_ref }} != "refs/heads/release/${X_NO_V}.${{ env.Y }}" ]]; then + echo "Tag ${{ github.ref_name }} was created in the wrong branch. Expected branch name release/${X_NO_V}.${{ env.Y }}" + exit 1 + fi + + - name: "Remove old tags" + run: | + git push --delete origin ${{ env.X }} + git push --delete origin ${{ env.X }}.${{ env.Y }} + + - name: "Create new tags" + run: | + git tag ${{ env.X }}.${{ env.Y }} + git tag ${{ env.X }} + git push origin ${{ env.X }}.${{ env.Y }} + git push origin ${{ env.X }} From 34d2bb40148842e0bacd7699f0116a5ae90d7cf6 Mon Sep 17 00:00:00 2001 From: Jorge Martinez Date: Thu, 22 Feb 2024 08:30:52 +0100 Subject: [PATCH 24/38] ci: add CODEOWNERS file --- .github/CODEOWNERS | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..238869b --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,4 @@ +# These owners will be the default owners for everything in the repo. Unless a +# later match takes precedence, the PyAnsys Core team will be requested for +# review when someone opens a pull request. +* @ansys/scade-experts From 27431371049a82959fef7e39b02d922e6786b2f4 Mon Sep 17 00:00:00 2001 From: Jorge Martinez Date: Thu, 22 Feb 2024 08:36:24 +0100 Subject: [PATCH 25/38] doc: fix link --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 1497097..e06e4ad 100644 --- a/README.rst +++ b/README.rst @@ -12,7 +12,7 @@ Ansys SCADE actions :alt: CI-CD .. |MIT| image:: https://img.shields.io/badge/License-MIT-blue.svg - :target: https://opensource.org/licenses/MIT + :target: https://opensource.org/blog/license/mit :alt: MIT A repository containing a collection of `GitHub Actions From e37f4acde17b0935430cc44ed43bbac4ded79bd2 Mon Sep 17 00:00:00 2001 From: Jorge Martinez Date: Thu, 22 Feb 2024 08:40:59 +0100 Subject: [PATCH 26/38] fix: code style --- get-scade-python/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/get-scade-python/action.yml b/get-scade-python/action.yml index 0522c9a..314fc4c 100644 --- a/get-scade-python/action.yml +++ b/get-scade-python/action.yml @@ -8,7 +8,7 @@ description: > inputs: scade-dir: description: > - Ansys SCADE Installation directory, for instance + Ansys SCADE Installation directory, for instance ``C:\Program Files\Ansys Inc\v231\SCADE`` required: true From 511a8dd8af8e6fc3121d1c6b2af96abe28e83b21 Mon Sep 17 00:00:00 2001 From: Jorge Martinez Date: Thu, 22 Feb 2024 08:48:14 +0100 Subject: [PATCH 27/38] doc: remove badges from index.rst in docs --- README.rst | 3 ++- doc/source/index.rst | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index e06e4ad..f850c1c 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,3 @@ -.. readme_common_begins Ansys SCADE actions =================== |ansys| |CI-CD| |MIT| @@ -15,6 +14,8 @@ Ansys SCADE actions :target: https://opensource.org/blog/license/mit :alt: MIT +.. readme_common_begins + A repository containing a collection of `GitHub Actions `_ to be reused by projects in the Ansys SCADE ecosystem. diff --git a/doc/source/index.rst b/doc/source/index.rst index 286485d..5aab9ef 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1,3 +1,6 @@ +Ansys SCADE actions +################### + .. include:: ../../README.rst :start-after: .. readme_common_begins :end-before: .. readme_common_ends From c4c894eeb395a00b4e366e9c58549ab0367cc4c4 Mon Sep 17 00:00:00 2001 From: Jorge Martinez Date: Thu, 22 Feb 2024 08:59:43 +0100 Subject: [PATCH 28/38] maint: update requirements/ --- requirements/requirements_doc.txt | 2 +- requirements/requirements_tests.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements/requirements_doc.txt b/requirements/requirements_doc.txt index 0a3d756..596f570 100644 --- a/requirements/requirements_doc.txt +++ b/requirements/requirements_doc.txt @@ -1,6 +1,6 @@ ansys-sphinx-theme==0.13.4 pyyaml==6.0.1 -Sphinx==7.1.1 +Sphinx==7.2.6 sphinx-copybutton==0.5.2 sphinx-jinja==2.0.2 sphinx_design==0.5.0 diff --git a/requirements/requirements_tests.txt b/requirements/requirements_tests.txt index 71b21e3..6f59f1f 100644 --- a/requirements/requirements_tests.txt +++ b/requirements/requirements_tests.txt @@ -1,2 +1,2 @@ -pytest==7.1.2 -pytest-cov==3.0.0 +pytest==8.0.1 +pytest-cov==4.1.0 From 2d9f09985e32a01f0b517ae9e752b60f9edbcee2 Mon Sep 17 00:00:00 2001 From: Jorge Martinez Date: Thu, 22 Feb 2024 09:12:16 +0100 Subject: [PATCH 29/38] doc: add font-awesome from cdnjs --- doc/source/conf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/source/conf.py b/doc/source/conf.py index 4916432..3b8da35 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -83,6 +83,9 @@ # Specify the static path html_static_path = ["_static"] +html_css_files = [ + "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" +] # Add any paths that contain templates, relative to this directory templates_path = ["_templates"] From ec1bd22cbd9bbf706d1a26ed750e42429d2af57c Mon Sep 17 00:00:00 2001 From: Jorge Martinez Date: Thu, 22 Feb 2024 09:32:58 +0100 Subject: [PATCH 30/38] fix: header underline --- doc/source/query-actions/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/query-actions/index.rst b/doc/source/query-actions/index.rst index 43d2de2..11a59be 100644 --- a/doc/source/query-actions/index.rst +++ b/doc/source/query-actions/index.rst @@ -1,5 +1,5 @@ Query actions -=================== +============= The query actions allow for querying Ansys SCADE installations and Python environments. From 7b1b3534a15a94cc7083d0b5b69cac349080d6a3 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Thu, 22 Feb 2024 10:25:35 +0100 Subject: [PATCH 31/38] fix: update the sd icon --- doc/source/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/source/conf.py b/doc/source/conf.py index 3b8da35..6e09bd7 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -103,6 +103,7 @@ r"https://github.com/ansys/scade-actions*", ] +sd_fontawesome_latex = True # Auxiliary routines for automatic documentation generation From 56146d102a07b8a40bcf85b123f80f2616ad51b1 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Thu, 22 Feb 2024 10:53:54 +0100 Subject: [PATCH 32/38] fix: update the fw icon dependencies --- .github/workflows/ci_cd.yml | 1 + doc/Makefile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index a564ed4..fdcfee3 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -132,6 +132,7 @@ jobs: skip-install: true python-version: ${{ env.MAIN_PYTHON_VERSION }} use-python-cache: false + dependencies: "texlive-fonts-extra qpdf" tests: name: "Tests" diff --git a/doc/Makefile b/doc/Makefile index dd02e17..7dc3341 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -27,4 +27,4 @@ clean: pdf: @$(SPHINXBUILD) -M latex "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) cd $(BUILDDIR)/latex && latexmk -r latexmkrc -pdf *.tex -interaction=nonstopmode || true - (test -f $(BUILDDIR)/latex/*.pdf && echo pdf exists) || exit 1 + qpdf --check $(BUILDDIR)/latex/ansysscade-*.pdf && echo "File is OK" && exit 0 || echo "File is corrupt" && exit 1 From 9f830a8773557b4c3db7fcde6b68d6d2bf95e9af Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Thu, 22 Feb 2024 11:00:59 +0100 Subject: [PATCH 33/38] fix: update the makfile --- doc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Makefile b/doc/Makefile index 7dc3341..aefaff2 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -27,4 +27,4 @@ clean: pdf: @$(SPHINXBUILD) -M latex "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) cd $(BUILDDIR)/latex && latexmk -r latexmkrc -pdf *.tex -interaction=nonstopmode || true - qpdf --check $(BUILDDIR)/latex/ansysscade-*.pdf && echo "File is OK" && exit 0 || echo "File is corrupt" && exit 1 + qpdf --check $(BUILDDIR)/latex/ansysscadeactions.pdf && echo "File is OK" && exit 0 || echo "File is corrupt" && exit 1 From f75169e8ddfcf49258c05c5c4bd70ad7588ee751 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Tue, 27 Feb 2024 09:35:16 +0100 Subject: [PATCH 34/38] fix: remove unwanted function --- doc/source/conf.py | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 6e09bd7..e2e5c33 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -99,6 +99,7 @@ # Generate section labels for up to four levels autosectionlabel_maxdepth = 2 +# TODO: remove this when library is public linkcheck_ignore = [ r"https://github.com/ansys/scade-actions*", ] @@ -348,26 +349,3 @@ def get_example_file_title(example_file): jinja_contexts[action_name]["examples"] = [ [file.name, get_example_file_title(file)] for file in examples ] - - -# Dynamically load the file contents for accepted licenses and ignored packages -def load_file_lines_as_list(file_path): - """Loads the lines of a file in the form of a Python list. - - Parameters - ---------- - file_path : ~pathlib.Path - The ``Path`` instance representing the file location. - - Returns - ------- - list[str] - A list of strings representing the lines of the file. - - Notes - ----- - This function is expected to be used for loading the contents of TXT files. - - """ - with open(file_path) as accepted_licenses_file: - return list(accepted_licenses_file.read().split("\n")) From 3960c876aa2f42ca1d83de6913dbae9758694cf5 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Tue, 27 Feb 2024 10:28:48 +0100 Subject: [PATCH 35/38] fix: remove and dd required spaces and indentation in actions --- get-scade-dir/action.yml | 16 ++++++++++++---- get-scade-python/action.yml | 20 +++++++++++++------- requirements/requirements_doc.txt | 2 +- tests-pytest/action.yml | 4 ++-- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/get-scade-dir/action.yml b/get-scade-dir/action.yml index 9bf6f92..587f3e1 100644 --- a/get-scade-dir/action.yml +++ b/get-scade-dir/action.yml @@ -1,28 +1,36 @@ # get-scade-dir.yml name: 'Retrieve the installation directory of an Ansys SCADE version' + description: > A GitHub action that takes as input an Ansys SCADE version and returns its installation directory. + inputs: + scade-version: - description: 'SCADE version: 19.2, 20.1, ..., 23.1, ...' + description: > + SCADE version: ``19.2, 20.1, ..., 23.1, ...``. required: true + outputs: + scade-directory: - description: 'Installation directory of the requested version' + description: > + Installation directory of the requested version. value: ${{ steps.find-scade-dir.outputs.scade-dir }} author: 'ESEG' runs: using: composite steps: - - name: Pass Inputs to Shell + + - name: "Pass Inputs to Shell" shell: cmd run: | :: Pass Inputs to Shell echo INPUT_SCADE_VERSION=${{ inputs.scade-version }}>> %GITHUB_ENV% - - name: Find SCADE_DIR + - name: "Find SCADE_DIR" id: find-scade-dir shell: cmd run: | diff --git a/get-scade-python/action.yml b/get-scade-python/action.yml index 314fc4c..662234f 100644 --- a/get-scade-python/action.yml +++ b/get-scade-python/action.yml @@ -6,37 +6,43 @@ description: > and returns the name and path to the corresponding Python installation. inputs: + scade-dir: description: > - Ansys SCADE Installation directory, for instance - ``C:\Program Files\Ansys Inc\v231\SCADE`` + Ansys SCADE Installation directory. for instance + ``'C:\Program Files\Ansys Inc\v231\SCADE'``. required: true outputs: + python-name: - description: Name of the directory containing python.exe + description: > + Name of the directory containing python.exe. value: ${{ steps.get.outputs.python-name }} python-dir: - description: Directory containing python.exe + description: > + Directory containing python.exe. value: ${{ steps.get.outputs.python-dir }} python-version: - description: Version of python.exe, two digits + description: > + Version of python.exe, two digits. value: ${{ steps.get.outputs.python-version }} author: 'ESEG' runs: using: composite steps: - - name: Pass Inputs to Shell + + - name: "Pass Inputs to Shell" id: set shell: cmd run: | :: Pass Inputs to Shell echo INPUT_SCADE_DIR=${{ inputs.scade-dir }}>> %GITHUB_ENV% - - name: Retrieve Python name/directory/version + - name: "Retrieve Python name/directory/version" id: get shell: cmd run: | diff --git a/requirements/requirements_doc.txt b/requirements/requirements_doc.txt index 596f570..314f61b 100644 --- a/requirements/requirements_doc.txt +++ b/requirements/requirements_doc.txt @@ -1,4 +1,4 @@ -ansys-sphinx-theme==0.13.4 +ansys-sphinx-theme==0.14.0 pyyaml==6.0.1 Sphinx==7.2.6 sphinx-copybutton==0.5.2 diff --git a/tests-pytest/action.yml b/tests-pytest/action.yml index b76b4cc..57d8979 100644 --- a/tests-pytest/action.yml +++ b/tests-pytest/action.yml @@ -55,13 +55,13 @@ runs: uses: actions/checkout@v4 if: ${{ inputs.checkout == 'true' }} - - name: Pass Inputs to Shell + - name: "Pass Inputs to Shell" shell: cmd run: | :: Pass inputs to the shell echo INPUT_PYTHON_DIR=${{ inputs.python-dir }}>> %GITHUB_ENV% - - name: Check python + - name: "Check python" shell: cmd run: | :: Check python From f43fcbdcee4be7fb0f7f72425489e150187cc6fc Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Tue, 27 Feb 2024 11:09:08 +0100 Subject: [PATCH 36/38] fix: updat gitignore and licence --- .gitignore | 45 +++++++++++++++++++++++++++++++++++++++------ LICENSE | 2 +- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index f02ad18..bf706df 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +# Created by https://www.toptal.com/developers/gitignore/api/python +# Edit at https://www.toptal.com/developers/gitignore?templates=python + +### Python ### # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] @@ -41,6 +45,7 @@ pip-delete-this-directory.txt htmlcov/ .tox/ .nox/ +.cov .coverage .coverage.* .cache @@ -50,6 +55,7 @@ coverage.xml *.py,cover .hypothesis/ .pytest_cache/ +cover/ # Translations *.mo @@ -69,9 +75,10 @@ instance/ .scrapy # Sphinx documentation -docs/_build/ +doc/_build/ # PyBuilder +.pybuilder/ target/ # Jupyter Notebook @@ -82,15 +89,24 @@ profile_default/ ipython_config.py # pyenv -.python-version +# For a library or package, you might want to ignore these files because the code is +# intended to run in multiple environments. Otherwise, check them in: +# .python-version # pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# According to pypa/pipenv#598, you should include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock +# poetry +# Similar to the Pipfile.lock recommendation, you should generally include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility. This +# recommendation is commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + # PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ @@ -127,8 +143,25 @@ dmypy.json # Pyre type checker .pyre/ -doc/_build/ -*-rendered-example.yml -# vscode +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into the gitignore. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +.idea/ + +# Visual Studio +.vs/ .vscode/ + +# End of https://www.toptal.com/developers/gitignore/api/python + +# Ignore rendered examples +*-rendered-example.yml \ No newline at end of file diff --git a/LICENSE b/LICENSE index c4968b8..1327840 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Ansys SCADE +Copyright (c) 2024 ANSYS, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From adad4a9ebb84b0b27b307206026c6773d8a2915c Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Tue, 27 Feb 2024 11:22:09 +0100 Subject: [PATCH 37/38] fix: update the dependencies --- .github/labeler.yml | 6 ++++++ .github/labels.yml | 4 ++++ doc/make.bat | 9 +++++---- doc/source/conf.py | 6 ------ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index e5b01e6..9b7a2f3 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,2 +1,8 @@ maintenance: - any-glob-to-any-file: ['.github/**/*', '.pre-commit-config.yaml', 'VERSION'] +testing: +- any-glob-to-any-file: ['tests/**/*'] +documentation: +- any-glob-to-any-file: ['doc/**/*'] +dependencies: +- any-glob-to-any-file: ['requirements/**/*'] diff --git a/.github/labels.yml b/.github/labels.yml index cbc13d2..92971ef 100644 --- a/.github/labels.yml +++ b/.github/labels.yml @@ -29,3 +29,7 @@ - name: release description: Anything related to an incoming release color: ffffff + +- name: testing + description: Anything related to tests + color: BFE4D6 \ No newline at end of file diff --git a/doc/make.bat b/doc/make.bat index 6039c18..21eec62 100644 --- a/doc/make.bat +++ b/doc/make.bat @@ -40,10 +40,11 @@ goto end %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% :pdf - %SPHINXBUILD% -M latex %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% - cd "%BUILDDIR%\latex" - for %%f in (*.tex) do ( - pdflatex "%%f" --interaction=nonstopmode) +%SPHINXBUILD% -M latex %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +cd "%BUILDDIR%\latex" +for %%f in (*.tex) do ( +pdflatex "%%f" --interaction=nonstopmode) +goto end :end popd diff --git a/doc/source/conf.py b/doc/source/conf.py index e2e5c33..c314cb4 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -62,12 +62,6 @@ "json_url": f"https://{cname}/versions.json", "version_match": get_version_match(__version__), }, - "use_meilisearch": { - "api_key": os.getenv("MEILISEARCH_PUBLIC_API_KEY", ""), - "index_uids": { - f"actions-v{get_version_match(__version__).replace('.', '-')}": "Ansys-scade-actions", - }, - }, "check_switcher": False, } From a3dc8bfe590142ef41af2e3aae57cec25433597f Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Tue, 27 Feb 2024 16:45:18 +0100 Subject: [PATCH 38/38] fix: add licence headers --- .pre-commit-config.yaml | 9 +++++++++ create-scade-venv/action.yml | 22 ++++++++++++++++++++++ get-scade-dir/action.yml | 22 ++++++++++++++++++++++ get-scade-python/action.yml | 22 ++++++++++++++++++++++ scade-tests-pytest/action.yml | 22 ++++++++++++++++++++++ tests-pytest/action.yml | 22 ++++++++++++++++++++++ tests/python-setup/setup.py | 22 ++++++++++++++++++++++ 7 files changed, 141 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e28ace4..e122989 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,6 +26,15 @@ repos: - id: trailing-whitespace - id: debug-statements +- repo: https://github.com/ansys/pre-commit-hooks + rev: v0.2.9 + hooks: + - id: add-license-headers + files: '(tests)/.*\.(py)|./.*\.(yml)' + args: + - --start_year=2024 + exclude: '^(.github|doc)/.*' + # Validate our github workflow files - repo: https://github.com/python-jsonschema/check-jsonschema rev: 0.28.0 diff --git a/create-scade-venv/action.yml b/create-scade-venv/action.yml index 6ec3ce3..946cdcc 100644 --- a/create-scade-venv/action.yml +++ b/create-scade-venv/action.yml @@ -1,3 +1,25 @@ +# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # create-scade-venv.yml name: 'Create a virtual Python environment' description: > diff --git a/get-scade-dir/action.yml b/get-scade-dir/action.yml index 587f3e1..cbe55ed 100644 --- a/get-scade-dir/action.yml +++ b/get-scade-dir/action.yml @@ -1,3 +1,25 @@ +# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # get-scade-dir.yml name: 'Retrieve the installation directory of an Ansys SCADE version' diff --git a/get-scade-python/action.yml b/get-scade-python/action.yml index 662234f..f81c8f6 100644 --- a/get-scade-python/action.yml +++ b/get-scade-python/action.yml @@ -1,3 +1,25 @@ +# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # get-scade-python name: 'Retrieve the Python installation installed with Ansys SCADE' diff --git a/scade-tests-pytest/action.yml b/scade-tests-pytest/action.yml index 7d80f47..0661233 100644 --- a/scade-tests-pytest/action.yml +++ b/scade-tests-pytest/action.yml @@ -1,3 +1,25 @@ +# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # action derived from ansys/actions/tests-pytest name: > Tests pytest action diff --git a/tests-pytest/action.yml b/tests-pytest/action.yml index 57d8979..9699ff4 100644 --- a/tests-pytest/action.yml +++ b/tests-pytest/action.yml @@ -1,3 +1,25 @@ +# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # tests-pytest # action derived from ansys/actions/tests-pytest name: > diff --git a/tests/python-setup/setup.py b/tests/python-setup/setup.py index f7196ab..7eda28c 100644 --- a/tests/python-setup/setup.py +++ b/tests/python-setup/setup.py @@ -1,3 +1,25 @@ +# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from setuptools import find_packages, setup setup(