-
Notifications
You must be signed in to change notification settings - Fork 4
108 lines (86 loc) · 3.78 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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@v4
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 temp_folder # Create a temp folder
git diff --name-only main | grep -E '\.(json|xml)$' | xargs -I {} cp {} temp_folder/
ls -l './temp_folder'
# 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 temp_folder/$p*.xml temp_folder/$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