Skip to content

Validieren von neuen Beispielen mit HAPI Validator #13

Validieren von neuen Beispielen mit HAPI Validator

Validieren von neuen Beispielen mit HAPI Validator #13

Workflow file for this run

name: Validate Examples
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
JAVA_VALIDATOR_VERSION: 6.0.15
PATH_TO_EXAMPLES: './temp_folder/'
FHIR_VERSION: "4.0"
INPUT_JAVA_VALIDATION_OPTIONS: "-tx http://tx.fhir.org -debug -allow-example-urls true"
IG_DEPENDENCIES: "-ig de.basisprofil.r4#1.4.0 -ig hl7.fhir.r4.core#4.0.1 -ig kbv.ita.for#1.1.0 -ig kbv.ita.erp#1.1.x -ig de.gematik.erezept-workflow.r4 1.x.x"
jobs:
CI_EXAMPLES_VALIDATION:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '20'
# Identify and Copy Changed .json and .xml Files
- name: Identify and Copy Changed .json and .xml Files
run: |
mkdir -p $PATH_TO_EXAMPLES # Create a temp folder
git fetch origin main:main
git diff --name-only main | grep -E '\.(json|xml)$' | xargs -I {} cp {} $PATH_TO_EXAMPLES/
ls -l $PATH_TO_EXAMPLES
# Install .NET runtime
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
# Install Java runtime (only needed if you want to run the offical HL7 Java validator)
- name: Setup Java JDK
uses: actions/setup-java@v3
with:
distribution: 'microsoft'
java-version: '17'
# --------------------------------------------------------------------------------------------------- #
# JAVA Validator #
# --------------------------------------------------------------------------------------------------- #
- name: Check if Java is installed
run: |
if ! command -v java &> /dev/null
then
echo "java could not be found. Please see actions/setup-java to set it up before running this action."
exit 1
fi
shell: bash
- name: Download Java Validator
run: |
CHECK_JAVA_VERSION=$(java -version 2>&1 | head -1 | cut -d'"' -f2)
echo "JAVA_VERSION: $CHECK_JAVA_VERSION"
wget -q https://github.com/hapifhir/org.hl7.fhir.core/releases/download/$JAVA_VALIDATOR_VERSION/validator_cli.jar
echo "JAVA_VALIDATOR_VERSION: $JAVA_VALIDATOR_VERSION"
shell: bash
- name: Install jq
run: |
sudo apt-get update > /dev/null
sudo apt-get install --no-install-recommends -y jq findutils curl ca-certificates > /dev/null
shell: bash
- name: Validate all example resources in scope of the repository
run: |
for p in $INPUT_PATH_TO_CONFORMANCE_RESOURCES; # Get combined path to conformance resources, we want to validate against the current version of the conformance resources
do
COMBINED_IG_PARAMETERS+="-ig $GITHUB_WORKSPACE/$p "
done
for p in $PATH_TO_EXAMPLES;
do
# Ensure directory ends with "/"
if [[ ! "$p" =~ .*/$ ]]; then
p="$p/"
fi
UNESCPAED_IG_DEPENDENCIES=$(echo $IG_DEPENDENCIES | tr -d '"')
java -jar validator_cli.jar $GITHUB_WORKSPACE/$p*.xml $GITHUB_WORKSPACE/$p*.json -version $FHIR_VERSION $INPUT_JAVA_VALIDATION_OPTIONS $UNESCPAED_IG_DEPENDENCIES $COMBINED_IG_PARAMETERS
done
- name: Cleanup
if: always()
run: rm -rf temp_folder