Skip to content

build: Bump ansys/actions from 7 to 8 #272

build: Bump ansys/actions from 7 to 8

build: Bump ansys/actions from 7 to 8 #272

Workflow file for this run

name: CI
on:
pull_request:
workflow_dispatch:
push:
tags:
- "v*.*.*"
branches:
- main
env:
MAIN_PYTHON_VERSION: '3.10'
DOCUMENTATION_CNAME: 'actions.scade.docs.pyansys.com'
test-library-name: 'ansys-scade-actions'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
labeler:
name: "Label syncer"
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: micnncim/action-label-syncer@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Label based on changed files
uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions-ecosystem/action-add-labels@v1
if: |
startsWith(github.event.pull_request.head.ref, 'doc') ||
startsWith(github.event.pull_request.head.ref, 'docs')
with:
labels: documentation
- uses: actions-ecosystem/action-add-labels@v1
if: |
startsWith(github.event.pull_request.head.ref, 'maint') ||
startsWith(github.event.pull_request.head.ref, 'no-ci') ||
startsWith(github.event.pull_request.head.ref, 'ci')
with:
labels: maintenance
- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'feat')
with:
labels: |
enhancement
- uses: actions-ecosystem/action-add-labels@v1
if: |
startsWith(github.event.pull_request.head.ref, 'fix') ||
startsWith(github.event.pull_request.head.ref, 'patch')
with:
labels: bug
- name: Suggest to add labels
uses: peter-evans/create-or-update-comment@v4
if: toJSON(github.event.pull_request.labels.*.name) == '{}'
with:
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/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)
- [maintenance](https://github.com/ansys/scade-actions/pulls?q=label%3Amaintenance+)
- [release](https://github.com/ansys/scade-actions/pulls?q=label%3Arelease+)
pr-style:
name: "PR style"
runs-on: ubuntu-latest
needs: labeler
steps:
- name: "Check pr title"
uses: ansys/actions/check-pr-title@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
code-style:
name: "Code style"
runs-on: ubuntu-latest
needs: pr-style
steps:
- name: "Run code style checks"
uses: ansys/actions/code-style@v8
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
use-python-cache: false
- name: "Verify private actions are not pointing to the 'main' branch"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
run: |
if $(grep -q --exclude-dir={.git,.github,doc} "ansys\/actions\/.*\@main" -r .); then
echo -e "\033[1;91m[ERROR]: Found private actions pointing to the 'main' branch.\033[0m"
grep -q --exclude-dir={.git,.github,doc} "ansys\/actions\/.*\@main" -r .
fi
doc-style:
name: "Doc style"
runs-on: ubuntu-latest
needs: pr-style
steps:
- name: "Run documentation style checks"
uses: ansys/actions/doc-style@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
doc-build:
name: "Doc build"
runs-on: ubuntu-latest
needs: doc-style
steps:
- name: "Build documentation"
uses: ansys/actions/doc-build@v8
with:
skip-install: true
python-version: ${{ env.MAIN_PYTHON_VERSION }}
use-python-cache: false
dependencies: "texlive-fonts-extra qpdf"
python-tests:
# tests for python actions
name: "Python Tests"
runs-on: [self-hosted, 'SCADE']
strategy:
matrix:
scade-version: ['23.2']
fail-fast: false
steps:
- 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"
uses: ./scade-tests-pytest
with:
scade-version: ${{ matrix.scade-version }}
library-dir: "tests/python-pyproject"
pytest-postargs: "tests/python-pyproject/tests -vv"
checkout: false
unit-tests:
# tests for Python code included in actions
# cannot reuse ./scade-tests-pytest: the tested scripts are not part of a Python package
name: "Run Python unit tests"
runs-on: [self-hosted, 'SCADE']
strategy:
matrix:
scade-version: ['23.2']
fail-fast: false
steps:
- name: "Install Git and clone project"
uses: actions/checkout@v4
- name: "Get SCADE installation directory"
uses: ./get-scade-dir
id: get-scade-dir
with:
scade-version: ${{ matrix.scade-version }}
- name: "Get 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: "Check python"
shell: cmd
run: |
:: Check python
echo Activate the virtual environment
call ${{ steps.create-scade-venv.outputs.scripts-dir }}\activate.bat"
python.exe --version
:: store the "exe for the next steps"
echo PYTHON_EXE=${{ steps.create-scade-venv.outputs.scripts-dir }}\python.exe>> %GITHUB_ENV%
- name: "Update pip"
shell: cmd
run: |
%PYTHON_EXE% -m pip install -U pip
- name: "Install test requirements"
shell: cmd
run: |
echo Installing test dependencies from requirements_tests.txt
%PYTHON_EXE% -m pip install -r requirements/requirements_tests.txt
- name: "Executing test suite"
shell: cmd
run: |
:: Run tests
%PYTHON_EXE% -m pytest --ignore=tests/python-pyproject --ignore=tests/python-setup --basetemp=tmp --cov-report=term --cov-branch --cov-report=html:.cov/html --cov-report=xml:.cov/xml
# - name: "Upload coverage reports to Codecov"
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# slug: ansys/scade-actions
# files: .cov/xml
suite-tests:
# tests for SCADE Suite actions
name: "Suite Tests"
runs-on: [self-hosted, 'SCADE']
strategy:
matrix:
scade-version: ['23.2']
fail-fast: false
steps:
- name: "Check out the repository"
uses: actions/checkout@v4
- name: "Get SCADE installation directory"
uses: ./get-scade-dir
id: get-scade-dir
with:
scade-version: ${{ matrix.scade-version }}
- name: "Generate with suite-code"
uses: ./suite-code
id: suite-code-generate
with:
scade-dir: ${{ steps.get-scade-dir.outputs.scade-directory }}
project: "tests/suite-code/Model/Model.etp"
configuration: "Suite Code"
build: "false"
checkout: false
- name: "Upload code target directory to artifacts"
uses: actions/upload-artifact@v4
with:
name: "scade-suite-code-target-directory"
path: "${{ steps.suite-code-generate.outputs.target-directory }}/*.*"
retention-days: 7
if-no-files-found: error
- name: "Build with suite-code"
uses: ./suite-code
id: suite-code-build
with:
scade-dir: ${{ steps.get-scade-dir.outputs.scade-directory }}
project: "tests/suite-code/Model/Model.etp"
configuration: "Simulation"
build: "true"
checkout: false
- name: "Log the target directories"
shell: cmd
run: |
echo Generation target directory: ${{ steps.suite-code-generate.outputs.target-directory }}
echo Build target directory: ${{ steps.suite-code-build.outputs.target-directory }}
- name: "Acquire the model coverage with test-coverage"
uses: ./test-coverage
id: test-coverage
with:
scade-dir: ${{ steps.get-scade-dir.outputs.scade-directory }}
test-project: "tests/test-coverage/Test/Test.etp"
results-project: "tests/test-coverage/Results/Results.etp"
configuration: "Test"
cov-status: "cov_status/Model.json"
checkout: false
- name: "Upload coverage status to artifacts"
uses: actions/upload-artifact@v4
with:
name: "coverage-status"
path: "cov_status\\Model.json"
retention-days: 7
if-no-files-found: error
- name: "Run the tests with test-execute"
uses: ./test-execute
id: test-execute
with:
scade-dir: ${{ steps.get-scade-dir.outputs.scade-directory }}
test-project: "tests/test-execute/Test/Test.etp"
results-project: "tests/test-execute/Results/Results.etp"
configuration: "Test Success"
junit-report: "junit-reports/Model.xml"
checkout: false
- name: "Upload JUnit report to artifacts"
uses: actions/upload-artifact@v4
with:
name: "junit-report"
path: "junit-reports\\Model.xml"
retention-days: 7
if-no-files-found: error
- name: "Compute metrics with suite-metrics"
uses: ./suite-metrics
id: suite-metrics
with:
scade-dir: ${{ steps.get-scade-dir.outputs.scade-directory }}
project: "tests/suite-metrics/Model/Model.etp"
configuration: "MetricRule"
checkout: false
- name: "Upload metrics report artifacts"
uses: actions/upload-artifact@v4
with:
name: "metrics"
path: "${{ steps.suite-metrics.outputs.report }}"
retention-days: 7
if-no-files-found: error
- name: "Check custom rules with suite-rules"
uses: ./suite-rules
id: suite-rules
with:
scade-dir: ${{ steps.get-scade-dir.outputs.scade-directory }}
project: "tests/suite-rules/Model/Model.etp"
configuration: "RuleSuccess"
checkout: false
- name: "Upload Custom rules report artifacts"
uses: actions/upload-artifact@v4
with:
name: "check-custom-rules"
path: "${{ steps.suite-rules.outputs.report }}"
retention-days: 7
if-no-files-found: error
- name: "Check with suite-check"
uses: ./suite-check
id: suite-check
with:
scade-dir: ${{ steps.get-scade-dir.outputs.scade-directory }}
project: "tests/suite-check/Model/Model.etp"
configuration: "KCG Expall"
checkout: false
- name: "Upload Checker report artifacts"
uses: actions/upload-artifact@v4
with:
name: "scade-suite-check-report"
path: "${{ steps.suite-check.outputs.report }}"
retention-days: 7
if-no-files-found: error
- name: "Generate the documentation with suite-report"
uses: ./suite-report
id: suite-report
with:
scade-dir: ${{ steps.get-scade-dir.outputs.scade-directory }}
project: "tests/suite-report/Model/Model.etp"
configuration: "RTF"
checkout: false
- name: "Upload the document to artifacts"
uses: actions/upload-artifact@v4
with:
name: "scade-suite-report"
path: "${{ steps.suite-report.outputs.report }}"
retention-days: 7
if-no-files-found: error
display-tests:
# tests for SCADE Display actions
name: "Display Tests"
runs-on: [self-hosted, 'SCADE']
strategy:
matrix:
scade-version: ['24.2']
fail-fast: false
steps:
- name: "Check out the repository"
uses: actions/checkout@v4
- name: "Get SCADE installation directory"
uses: ./get-scade-dir
id: get-scade-dir
with:
scade-version: ${{ matrix.scade-version }}
- name: "Generate the documentation with display-report"
uses: ./display-report
id: display-report
with:
scade-dir: ${{ steps.get-scade-dir.outputs.scade-directory }}
project: "tests/display-report/Model/Model.etp"
configuration: "RTF"
checkout: false
- name: "Upload the document to artifacts"
uses: actions/upload-artifact@v4
with:
name: "scade-display-report"
path: "${{ steps.display-report.outputs.report }}"
retention-days: 7
if-no-files-found: error
- name: "Generate code with display-generate"
uses: ./display-generate
id: display-generate-code
with:
scade-dir: ${{ steps.get-scade-dir.outputs.scade-directory }}
project: "tests/display-generate/Model/Model.etp"
configuration: "Code"
checkout: false
- name: "Upload code target directory to artifacts"
uses: actions/upload-artifact@v4
with:
name: "scade-display-code-target-directory"
path: "${{ steps.display-generate-code.outputs.target-directory }}/*.*"
retention-days: 7
if-no-files-found: error
- name: "Generate standalone with display-generate"
uses: ./display-generate
id: display-generate-standalone
with:
scade-dir: ${{ steps.get-scade-dir.outputs.scade-directory }}
project: "tests/display-generate/Model/Model.etp"
configuration: "Windows"
checkout: false
- name: "Upload standalone target directory to artifacts"
uses: actions/upload-artifact@v4
with:
name: "scade-display-standalone-target-directory"
path: "${{ steps.display-generate-standalone.outputs.target-directory }}/*.*"
retention-days: 7
if-no-files-found: error
- name: "Check with display-check"
uses: ./display-check
id: display-check
with:
scade-dir: ${{ steps.get-scade-dir.outputs.scade-directory }}
project: "tests/display-check/Model/Model.etp"
specification: "specification.sgfx"
format: 'TXT'
output: 'design-checker-report-specification.txt'
checkout: false
- name: "Upload Checker report artifacts"
uses: actions/upload-artifact@v4
with:
name: "scade-display-check-report"
path: 'design-checker-report-specification.txt'
retention-days: 7
if-no-files-found: error
tests:
name: "All Tests"
needs: [display-tests, python-tests, unit-tests, suite-tests]
runs-on: ubuntu-latest
steps:
- name: "Synchronization"
run: |
echo Tests completed
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')
steps:
- uses: ansys/actions/doc-deploy-dev@v8
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
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/[email protected]
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/[email protected]
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@v2
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@v8
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}