Skip to content

Commit

Permalink
Update pull-request.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
markiantorno committed Sep 19, 2024
1 parent 6c23039 commit ca68fad
Showing 1 changed file with 160 additions and 57 deletions.
217 changes: 160 additions & 57 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,14 @@ 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
env:
MAVEN_CACHE_FOLDER: $HOME/.m2/repository

steps:
- name: Checkout code
Expand All @@ -52,8 +25,6 @@ jobs:

- 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 \
Expand All @@ -68,32 +39,14 @@ jobs:
with:
path: ${{ env.MAVEN_CACHE_FOLDER }}
key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
enableCrossOsArchive: true # Enable cross-runner cache
enableCrossOsArchive: true

build-modules:
name: Build Modules
needs: build-cache # Ensure this job runs after build-cache
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:
Expand All @@ -114,16 +67,14 @@ jobs:
pwd
ls -al $HOME/.m2/repository
env:
MAVEN_CACHE_FOLDER: $HOME/.m2/repository # Ensure MAVEN_CACHE_FOLDER is available in this step
MAVEN_CACHE_FOLDER: $HOME/.m2/repository

- name: Restore Maven Cache
uses: actions/cache@v4
with:
path: $HOME/.m2/repository # Update path to use $HOME
enableCrossOsArchive: true # Enable cross-runner cache
path: ${{ env.MAVEN_CACHE_FOLDER }}
key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
# restore-keys: |
# maven-${{ runner.os }}-
enableCrossOsArchive: true

- name: Verify cache was restored
shell: bash
Expand All @@ -138,14 +89,166 @@ jobs:
- name: Build Maven Module
shell: bash
env:
MAVEN_CACHE_FOLDER: $HOME/.m2/repository # Update to use $HOME
MAVEN_CACHE_FOLDER: $HOME/.m2/repository
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



Expand Down

0 comments on commit ca68fad

Please sign in to comment.