From 370871ca04ef05206ed2032b96610d5ab59b3383 Mon Sep 17 00:00:00 2001 From: Matthias Treber <> Date: Sun, 6 Dec 2020 15:05:37 +0100 Subject: [PATCH] Update namings and README, fix artifact deployment --- .github/workflows/build-test-deploy.yml | 6 +++--- .github/workflows/build-test.yml | 9 ++++++++- README.md | 10 +++++++++- action.yml | 2 ++ entrypoint.sh | 21 +++++++++++++-------- index_stub.html | 7 +++++-- 6 files changed, 40 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-test-deploy.yml b/.github/workflows/build-test-deploy.yml index d9293ab2..943e6006 100644 --- a/.github/workflows/build-test-deploy.yml +++ b/.github/workflows/build-test-deploy.yml @@ -5,20 +5,20 @@ on: jobs: build_test_deploy: runs-on: ubuntu-latest - name: Test building HTML of IFE model and deploy container when successfull + name: Build HTML, push container and deploy HTML steps: - name: Checkout uses: actions/checkout@v2 - - name: Test building the image and exporting HTML + name: Build the image and export HTML uses: ./ - name: Deploy HTML to Github Pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./public + publish_dir: artifacts - name: Push image to Dockerhub uses: docker/build-push-action@v1 diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 08881412..8f630111 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -2,6 +2,7 @@ on: push: branches: - main + - develop jobs: build_test: @@ -13,4 +14,10 @@ jobs: uses: actions/checkout@v2 - name: Test building the image and exporting HTML - uses: ./ \ No newline at end of file + uses: ./ + - + name: Archive HTML export and validation report + uses: actions/upload-artifact@v2 + with: + name: validation-report-html-export + path: artifacts \ No newline at end of file diff --git a/README.md b/README.md index b6d88c1f..a88a5249 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,17 @@ Map the folder where your model and your `entrypoint.sh` is located into the docker run --init -v `pwd`/workdir:/workdir capella-html-exporter ``` -Note: You must run eclipse in a virtual framebuffer, as it requires a X server. +### Entrypoint.sh + +You must run eclipse in a virtual framebuffer, as it requires a X server. `Xvfb` is included in the docker image. +The first step needs to import your project into the Capella workspace. +Note: It seems that Capella 1.4.2 has a bug in the +`org.polarsys.kitalpha.doc.gen.business.capella.commandline` function that does +not allow to use the `import` flag in there. There, we use the `validation` app +first, to import the project into the Capella workspace. + The `entrypoint.sh` could look like this: ```bash diff --git a/action.yml b/action.yml index c91538f7..6c3c94a0 100644 --- a/action.yml +++ b/action.yml @@ -4,3 +4,5 @@ description: 'Start the Capella HTML exporter Docker container' runs: using: 'docker' image: 'Dockerfile' + args: + - /github/workspace/artifacts \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index dd3121cc..ecc92d19 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,10 @@ #!/bin/bash +# The first commandline argument contains the folder which shall have the +# outputs of the export. +results_folder=${1:-/workdir} +mkdir -p ${results_folder} + # Unpack the example project that is delivered with Capella pushd /opt/capella/samples unzip IFE_samplemodel.zip @@ -10,11 +15,11 @@ xvfb-run -s "-screen 0 1280x720x24" \ eclipse -nosplash -consoleLog \ -application org.polarsys.capella.core.commandline.core \ -appid org.polarsys.capella.core.validation.commandline \ --data /workspace \ +-data /capella-workspace \ -import "/opt/capella/samples/In-Flight Entertainment System" \ -input "/In-Flight Entertainment System/In-Flight Entertainment System.aird" \ -outputfolder "/In-Flight Entertainment System/validation" \ --logfile /workdir/log.html \ +-logfile ${results_folder}/log.html \ -forceoutputfoldercreation # Export the model as HTML @@ -24,15 +29,15 @@ xvfb-run -s "-screen 0 1280x720x24" \ eclipse -nosplash -consoleLog \ -application org.polarsys.capella.core.commandline.core \ -appid org.polarsys.kitalpha.doc.gen.business.capella.commandline \ --data /workspace \ +-data /capella-workspace \ -filepath "/In-Flight Entertainment System/In-Flight Entertainment System.aird" \ -outputfolder "/In-Flight Entertainment System/html_export" \ --logfile /workdir/log.html \ +-logfile ${results_folder}/log.html \ -forceoutputfoldercreation -# Copy the validation and html output to the /workdir that is mapped as a volume -cp -r "/opt/capella/samples/In-Flight Entertainment System/html_export" /workdir/html_export -cp -r "/opt/capella/samples/In-Flight Entertainment System/validation" /workdir/validation +# Copy the validation and html output to the ${results_folder}/ that is mapped as a volume +cp -r "/opt/capella/samples/In-Flight Entertainment System/html_export" ${results_folder}/html_export +cp -r "/opt/capella/samples/In-Flight Entertainment System/validation" ${results_folder}/validation # Create index.html from stub -sed 's/model-name-to-replace/In-Flight Entertainment System/g' index_stub.html > /workdir/index.html +sed 's/model-name-to-replace/In-Flight Entertainment System/g' index_stub.html > ${results_folder}/index.html diff --git a/index_stub.html b/index_stub.html index d359bf6c..3b7f294d 100644 --- a/index_stub.html +++ b/index_stub.html @@ -11,8 +11,11 @@

model-name-to-replace artifacts

- Model Validation
- Model HTML export + Model HTML export
+ Model Validation +

+

+ Log

\ No newline at end of file