Skip to content

Commit

Permalink
wip: First version
Browse files Browse the repository at this point in the history
  • Loading branch information
ewuerger committed Oct 6, 2023
1 parent 233b0d5 commit f0804ac
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions ci-templates/github/model-validation/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# 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: Extract branch name and print
shell: bash
run: echo "Branch is $(echo ${{ github.ref }} | cut -d'/' -f3)"
- 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
run: docker pull ghcr.io/dsd-dbs/capella-dockerimages/capella/base:${{ inputs.capella_version }}-${{ inputs.capella_docker_images_dropins }}-dropins-${{ inputs.capella_docker_images_revision }}
- name: Execute Model-Validation with Capella CLI
shell: bash
env:
BUILD_DIR: $(pwd)
run: >
docker run --name capella-pod -d ghcr.io/dsd-dbs/capella-dockerimages/capella/base:${{ inputs.capella_version }}-${{ inputs.capella_docker_images_dropins }}-dropins-${{ inputs.capella_docker_images_revision }} /bin/sh -c "while sleep 3600; do :; done"
docker exec capella-pod git config --global --add safe.directory $GITHUB_WORKSPACE
docker exec capella-pod git fetch
docker exec capella-pod [ ! -z $CI_COMMIT_BRANCH ] && git reset --hard origin/$CI_COMMIT_BRANCH
docker exec capella-pod mkdir /tmp/project
docker exec capella-pod cp -r . /tmp/project
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 "$(pwd)" -input "project/{{ inputs.entry_point }}" -outputfolder "project/validation"
docker exec capella-pod cp "/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 f0804ac

Please sign in to comment.