diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml
index 26f4b88..f12f4e2 100644
--- a/.github/workflows/ci_cd.yml
+++ b/.github/workflows/ci_cd.yml
@@ -141,33 +141,13 @@ jobs:
scade-version: ['23.2']
fail-fast: false
steps:
- - name: Checkout
- uses: actions/checkout@v3
-
- - name: Get SCADE installation directory
- uses: ./get-scade-dir
- id: get-scade-dir
- with:
- scade-version: ${{ matrix.scade-version }}
-
- - name: Get Python version
- uses: ./get-scade-python
- id: get-scade-python
- with:
- scade-dir: ${{ steps.get-scade-dir.outputs.scade-directory }}
-
- - name: Create a Python virtual environment
- uses: ./create-scade-venv
- id: create-scade-venv
- with:
- python-dir: ${{ steps.get-scade-python.outputs.python-dir }}
- target-dir: '.venvs'
- target-name: ${{ steps.get-scade-python.outputs.python-name }}
-
+ # - name: Checkout
+ # uses: actions/checkout@v4
+ #
- name: Execute tests
- uses: ./tests-pytest
+ uses: ./scade-tests-pytest
with:
- python-dir: ${{ steps.create-scade-venv.outputs.scripts-dir }}
+ scade-version: ${{ matrix.scade-version }}
library-dir: "tests/python"
pytest-postargs: "tests/python/tests -vv"
checkout: false
diff --git a/doc/source/tests-actions/examples/scade-tests-pytest.yml b/doc/source/tests-actions/examples/scade-tests-pytest.yml
new file mode 100644
index 0000000..65922f7
--- /dev/null
+++ b/doc/source/tests-actions/examples/scade-tests-pytest.yml
@@ -0,0 +1,10 @@
+tests:
+ name: "Run tests basic example"
+ runs-on: [self-hosted, 'SCADE']
+ steps:
+ - name: "Run the tests for a given version of Ansys SCADE"
+ uses: ansys/scade-actions/scade-tests-pytest@{{ version }}
+ with:
+ scade-version: '23.2'
+ pytest-extra-args: "--cov=ansys --cov-report=term --cov-branch --cov-report=html:.cov/html"
+ checkout: false
diff --git a/doc/source/tests-actions/index.rst b/doc/source/tests-actions/index.rst
index 62ffc25..7bc7278 100644
--- a/doc/source/tests-actions/index.rst
+++ b/doc/source/tests-actions/index.rst
@@ -31,9 +31,9 @@ Create SCADE Python virtual environment action
Test library action
--------------------
-This action runs the test suite for a Python library. This action accepts
-markers, options, and post arguments to be passed to pytest before executing
-the test session.
+This action runs the test suite for a Python library and a given Python
+interpreter. This action accepts markers, options, and post arguments to be
+passed to pytest before executing the test session.
.. jinja:: tests-pytest
@@ -56,3 +56,32 @@ Examples
:language: yaml
{% endfor %}
+
+
+SCADE Test library action
+-------------------------
+This action runs the test suite for a Python library and a given version of
+Ansys SCADE. This action accepts markers, options, and post arguments to be
+passed to pytest before executing the test session.
+
+.. jinja:: scade-tests-pytest
+
+ {{ description }}
+
+ {{ inputs_table }}
+
+ {{ outputs_table }}
+
+Examples
+++++++++
+
+.. jinja:: scade-tests-pytest
+
+ {% for filename, title in examples %}
+ .. dropdown:: {{ title }}
+ :animate: fade-in
+
+ .. literalinclude:: examples/{{ filename }}
+ :language: yaml
+
+ {% endfor %}
diff --git a/scade-tests-pytest/action.yml b/scade-tests-pytest/action.yml
new file mode 100644
index 0000000..db6d697
--- /dev/null
+++ b/scade-tests-pytest/action.yml
@@ -0,0 +1,83 @@
+# action derived from ansys/actions/tests-pytest
+name: >
+ Tests pytest action
+
+description: >
+ Run a test suite using `pytest `_.
+
+inputs:
+
+ scade-version:
+ description: >
+ SCADE version used for installing and running ``pytest``.
+ For example, use ``'24.1'`` for Ansys SCADE 2024 R1.
+ required: true
+
+ # Optional inputs
+ library-dir:
+ description: >
+ Directory of the library to test.
+ default: '.'
+ required: false
+
+ pytest-markers:
+ description: >
+ Set of `pytest markers
+ `_ in the form of
+ a string. These markers are used to discretize tests when running the test
+ session.
+ default: ''
+ required: false
+
+ pytest-extra-args:
+ description: >
+ Set of additional ``pytest`` arguments in the form of a string.
+ default: ''
+ required: false
+
+ pytest-postargs:
+ description: >
+ Directory of the test suite and the level of verbosity.
+ default: 'tests -vv'
+ required: false
+
+ checkout:
+ description: >
+ Whether to clone the repository in the CI/CD machine.
+ default: 'true'
+ required: false
+
+
+runs:
+ using: "composite"
+ steps:
+
+ - name: "Retrieve SCADE installation directory"
+ uses: ./get-scade-dir
+ id: get-scade-dir
+ with:
+ scade-version: ${{ inputs.scade-version }}
+
+ - name: "Retrieve SCADE Python interpreter"
+ uses: ./get-scade-python
+ id: get-scade-python
+ with:
+ scade-dir: ${{ steps.get-scade-dir.outputs.scade-directory }}
+
+ - name: "Create Python virtual environment"
+ uses: ./create-scade-venv
+ id: create-scade-venv
+ with:
+ python-dir: ${{ steps.get-scade-python.outputs.python-dir }}
+ target-dir: '.venvs'
+ target-name: ${{ steps.get-scade-python.outputs.python-name }}
+
+ - name: "Run the tests"
+ uses: ./tests-pytest
+ with:
+ python-dir: ${{ steps.create-scade-venv.outputs.scripts-dir }}
+ library-dir: ${{ inputs.library-dir }}
+ pytest-markers: ${{ inputs.pytest-markers }}
+ pytest-extra-args: ${{ inputs.pytest-extra-args }}
+ pytest-postargs: ${{ inputs.pytest-postargs }}
+ checkout: ${{ inputs.checkout }}
diff --git a/tests-pytest/action.yml b/tests-pytest/action.yml
index 792dbaa..2bd78bf 100644
--- a/tests-pytest/action.yml
+++ b/tests-pytest/action.yml
@@ -43,8 +43,7 @@ inputs:
checkout:
description: >
- Whether to clone the repository in the CI/CD machine. Default value is
- ``true``.
+ Whether to clone the repository in the CI/CD machine.
default: 'true'
required: false
@@ -54,7 +53,7 @@ runs:
steps:
- name: "Install Git and clone project"
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
if: ${{ inputs.checkout == 'true' }}
- name: Pass Inputs to Shell