Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: technical review #11

Merged
merged 38 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
839044c
fix: general file changes
Revathyvenugopal162 Feb 20, 2024
a3f07ff
fix: ci-cd
Revathyvenugopal162 Feb 20, 2024
c068344
doc: update the docs check
Revathyvenugopal162 Feb 20, 2024
0c0a364
doc: update the test requirement
Revathyvenugopal162 Feb 20, 2024
43bdb38
debug: test requirement
Revathyvenugopal162 Feb 21, 2024
c2e900b
fix: revert ci-cd
Revathyvenugopal162 Feb 21, 2024
5a6a490
fix: checkout the lib
Revathyvenugopal162 Feb 21, 2024
2dd4ee4
fix: requirements from pyproject
Revathyvenugopal162 Feb 21, 2024
1cca9a6
fix: vale warning
Revathyvenugopal162 Feb 21, 2024
21d7e2d
fix: test docs deploy
Revathyvenugopal162 Feb 21, 2024
63cd016
fix: revert test docs deploy
Revathyvenugopal162 Feb 21, 2024
e45a486
docs:change readme target
Revathyvenugopal162 Feb 21, 2024
3949bd9
fix: test docs deploy
Revathyvenugopal162 Feb 21, 2024
f2f64de
Update .github/workflows/ci_cd.yml
Revathyvenugopal162 Feb 21, 2024
c761529
fix: spacing
Revathyvenugopal162 Feb 21, 2024
3b63725
fix: combine the requirement action
Revathyvenugopal162 Feb 21, 2024
52649c1
doc: improve action description
jorgepiloto Feb 22, 2024
7bbd57e
ci: fix link for labels
jorgepiloto Feb 22, 2024
0215c76
ci: add release step
jorgepiloto Feb 22, 2024
61c6061
fix: actions indentation
jorgepiloto Feb 22, 2024
bec8b74
fix: warnings as errors for sphinx build
jorgepiloto Feb 22, 2024
080ffd4
maint: include dependabot.yml
jorgepiloto Feb 22, 2024
9a0bb22
ci: add release.yml workflow
jorgepiloto Feb 22, 2024
34d2bb4
ci: add CODEOWNERS file
jorgepiloto Feb 22, 2024
2743137
doc: fix link
jorgepiloto Feb 22, 2024
e37f4ac
fix: code style
jorgepiloto Feb 22, 2024
511a8dd
doc: remove badges from index.rst in docs
jorgepiloto Feb 22, 2024
c4c894e
maint: update requirements/
jorgepiloto Feb 22, 2024
2d9f099
doc: add font-awesome from cdnjs
jorgepiloto Feb 22, 2024
ec1bd22
fix: header underline
jorgepiloto Feb 22, 2024
7b1b353
fix: update the sd icon
Revathyvenugopal162 Feb 22, 2024
56146d1
fix: update the fw icon dependencies
Revathyvenugopal162 Feb 22, 2024
9f830a8
fix: update the makfile
Revathyvenugopal162 Feb 22, 2024
f75169e
fix: remove unwanted function
Revathyvenugopal162 Feb 27, 2024
3960c87
fix: remove and dd required spaces and indentation in actions
Revathyvenugopal162 Feb 27, 2024
f43fcbd
fix: updat gitignore and licence
Revathyvenugopal162 Feb 27, 2024
adad4a9
fix: update the dependencies
Revathyvenugopal162 Feb 27, 2024
a3dc8bf
fix: add licence headers
Revathyvenugopal162 Feb 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -143,13 +143,19 @@ jobs:
steps:
# - name: Checkout
# uses: actions/checkout@v4
#
- name: Execute tests
- name: Execute setup.py 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-setup"
pytest-postargs: "tests/python-setup/tests -vv"
checkout: false
- name: Execute pyproject tests
uses: ./scade-tests-pytest
with:
scade-version: ${{ matrix.scade-version }}
library-dir: "tests/python-pyproject"
pytest-postargs: "tests/python-pyproject/tests -vv"
checkout: false

doc-deploy-dev:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,6 @@ dmypy.json
.pyre/
doc/_build/
*-rendered-example.yml

# vscode
.vscode/
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
11 changes: 6 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ 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/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
Expand All @@ -26,8 +26,9 @@ For more information on available actions and how to use them, see


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``.
24 changes: 4 additions & 20 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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",
Expand All @@ -73,6 +68,7 @@
f"actions-v{get_version_match(__version__).replace('.', '-')}": "Ansys-scade-actions",
},
},
"check_switcher": False,
}

# Specify Sphinx extensions to use
Expand Down Expand Up @@ -100,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

Expand Down Expand Up @@ -368,18 +367,3 @@ 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"])
2 changes: 2 additions & 0 deletions doc/styles/Vocab/ANSYS/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ GitHub
pytest
PyPI
TXT
(?!)scade
(?!)python
12 changes: 7 additions & 5 deletions tests-pytest/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ inputs:
default: 'true'
required: false


runs:
using: "composite"
steps:
Expand Down Expand Up @@ -90,11 +89,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='true'>> %GITHUB_ENV%
ansjhenry marked this conversation as resolved.
Show resolved Hide resolved

# - 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 != 'true'
run: |
:: Add the requirements from pyproject.toml
%PYTHON_EXE% -m pip install ${{ inputs.library-dir }}[tests]

- name: "Executing test suite"
shell: cmd
Expand Down
File renamed without changes.
14 changes: 14 additions & 0 deletions tests/python-pyproject/pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
]
32 changes: 32 additions & 0 deletions tests/python-setup/.gitignore
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
21 changes: 21 additions & 0 deletions tests/python-setup/src/test_package/__init__.py
Original file line number Diff line number Diff line change
@@ -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.
45 changes: 45 additions & 0 deletions tests/python-setup/src/test_package/script.py
Original file line number Diff line number Diff line change
@@ -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")
Loading
Loading