Skip to content

Commit

Permalink
Create execution testing pipeline (#718)
Browse files Browse the repository at this point in the history
* Refactor template file names, add exec pipeline

* Fix naming in exec job params

* Try resources elsewhere

* Try explicit checkout

* Try resources again in main pipeline

* Try using bash to git clone

* Adjust task inputs

* Aim at target ig

* Install jekyll

* Try another way to do jekyll install

* Try gem install another way

* Try jekyll install with new setup

* Name tasks, add fsh-sushi install

* Move git repo to a parameter

* substitution fix

* Try some fsh, maybe you'll like it
  • Loading branch information
dotasek committed Jul 4, 2023
1 parent c8f7b59 commit e0f1fd7
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 5 deletions.
64 changes: 64 additions & 0 deletions build-and-exec-jobs-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
jobs:
- ${{ each execTest in parameters.execTests }}:
- job:

displayName: ${{execTest.displayName}}

pool:
vmImage: ${{execTest.vmImage}}


variables:
currentImage: ${{execTest.vmImage}}
VERSION:
JAVA_TOOL_OPTIONS: ${{execTest.javaToolOptions}}

steps:

- task: UseRubyVersion@0
inputs:
versionSpec: '>= 3.0'

- script: |
gem install jekyll bundler
bundle init
bundle update --bundler
bundle install --retry=3 --jobs=4
displayName: 'jekyll install'
- script: |
npm install -g fsh-sushi
displayName: 'fsh-sushi install'
# Runs 'mvn clean package'
- task: Maven@3
displayName: 'Build project'
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
options: '-DskipTests'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '${{execTest.jdkVersion}}'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'package'

- task: Bash@3
displayName: 'Clone target IG'
inputs:
targetType: 'inline'
script: mkdir -p $(Pipeline.Workspace)/target-ig; git clone ${{execTest.gitRepo}} $(Pipeline.Workspace)/target-ig

- task: Maven@3
displayName: 'Run IG Publisher with IG'
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '${{execTest.jdkVersion}}'
jdkArchitectureOption: 'x64'
options: '-pl org.hl7.fhir.publisher.cli -Dpublisher.cli.exec.target-ig="$(Pipeline.Workspace)/target-ig"'
publishJUnitResults: false
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'org.codehaus.mojo:exec-maven-plugin:exec@target-ig-cli'
File renamed without changes.
28 changes: 25 additions & 3 deletions org.hl7.fhir.publisher.cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

<artifactId>org.hl7.fhir.publisher.cli</artifactId>



<dependencies>
<dependency>
<groupId>org.hl7.fhir.publisher</groupId>
Expand Down Expand Up @@ -122,20 +124,40 @@
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<!-- This is the default execution (only prints out help) -->
<!-- Usage: mvn exec:exec -pl org.hl7.fhir.publisher.cli -->
<execution>
<id>default-cli</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<async>true</async>
<asyncDestroyOnShutdown>true</asyncDestroyOnShutdown>
<executable>${env.JAVA_HOME}/bin/java</executable>

<workingDirectory>/tmp</workingDirectory>
<arguments>
<argument>-jar</argument>
<argument>${basedir}/target/org.hl7.fhir.publisher.cli-${project.version}.jar</argument>
</arguments>
</configuration>
</execution>
<!-- This executes the publisher for a specified IG -->
<!-- Usage: mvn org.codehaus.mojo:exec-maven-plugin:exec@target-ig-cli -pl org.hl7.fhir.publisher.cli -Dpublisher.cli.exec.target-ig="/path/to/my/ig/" -->
<execution>
<id>target-ig-cli</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${env.JAVA_HOME}/bin/java</executable>

<!-- optional -->
<workingDirectory>/tmp</workingDirectory>
<arguments>
<argument>-jar</argument>
<argument>${basedir}/target/org.hl7.fhir.publisher.cli-${project.version}.jar</argument>
<argument>-ig</argument>
<argument>${publisher.cli.exec.target-ig}</argument>
</arguments>
</configuration>
</execution>
Expand Down
15 changes: 13 additions & 2 deletions pull-request-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pr:
# Different users have different machine setups, we run the build three times, on ubuntu, osx, and windows.
# Azure doesn't always have the same Java versions on each system, so they are enumerated for each system independently.
jobs:
- template: pull-request-pipeline-parameterized.yml
- template: build-and-test-jobs-template.yml
parameters:
images:
# This image is here so that at least one job specifically sets Cp1252 file encodings, which are normally set by the JDK (which Azure can change on each latest image)
Expand All @@ -27,4 +27,15 @@ jobs:
- displayName: windows-latest-java-11
vmImage: windows-latest
jdkVersion: 1.11
javaToolOptions:
javaToolOptions:
- template: build-and-exec-jobs-template.yml
parameters:
execTests:
- displayName: fhir-tools-ig-exec
vmImage: ubuntu-latest
jdkVersion: 1.11
gitRepo: https://github.com/FHIR/fhir-tools-ig.git
- displayName: ACME-FSH-IG-Example
vmImage: ubuntu-latest
jdkVersion: 1.11
gitRepo: https://github.com/FirelyTeam/ACME-FSH-IG-Example.git

0 comments on commit e0f1fd7

Please sign in to comment.