Pull Request Pipeline #94
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pull Request Pipeline | |
on: | |
workflow_dispatch: | |
jobs: | |
build-cache: | |
name: Setup Cache | |
runs-on: ubuntu-latest | |
container: | |
image: maven:3.9-eclipse-temurin-21-jammy | |
timeout-minutes: 60 | |
env: # Define environment variables at the job level | |
MAVEN_CACHE_FOLDER: $HOME/.m2/repository # Ensure the cache folder is defined here | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: Build with Maven | |
env: | |
MAVEN_OPTS: '-Xmx1024m -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS -Duser.timezone=America/Toronto' | |
run: | | |
mvn install -P CI,CHECKSTYLE -Dmaven.test.skip=true -e -B \ | |
-Dmaven.repo.local=$MAVEN_CACHE_FOLDER \ | |
-Dmaven.javadoc.skip=true \ | |
-Dmaven.wagon.http.pool=false \ | |
-Dhttp.keepAlive=false \ | |
-Dstyle.color=always -Djansi.force=true | |
- name: Cache Maven repository | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.MAVEN_CACHE_FOLDER }} | |
key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }} | |
enableCrossOsArchive: true # Enable cross-runner cache | |
- name: Checkout repository | |
uses: actions/checkout@v4 # Ensure repository is checked out for local actions | |
# - name: Set up Java | |
# uses: actions/setup-java@v3 | |
# with: | |
# distribution: 'temurin' | |
# java-version: '11' | |
# - name: Install Docker | |
# shell: bash | |
# run: | | |
# curl -fsSL https://get.docker.com -o get-docker.sh | |
# sudo sh get-docker.sh | |
# docker --version | |
- name: Create and List Maven Cache Directory | |
shell: bash | |
run: | | |
mkdir -p $HOME/.m2/repository | |
pwd | |
ls -al $HOME/.m2/repository | |
env: | |
MAVEN_CACHE_FOLDER: $HOME/.m2/repository # Ensure MAVEN_CACHE_FOLDER is available in this step | |
- name: Restore Maven Cache | |
uses: actions/cache@v4 | |
with: | |
path: $HOME/.m2/repository # Update path to use $HOME | |
enableCrossOsArchive: true # Enable cross-runner cache | |
key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
maven-${{ runner.os }}- | |
- name: Verify cache was restored | |
shell: bash | |
run: | | |
if [ -d "$HOME/.m2/repository" ]; then | |
echo "Cache exists" | |
ls -R $HOME/.m2/repository | |
else | |
echo "Cache not found" | |
fi | |
- name: Build Maven Module | |
shell: bash | |
env: | |
MAVEN_CACHE_FOLDER: $HOME/.m2/repository # Update to use $HOME | |
MAVEN_OPTS: '-Xmx1024m -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS -Duser.timezone=America/Toronto' | |
run: | | |
mvn clean verify jacoco:report -pl hapi-fhir-converter \ | |
-P JACOCO,CI -e -B \ | |
-Dmaven.repo.local=$MAVEN_CACHE_FOLDER \ | |
-Dmaven.wagon.http.pool=false -Dhttp.keepAlive=false \ | |
-Dstyle.color=always -Djansi.force=true | |
# name: Pull Request Pipeline | |
# on: | |
# workflow_dispatch: | |
# jobs: | |
# # generate-module-list: | |
# # name: Generate List of Modules to Build | |
# # runs-on: ubuntu-latest | |
# # outputs: | |
# # modules_list: ${{ steps.format_modules.outputs.modules_list }} | |
# # steps: | |
# # - name: Checkout repository | |
# # uses: actions/checkout@v4 | |
# # - name: Generate Modules List | |
# # id: generate_list | |
# # uses: ./.github/actions/generate-module-list | |
# # with: | |
# # ignored_modules: 'hapi-fhir-bom,hapi-deployable-pom,...' | |
# # - name: Print generated modules | |
# # run: | | |
# # echo "Modules list generated:" | |
# # echo "${{ steps.generate_list.outputs.modules_list }}" | tr ',' '\n' | |
# # - name: Format Modules List as JSON Array | |
# # id: format_modules | |
# # run: | | |
# # echo "modules_list=$(echo '${{ steps.generate_list.outputs.modules_list }}' | jq -R -s -c 'split(",")')" >> $GITHUB_OUTPUT | |
# build-cache: | |
# name: Setup Cache | |
# runs-on: ubuntu-latest | |
# container: | |
# image: maven:3.9-eclipse-temurin-21-jammy | |
# timeout-minutes: 60 | |
# env: # Define environment variables at the job level | |
# MAVEN_CACHE_FOLDER: $HOME/.m2/repository # Ensure the cache folder is defined here | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v4 | |
# - name: Setup JDK 17 | |
# uses: actions/setup-java@v4 | |
# with: | |
# distribution: "temurin" | |
# java-version: "17" | |
# - name: Build with Maven | |
# env: | |
# # JAVA_HOME_11_X64: /opt/java/openjdk | |
# # MAVEN_CACHE_FOLDER: /root/.m2/repository | |
# MAVEN_OPTS: '-Xmx1024m -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS -Duser.timezone=America/Toronto' | |
# run: | | |
# mvn install -P CI,CHECKSTYLE -Dmaven.test.skip=true -e -B \ | |
# -Dmaven.repo.local=$MAVEN_CACHE_FOLDER \ | |
# -Dmaven.javadoc.skip=true \ | |
# -Dmaven.wagon.http.pool=false \ | |
# -Dhttp.keepAlive=false \ | |
# -Dstyle.color=always -Djansi.force=true | |
# - name: Cache Maven repository | |
# uses: actions/cache@v4 | |
# with: | |
# path: ${{ env.MAVEN_CACHE_FOLDER }} | |
# key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }} | |
# enableCrossOsArchive: true # Enable cross-runner cache | |
# build-modules: | |
# name: Build Modules | |
# runs-on: ubuntu-latest | |
# # needs: | |
# # # - generate-module-list | |
# # - build-cache | |
# # strategy: | |
# # matrix: | |
# # # module: ${{ fromJSON(needs.generate-module-list.outputs.modules_list) }} | |
# # module: [ "hapi-fhir-converter","hapi-fhir-validation","hapi-fhir-structures-dstu2" ] | |
# # max-parallel: 256 | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v4 # Ensure repository is checked out for local actions | |
# # - name: Build Modules | |
# # uses: ./.github/actions/build-module | |
# # with: | |
# # name: ${{ github.event.pull_request.head.ref }} # refers to the branch from which the pull request was created | |
# # module: ${{ matrix.module }} | |
# - name: Set up Java | |
# uses: actions/setup-java@v3 | |
# with: | |
# distribution: 'temurin' | |
# java-version: '11' | |
# - name: Install Docker | |
# shell: bash | |
# run: | | |
# curl -fsSL https://get.docker.com -o get-docker.sh | |
# sudo sh get-docker.sh | |
# docker --version | |
# - name: Create and List Maven Cache Directory | |
# shell: bash | |
# run: | | |
# mkdir -p $HOME/.m2/repository | |
# pwd | |
# ls -al $HOME/.m2/repository | |
# env: | |
# MAVEN_CACHE_FOLDER: $HOME/.m2/repository # Ensure MAVEN_CACHE_FOLDER is available in this step | |
# - name: Restore Maven Cache | |
# uses: actions/cache@v4 | |
# with: | |
# path: $HOME/.m2/repository # Update path to use $HOME | |
# enableCrossOsArchive: true # Enable cross-runner cache | |
# key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }} | |
# # restore-keys: | | |
# # maven-${{ runner.os }}- | |
# - name: Verify cache was restored | |
# shell: bash | |
# run: | | |
# if [ -d "$HOME/.m2/repository" ]; then | |
# echo "Cache exists" | |
# ls -R $HOME/.m2/repository | |
# else | |
# echo "Cache not found" | |
# fi | |
# - name: Build Maven Module | |
# shell: bash | |
# env: | |
# MAVEN_CACHE_FOLDER: $HOME/.m2/repository # Update to use $HOME | |
# MAVEN_OPTS: '-Xmx1024m -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS -Duser.timezone=America/Toronto' | |
# run: | | |
# mvn clean verify jacoco:report -pl hapi-fhir-converter \ | |
# -P JACOCO,CI -e -B \ | |
# -Dmaven.repo.local=$MAVEN_CACHE_FOLDER \ | |
# -Dmaven.wagon.http.pool=false -Dhttp.keepAlive=false \ | |
# -Dstyle.color=always -Djansi.force=true | |