This repository contains a GitHub Actions workflow designed to automate the deployment of a HAPI FHIR server, load Implementation Guides (IGs) and test data, and build/push a Docker image.
The workflow is defined in .github/workflows/main.yml
and is triggered by:
push
events on themain
branch.pull_request
events on themain
branch.workflow_dispatch
events (manual triggering).
The workflow now reads configuration values from a config.properties
file located in the root of the repository. This file is used to set environment variables for the workflow.
The workflow consists of the following key steps:
- Checkout code: Checks out the repository code.
- Set up JDK: Sets up the specified Java Development Kit (JDK) version.
- Load Configuration: Reads the
config.properties
file and sets environment variables. - Build and Push Docker Image:
- This step is executed only on
push
events to themain
branch. - It builds a Docker image from the
Dockerfile
in the repository. - The image is tagged with the Git SHA and pushed to Docker Hub.
- Optionally, it also tags and pushes the image with the
latest
tag.
- This step is executed only on
- Start HAPI FHIR Server:
- Pulls the latest HAPI FHIR Docker image.
- Runs the HAPI FHIR server in a Docker container.
- Wait for HAPI FHIR Server to start: Waits until the HAPI FHIR server is ready to accept connections.
- Setup .NET SDK: Sets up the .NET SDK.
- Install UploadFIG: Installs the
UploadFIG
tool globally. - Debug Environment Variables: Prints the values of key environment variables for debugging.
- Upload IG using UploadFIG: Uploads the Implementation Guide to the HAPI FHIR server using the
UploadFIG
tool. - Clone Test Data: Clones the repository containing the test data.
- Load Test Data:
- Downloads the latest Linux executable of the TestDataClient from the releases in the
au-fhir-test-data-utils
repository. - Loads the test data into the HAPI FHIR server using the
TestDataClient
tool.
- Downloads the latest Linux executable of the TestDataClient from the releases in the
- Verify Test Data Loaded: Verifies that the test data was loaded successfully (e.g., by querying the server for a specific resource type).
The workflow uses the following environment variables, which are now loaded from the config.properties
file:
HAPI_VERSION
: The version of the HAPI FHIR server.IG_REPO
: The GitHub repository containing the Implementation Guide.TEST_DATA_REPO
: The GitHub repository containing the test data.UPLOADFIG_CONFIG
: Path to the UploadFIG configuration file.IG_PACKAGE_ID
: The IG Package ID.IG_PACKAGE_VERSION
: The IG Package Version.HAPI_SERVER
: The URL of the HAPI FHIR server.TERM_SERVER
: The URL of the terminology server.
The workflow builds and pushes a Docker image to Docker Hub (or your specified registry) when code is pushed to the main
branch. The image is tagged with the Git SHA of the commit.
To use this workflow:
- Ensure you have a
Dockerfile
in your repository. - Create a
config.properties
file in the root of your repository and populate it with the necessary configuration values. - Commit the
config.properties
file to your repository.
This project is licensed under the CC0 1.0 Universal license.
To view a copy of this license, visit: