Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: First version
Browse files Browse the repository at this point in the history
ewuerger committed Oct 6, 2023

Verified

This commit was signed with the committer’s verified signature.
ewuerger Ernst Würger
1 parent 233b0d5 commit 0f70a55
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions ci-templates/github/model-validation/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# 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_version:
description: "The version of the Capella 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
github_token:
description: "The GitHub token for authentication"

runs:
using: "composite"
steps:
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: 3.11
- name: Authenticate to GitHub Container Registry
shell: bash
run: docker login ghcr.io -u ${{ github.actor }} --password-stdin <<< "${{ inputs.github_token }}"
- name: Pull Capella Docker image
shell: bash
env:
IMAGE_TAG: ${{ inputs.capella_version }}-${{ inputs.capella_docker_images_dropins }}-dropins-${{ inputs.capella_docker_images_revision }}
run: docker pull ghcr.io/dsd-dbs/capella-dockerimages/capella/base:$IMAGE_TAG
- name: Prepare workspace
shell: bash
env:
REVISION: $(echo ${{ github.ref }} | cut -d'/' -f3)
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
git fetch
[ ! -z $REVISION ] && git reset --hard origin/$REVISION
mkdir -p /tmp/project
cp -r . /tmp/project
- name: Validate Capella Model
shell: bash
env:
IMAGE_TAG: ${{ inputs.capella_version }}-${{ inputs.capella_docker_images_dropins }}-dropins-${{ inputs.capella_docker_images_revision }}
DISPLAY: ":99" # Virtual display used to run Capella in the background. Do not modify the value!
run: |
docker run --name capella-pod -v /tmp/project:/tmp/project -d ghcr.io/dsd-dbs/capella-dockerimages/capella/base:$IMAGE_TAG /bin/sh -c "while sleep 3600; do :; done"
docker exec capella-pod xvfb-run /opt/capella/capella -nosplash -application org.polarsys.capella.core.commandline.core -appid org.polarsys.capella.core.validation.commandline -data "/tmp/project" -input "project/{{ inputs.entry_point }}" -outputfolder "project/validation"
docker cp capella-pod:/tmp/project/validation/project/{{ inputs.entry_point }}/validation-results.html $BUILD_DIR
- name: Archive model-validation in artifacts
uses: actions/upload-artifact@v3
env:
ARTIFACTS: $(pwd)
with:
name: Validation reports
path: ARTIFACTS

0 comments on commit 0f70a55

Please sign in to comment.