Skip to content

Commit 5593859

Browse files
authored
Merge pull request #152 from dcarbone/v4.x
Version 4
2 parents 1acdedc + f199f43 commit 5593859

File tree

260 files changed

+15137
-11493
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

260 files changed

+15137
-11493
lines changed

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
/README.md export-ignore
55
/output export-ignore
66
/input export-ignore
7-
/phpunit export-ignore
7+
/phpunit export-ignore
8+
fhir_test_resources.tar.gz export-ignore

.github/FUNDING.yml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,2 @@
1-
# These are supported funding model platforms
2-
31
github: dcarbone
4-
patreon: # Replace with a single Patreon username
5-
open_collective: # Replace with a single Open Collective username
6-
ko_fi: dcarbone
7-
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8-
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9-
liberapay: # Replace with a single Liberapay username
10-
issuehunt: # Replace with a single IssueHunt username
11-
otechie: # Replace with a single Otechie username
12-
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13-
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
2+
ko_fi: dcarbone
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: 'Bootstrap'
2+
description: 'Bootstraps the GHA runner for Builder tests'
3+
4+
inputs:
5+
php-version:
6+
required: true
7+
description: 'PHP version to use for tests'
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: 'Define vars'
13+
id: vars
14+
shell: bash -e {0}
15+
# language=sh
16+
run: |
17+
_phpunit_version=
18+
case "${{ inputs.php-version }}" in
19+
8.1) _phpunit_version='10.5' ;;
20+
8.2) _phpunit_version='11.1' ;;
21+
8.3) _phpunit_version='11.1' ;;
22+
8.4) _phpunit_version='11.1' ;;
23+
*) echo "Unsupported PHP version: ${{ inputs.php-version }}" && exit 1 ;;
24+
esac
25+
echo "phpunit-version=${_phpunit_version}" >> $GITHUB_OUTPUT
26+
27+
- name: 'Install PHP'
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: ${{ inputs.php-version }}
31+
extensions: libxml simplexml json zip
32+
ini-values: precision=20
33+
34+
- name: 'Install jq'
35+
uses: dcarbone/install-jq-action@v3
36+
with:
37+
force: true
38+
39+
- name: 'Set composer dep versions'
40+
shell: bash -e {0}
41+
# language=sh
42+
run: |
43+
tmpf="$(mktemp)"
44+
jq -rcM '."require-dev"."phpunit/phpunit" = "^${{ steps.vars.outputs.phpunit-version }}"' composer.json > "${tmpf}"
45+
mv "${tmpf}" composer.json
46+
47+
- name: 'Get composer cache directory'
48+
id: composer-cache
49+
shell: bash -e {0}
50+
# language=sh
51+
run: |
52+
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
53+
54+
- name: 'Init composer dep cache'
55+
id: cache
56+
uses: actions/cache@v4
57+
with:
58+
path: ${{ steps.composer-cache.outputs.dir }}
59+
key: "composer-${{ runner.os }}-${{ inputs.php-version }}-${{ steps.vars.outputs.phpunit-version }}-${{ hashFiles('composer.lock') }}"
60+
61+
- name: 'Install composer deps'
62+
shell: bash -e {0}
63+
# language=sh
64+
run: |
65+
rm composer.lock
66+
composer update --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
67+
68+
- name: 'Save composer dep cache'
69+
if: steps.cache.outputs.cache-hit != 'true' && steps.cache.outputs.cache-hit != true
70+
uses: actions/cache/save@v4
71+
with:
72+
path: ${{ steps.composer-cache.outputs.dir }}
73+
key: "composer-${{ runner.os }}-${{ inputs.php-version }}-${{ steps.vars.outputs.phpunit-version }}-${{ hashFiles('composer.lock') }}"

.github/actions/load-fhir-validator/action.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ runs:
2727
echo 'url=${{ inputs.base-url }}/${{ inputs.version }}/${{ inputs.filename }}' >> $GITHUB_OUTPUT
2828
echo 'cache-key=fhir-validator-${{ inputs.version }}-2' >> $GITHUB_OUTPUT
2929
30-
- uses: actions/cache@v4
31-
id: cache
30+
- name: 'Init validator cache'
31+
uses: actions/cache@v4
32+
id: validator-cache
3233
with:
3334
path: |
3435
${{ github.workspace }}/bin
3536
/home/runner/.fhir
3637
key: '${{ steps.vars.outputs.cache-key }}'
37-
save-always: true
3838

3939
- name: 'Install Java'
4040
if: steps.cache.outputs.cache-hit != 'true' && steps.cache.outputs.cache-hit != true
@@ -62,4 +62,3 @@ runs:
6262
java -jar '${{ github.workspace }}/bin/validator_cli.jar' -version 4.3.0
6363
java -jar '${{ github.workspace }}/bin/validator_cli.jar' -version 5.0.0
6464
echo '::endgroup::'
65-

.github/actions/load-fhir-xsd/action.yaml

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ outputs:
2525
cache-key:
2626
description: 'Actions Cache key'
2727
value: '${{ steps.vars.cache-key }}'
28+
cache-dir:
29+
description: 'Root Cache directory'
30+
value: '${{ steps.vars.cache-dir }}'
31+
version-xsd-cache-dir:
32+
description: 'Specific version XSD cache directory'
33+
value: '${{ steps.vars.version-xsd-cache-dir }}'
2834

