Skip to content

Commit

Permalink
Feature/devops automation (#106)
Browse files Browse the repository at this point in the history
Update Feature Branche with recent main-developments:

* fix: Remove manual slice creation

* feat: Run workflow on every PR and Branch

* feat: Bump CI versions

* fix: Remove unused attributes

* Commit from GitHub Actions (CI (FHIR Validation))

* devcontainer for docker hosting of environment

* workflow for automated image rendering

* ignore when push (also merged) to main

* use default default author

* auto-generated diagrams by GitHub Action after source code change

---------

Co-authored-by: Yannick Börner <[email protected]>
Co-authored-by: ylboerner <[email protected]>
Co-authored-by: Alexander Zautke <[email protected]>
Co-authored-by: MaxMTheilig <[email protected]>
  • Loading branch information
5 people authored Jan 10, 2024
1 parent 4960166 commit 114978f
Show file tree
Hide file tree
Showing 18 changed files with 891 additions and 472 deletions.
59 changes: 59 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
FROM mcr.microsoft.com/devcontainers/base:alpine-3.18

# Setzen der Umgebungsvariablen
ENV FIRELY_TERMINAL_VERSION=3.1.0
ENV JAVA_VALIDATOR_VERSION=6.0.11
ENV SUSHI_VERSION=3.5.0

# Installieren der notwendige Tools
# Add Microsoft's .NET SDK repository and install .NET SDK
RUN wget https://dot.net/v1/dotnet-install.sh \
&& chmod +x dotnet-install.sh \
&& ./dotnet-install.sh --channel 6.0 --install-dir /usr/share/dotnet \
&& ln -s /usr/share/dotnet/dotnet /usr/local/bin \
&& rm dotnet-install.sh

# Install ICU libraries
RUN apk add --no-cache icu-libs

# Install Node.js and npm
RUN apk add --no-cache nodejs npm

# Install Java (OpenJDK)
RUN apk add --no-cache openjdk11

# Install Firely Terminal as vscode user
# Switch to the vscode user
USER vscode

# Install Firely Terminal
RUN dotnet tool install --global Firely.Terminal --version $FIRELY_TERMINAL_VERSION

# Add .NET tools to PATH for vscode user
ENV PATH="/home/vscode/.dotnet/tools:${PATH}"

# Switch back to root user to perform remaining installations
USER root

RUN npm install -g fsh-sushi@$SUSHI_VERSION

# Installieren der zusätzliche Abhängigkeiten
RUN apk update && apk add --no-cache jq findutils curl ca-certificates

# Setup for FHIR Validator
RUN mkdir -p /home/vscode/.fhir/validators/
RUN wget -q https://github.com/hapifhir/org.hl7.fhir.core/releases/download/$JAVA_VALIDATOR_VERSION/validator_cli.jar -O /home/vscode/.fhir/validators/validator_cli.jar

# Set ownership
RUN mkdir -p /home/vscode/.fhir/packages && \
chown -R vscode:vscode /home/vscode/.fhir/packages

RUN mkdir -p /home/vscode/.fhir/settings/
COPY codfsh-config.yaml /home/vscode/.fhir/settings/codfsh-config.yaml

# Setzen des Arbeitsverzeichnis
WORKDIR /workspace

COPY . /workspace

CMD [ "/bin/bash" ]
9 changes: 9 additions & 0 deletions .devcontainer/codfsh-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sushi:
min_version: "3.5.0"
hapi:
min_version: "3.0.0"
parameters:
jurisdiction: DE
locale: de-DE
tx: "n/a"
debug: true
34 changes: 34 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/alpine
{
"name": "FHIR Development Container",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"build": {
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"gematikde.codfsh",
"MITRE-Health.vscode-language-fsh",
"ms-azuretools.vscode-docker"
],
"settings": {
"codfsh.HapiValidator.Executable": "/home/vscode/.fhir/validators/validator_cli.jar",
"codfsh.HapiValidator.Settings.SettingsFile": "/home/vscode/.fhir/settings/codfsh-config.yaml"
}
}
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
97 changes: 97 additions & 0 deletions .github/workflows/RenderAllDiagrams.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Render All Diagrams

on:
push:
paths:
- '**/Material/imgsrc/**/*.puml'
- '**/Material/imgsrc/**/*.drawio'
branches-ignore:
- main**

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout repository
uses: actions/checkout@v4

# Installs Java distribution for running the plantUML jar
- name: Install Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
check-latest: true

# Install graphviz for plantuml
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1

# Download plantUML jar
- name: Download plantuml file
run: |
wget -O plantuml.jar "https://github.com/plantuml/plantuml/releases/latest/download/plantuml.jar"
# Clean Folder
- name: Ensure and clean folder
run: |
img_dir=ImplementationGuide/images/diagrams
mkdir -p $img_dir
rm -rf ImplementationGuide/images/diagrams/*.svg
# Generate the SVGs from PUML
- name: Render PUML to SVG and Move files
run: |
FileNamePaths=$(find . -path "*/imgsrc/*/*.puml" -exec dirname {} \; | sort -u)
for dir in $FileNamePaths
do
# Render SVGs from PUMLs
find $dir -name "*.puml" -exec java -jar plantuml.jar -tsvg {} \;
done
# Generate the SVGs from DrawIO
- name: Render DrawIO to SVG with predefined action
uses: rlespinasse/drawio-export-action@v2
with:
path: ./Material/imgsrc/drawio/
remove-page-suffix: true
output: .
format: svg
action-mode: all

# copies the created png & svg files to the images/diagrams folder and deletes the drawio files
- name: Move SVGs to target image folder
run: |
img_dir=ImplementationGuide/images/diagrams
# Find all unique directories containing *.svg files under any /imgsrc/ folder
FileNamePaths=$(find . -path "*/imgsrc/*/*.svg" -exec dirname {} \; | sort -u)
for dir in $FileNamePaths
do
# Move SVGs to out directory
find $dir -name "*.svg" -exec mv {} $img_dir \;
done
## add and commit the new generated files
#- name: Create Pull Request
# uses: peter-evans/create-pull-request@v5
# with:
# branch: auto/images-generation
# commit-message: Generated Images from source Code by GitHub Action
# title: Generated Images from GitHub Action
# assignees: ${{ github.actor }}
# reviewers: ${{ github.actor }}
# delete-branch: true
# labels: automated pr

- name: Commit rendered files
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_user_name: GitHub Actions Bot
commit_user_email: [email protected]
commit_message: auto-generated diagrams by GitHub Action after source code change
6 changes: 2 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ name: CI (FHIR Validation)
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -29,7 +27,7 @@ jobs:
# Java and .NET are already installed on ubuntu-latest

- name: Firely.Terminal (GitHub Actions)
uses: FirelyTeam/firely-terminal-pipeline@v0.3.5
uses: FirelyTeam/firely-terminal-pipeline@v0.4.0
with:
PATH_TO_CONFORMANCE_RESOURCES: Resources/fsh-generated/resources/
#PATH_TO_EXAMPLES: Examples
Expand All @@ -42,7 +40,7 @@ jobs:
SIMPLIFIER_PASSWORD: ${{ secrets.SIMPLIFIER_PASSWORD }}
SUSHI_ENABLED: true
SUSHI_OPTIONS: Resources/
SUSHI_VERSION: 2.10.2
SUSHI_VERSION: 3.5.0
EXPECTED_FAILS: VALIDATION_CONFORMANCE_DOTNET VALIDATION_CONFORMANCE_JAVA VALIDATION_EXAMPLES_JAVA

- name: Add & Commit
Expand Down
3 changes: 3 additions & 0 deletions ImplementationGuide/images/diagrams/Klassendiagramm.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
Binary file not shown.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@
},
"ingredient": [
{
"extension": [
{
"valueCoding": {
"system": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/CodeSystem/wirkstofftyp",
"code": "IN"
},
"url": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/wirkstofftyp"
}
],
"strength": {
"numerator": {
"system": "http://unitsofmeasure.org",
Expand All @@ -31,6 +22,15 @@
"code": "mL"
}
},
"extension": [
{
"url": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/wirkstofftyp",
"valueCoding": {
"system": "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/CodeSystem/wirkstofftyp",
"code": "IN"
}
}
],
"itemCodeableConcept": {
"coding": [
{
Expand Down
Loading

0 comments on commit 114978f

Please sign in to comment.