-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <https://gitlab.com/gitlab-org/gitlab-runner/-/issues/29022> 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) |