2935
runs:
3036
using: composite
@@ -37,12 +43,12 @@ runs:
3743
_cache_key="fhir-source-${{ inputs.version }}-${_month}-1"
3844
_dl_url="${{ inputs.base-url}}/${{ inputs.version }}/${{ inputs.filename }}"
3945
_cache_dir="${{ github.workspace }}/input"
40-
_xsd_cache_dir="${_cache_dir}/${{ inputs.version }}"
46+
_version_xsd_cache_dir="${_cache_dir}/${{ inputs.version }}"
4147
_zip_filename="${_cache_dir}/${{ inputs.version }}.zip"
4248
4349
echo "cache-key=${_cache_key}" >> $GITHUB_OUTPUT
4450
echo "cache-dir=${_cache_dir}" >> $GITHUB_OUTPUT
45-
echo "xsd-cache-dir=${_xsd_cache_dir}" >> $GITHUB_OUTPUT
51+
echo "version-xsd-cache-dir=${_version_xsd_cache_dir}" >> $GITHUB_OUTPUT
4652
echo "url=${_dl_url}" >> $GITHUB_OUTPUT
4753
echo "zip-filename=${_zip_filename}" >> $GITHUB_OUTPUT
4854
@@ -57,15 +63,39 @@ runs:
5763
shell: bash -e {0}
5864
# language=sh
5965
run: |
60-
mkdir -p '${{ steps.vars.outputs.xsd-cache-dir }}'
66+
echo "::group::Ensuring cache directory exists"
67+
mkdir -p '${{ steps.vars.outputs.version-xsd-cache-dir }}'
68+
echo "::endgroup::"
6169
70+
echo "::group::Downloading '${{ steps.vars.outputs.url }}'"
6271
curl \
6372
-L \
6473
-A '${{ inputs.user-agent }}' \
6574
-o '${{ steps.vars.outputs.zip-filename }}' \
6675
'${{ steps.vars.outputs.url }}'
76+
echo "::endgroup::"
6777
68-
unzip -o -qq '${{ steps.vars.outputs.zip-filename }}' -d '${{ steps.vars.outputs.xsd-cache-dir }}'
78+
echo "::group::Unzipping '${{ steps.vars.outputs.zip-filename }}'"
79+
unzip -o -qq '${{ steps.vars.outputs.zip-filename }}' -d '${{ steps.vars.outputs.version-xsd-cache-dir }}'
80+
echo "::endgroup::"
6981
82+
if [ -d '${{ steps.vars.outputs.version-xsd-cache-dir }}/fhir-all-xsd' ]; then
83+
echo "::group::Zip was created on MacOS, cleaning up..."
84+
85+
mv '${{ steps.vars.outputs.version-xsd-cache-dir }}/fhir-all-xsd'/* '${{ steps.vars.outputs.version-xsd-cache-dir }}'
86+
rmdir '${{ steps.vars.outputs.version-xsd-cache-dir }}/fhir-all-xsd'
87+
88+
echo "::endgroup::"
89+
fi
90+
91+
- name: 'List files'
92+
shell: bash -e {0}
93+
# language=sh
94+
run: |
95+
echo "::group::Listing files in '${{ steps.vars.outputs.cache-dir }}'"
7096
ls -l '${{ steps.vars.outputs.cache-dir}}'
71-
ls -l '${{ steps.vars.outputs.xsd-cache-dir }}'
97+
echo "::endgroup::"
98+
99+
echo "::group::Listing files in '${{ steps.vars.outputs.version-xsd-cache-dir }}'"
100+
ls -l '${{ steps.vars.outputs.version-xsd-cache-dir }}'
101+
echo "::endgroup::"

.github/workflows/tests.yaml

Lines changed: 60 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -26,110 +26,85 @@ on:
2626
- 'phpunit.xml'
2727

2828
jobs:
29+
builder-tests:
30+
runs-on: ubuntu-22.04
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
php-version:
35+
- '8.1'
36+
- '8.2'
37+
- '8.3'
38+
- '8.4'
39+
name: 'Builder Tests - PHP ${{ matrix.php-version }}'
40+
steps:
41+
- uses: actions/checkout@v4
42+
- name: 'Bootstrap'
43+
uses: ./.github/actions/bootstrap
44+
with:
45+
php-version: ${{ matrix.php-version }}
46+
- name: 'Run tests'
47+
# language=sh
48+
run: ./vendor/bin/phpunit -c 'phpunit/Builder.xml'
49+
2950
load-fhir-source:
30-
runs-on: ubuntu-latest
51+
runs-on: ubuntu-22.04
3152
strategy:
3253
fail-fast: true
3354
matrix:
34-
fhir-version: [ 'DSTU1', 'DSTU2', 'STU3', 'R4', 'R5' ]
35-
36-
name: 'Download ${{ matrix.fhir-version }} Source'
55+
test-target:
56+
- 'DSTU1'
57+
- 'DSTU2'
58+
- 'STU3'
59+
- 'R4'
60+
- 'R4B'
61+
- 'R5'
62+
name: 'Download ${{ matrix.test-target }} Source'
3763
steps:
3864
- uses: actions/checkout@v4
39-
4065
- uses: ./.github/actions/load-fhir-xsd
4166
with:
42-
version: '${{ matrix.fhir-version }}'
43-
44-
45-
# load-fhir-validator:
46-
# runs-on: ubuntu-22.04
47-
# name: 'Download FHIR Validator'
48-
# steps:
49-
# - uses: actions/checkout@v4
50-
#
51-
# - uses: ./.github/actions/load-fhir-validator
67+
version: '${{ matrix.test-target }}'
5268

5369
run:
5470
runs-on: ubuntu-22.04
5571
needs:
5672
- load-fhir-source
57-
# - load-fhir-validator
5873
strategy:
5974
fail-fast: false
6075
matrix:
61-
php-version: [ '8.1', '8.2', '8.3' ]
62-
fhir-version: [ 'DSTU1', 'DSTU2', 'STU3', 'R4', 'R5' ]
63-
include:
64-
- php-version: '8.1'
65-
phpunit-version: '10.5'
66-
- php-version: '8.2'
67-
phpunit-version: '11.1'
68-
- php-version: '8.3'
69-
phpunit-version: '11.1'
70-
name: '${{ matrix.fhir-version }} - PHP ${{ matrix.php-version }} - PHPUnit ${{ matrix.phpunit-version }}'
76+
php-version:
77+
- '8.1'
78+
- '8.2'
79+
- '8.3'
80+
- '8.4'
81+
test-target:
82+
- 'Core'
83+
- 'DSTU1'
84+
- 'DSTU2'
85+
- 'STU3'
86+
- 'R4'
87+
- 'R4B'
88+
- 'R5'
89+
name: '${{ matrix.test-target }} - PHP ${{ matrix.php-version }} - PHPUnit ${{ matrix.phpunit-version }}'
90+
services:
91+
php-fhir-test-server:
92+
image: dancarbone/php-fhir-test-server:latest
93+
ports:
94+
- '8080:8080'
7195
steps:
72-
- name: 'Check the stuff out'
73-
uses: actions/checkout@v4
74-
75-
- name: 'Load FHIR ${{ matrix.fhir-version }} Source'
76-
uses: ./.github/actions/load-fhir-xsd
77-
with:
78-
version: '${{ matrix.fhir-version }}'
79-
80-
# - name: 'Install FHIR validator'
81-
# uses: ./.github/actions/load-fhir-validator
82-
83-
- name: 'Install PHP'
84-
uses: shivammathur/setup-php@v2
85-
with:
86-
php-version: ${{ matrix.php-version }}
87-
extensions: libxml simplexml json zip
88-
ini-values: precision=20
89-
90-
- name: 'Install jq'
91-
uses: dcarbone/install-jq-action@v3
96+
- uses: actions/checkout@v4
97+
- name: 'Bootstrap'
98+
uses: ./.github/actions/bootstrap
9299
with:
93-
force: true
94-
95-
- name: 'Set Composer Dep Versions'
96-
# language=sh
97-
run: |
98-
tmpf="$(mktemp)"
99-
jq -rcM '."require-dev"."phpunit/phpunit" = "^${{ matrix.phpunit-version }}"' composer.json > "${tmpf}"
100-
mv "${tmpf}" composer.json
101-
102-
- name: 'Get Composer Cache Directory'
103-
id: composer-cache
104-
# language=sh
105-
run: |
106-
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
107-
108-
- name: 'Cache Composer Stuff'
109-
uses: actions/cache@v4
100+
php-version: ${{ matrix.php-version }}
101+
- name: 'Load FHIR ${{ matrix.test-target }} Source'
102+
id: fhir-source
103+
if: matrix.test-target != 'Core'
104+
uses: ./.github/actions/load-fhir-xsd
110105
with:
111-
path: ${{ steps.composer-cache.outputs.dir }}
112-
key: "composer-${{ runner.os }}-${{ matrix.php-version }}-${{ matrix.phpunit-version }}-${{ hashFiles('composer.lock') }}"
113-
save-always: true
114-
115-
- name: 'Install Composer deps'
116-
# language=sh
117-
run: |
118-
rm composer.lock
119-
composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
120-
121-
- name: 'Generate code'
122-
# language=sh
123-
run: |
124-
./bin/generate.sh --useExisting --versions '${{ matrix.fhir-version }}'
125-
126-
# - name: 'Install Java'
127-
# uses: actions/setup-java@v4
128-
# with:
129-
# distribution: 'zulu'
130-
# java-version: 18
131-
106+
version: '${{ matrix.test-target }}'
132107
- name: 'Run tests'
133108
# language=sh
134109
run: |
135-
./vendor/bin/phpunit -c 'phpunit/${{ matrix.fhir-version }}.xml'
110+
./vendor/bin/phpunit -c 'phpunit/${{ matrix.test-target }}.xml'

0 commit comments

Comments
 (0)