diff --git a/ci-templates/github/model-validation/action.yml b/ci-templates/github/model-validation/action.yml new file mode 100644 index 00000000..7fa8dbaf --- /dev/null +++ b/ci-templates/github/model-validation/action.yml @@ -0,0 +1,54 @@ +# SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors +# SPDX-License-Identifier: Apache-2.0 + +name: "Capella Model-Validation" +description: "An action to validate a Capella model." + +inputs: + entry_point: + description: "The entry point of the used model" + capella_docker_images_revision: + description: "The revision of capella-dockerimages to use" + default: main + capella_docker_images_dropins: + description: "Please have a look at https://dsd-dbs.github.io/capella-dockerimages/capella/introduction/#supported-dropins" + required: false + default: selected + +runs: + using: "composite" + steps: + - name: Set up Python 3.11 + uses: actions/setup-python@v3 + with: + python-version: 3.11 + - name: Extract branch name and print + shell: bash + run: echo "Branch is $(echo ${{ github.ref }} | cut -d'/' -f3)" + - name: Execute Model-Validation with Capella CLI + shell: bash + run: > + # As our containers run with techuser (non-root) git commands fail with dubious ownership, see for the solution. + - git config --global --add safe.directory ${CI_PROJECT_DIR} + - git fetch + - if [ ! -z $CI_COMMIT_BRANCH ]; then git reset --hard origin/$CI_COMMIT_BRANCH; fi + - BUILD_DIR=$(pwd) + - if [ ! -f ".project" ]; then echo "The model validator requires a '.project' file!" && exit 1; fi + - 'if [[ "$(dirname "{{ inputs.entry_point }}")" != "." ]]; then echo ''The model validator requires a "*.aird" in the root level of the repository!'' && exit 1; fi' + - mkdir /tmp/project + - cp -r . /tmp/project + - cd /tmp + - > + xvfb-run /opt/capella/capella + -nosplash + -application org.polarsys.capella.core.commandline.core + -appid org.polarsys.capella.core.validation.commandline + -data "$(pwd)" + -input "project/{{ inputs.entry_point }}" + -outputfolder "project/validation" + - cp "/tmp/project/validation/project/{{ inputs.entry_point }}/validation-results.html" $BUILD_DIR + - name: Archive model-validation in artifacts + uses: actions/upload-artifact@v3 + with: + name: Validation reports + path: $(pwd)