-
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
57 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,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 |