Skip to content

Commit

Permalink
workflow to build and push updated docker images (#3168)
Browse files Browse the repository at this point in the history
* issue #1412 - workflow to build and push updated docker images

Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>

* issue #1412 - skip the failing spl test for historic builds

Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>

* allow rebuild workflow to be invoked manually

Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>

* skip the sonatype release step

Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
  • Loading branch information
lmsurpre committed Jan 13, 2022
1 parent f2ea68c commit bd6d6fc
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 4 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/rebuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Rebuild

on:
schedule:
# 7am (UTC) each day
# '*' is a special character in YAML so you have to quote this string
- cron: '0 7 * * *'
# allows the workflow to be manually executed any time
workflow_dispatch:

jobs:
image-refresh:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '11' ]
tag: [ '4.9.2', '4.10.2' ]
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
ref: refs/tags/${{ matrix.tag }}
- name: Setup java
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Build and Release
env:
BASE: origin/${{ github['base_ref'] }}
GITHUB_TOKEN: ${{ secrets.DOCS_SITE_TOKEN }}
GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }}
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_KEYNAME: ${{ secrets.GPG_KEYNAME }}
GPG_KEY_FILE: ${{ secrets.GPG_KEY_FILE }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OLD_JAVA_HOME: /opt/hostedtoolcache/AdoptOpenJDK/1.0.0-ga-11-jdk-hotspot-linux-x64-normal-latest/x64/
run: |
. build/release/global.sh
bash build/release/00_prep.sh
bash build/release/10_build.sh
bash build/release/20_test.sh
# go straight to the dockerhub release instead of calling 30_release.sh
# which uploads the build artifacts to Sonatype OSSRH in the tag release workflow
bash build/release/bin/30_release/1_dockerhub.sh
bash build/release/40_drop.sh
24 changes: 20 additions & 4 deletions build/release/bin/20_test/1_code_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,39 @@
set -eu -o pipefail

###############################################################################
# (C) Copyright IBM Corp. 2020, 2021
# (C) Copyright IBM Corp. 2020, 2022
#
# SPDX-License-Identifier: Apache-2.0
###############################################################################

# verify and generate code coverage jacoco.exec and xml files

# helper method for generating the comma-separated list of tests to run / exclude
tests(){
# tests to skip to ensure we can rebuild older images
TESTS_TO_SKIP_ARR=(
# the SPL IG has a time-sensitive constraint that causes validation failures in 4.10.2 and prior
com.ibm.fhir.ig.us.spl.ExamplesValidationTest
)

# convert TESTS_TO_SKIP_ARR to a comma-delimited string of negated tests on a single line
delim='!'
for test in ${TESTS_TO_SKIP_ARR}; do
echo -n \'${delim}${test}\'
delim=',!'
done
}

# fhir-tools
export BUILD_PROFILES=" $(jq -r '.build[] | select(.type == "fhir-tools").profiles | map(.) | join(",")' build/release/config/release.json)"
mvn -T2C test org.jacoco:jacoco-maven-plugin:0.8.6:report-aggregate -f fhir-tools
mvn -T2C test org.jacoco:jacoco-maven-plugin:0.8.7:report-aggregate -f fhir-tools

# fhir-examples
export BUILD_PROFILES=" $(jq -r '.build[] | select(.type == "fhir-examples").profiles | map(.) | join(",")' build/release/config/release.json)"
mvn -T2C test org.jacoco:jacoco-maven-plugin:0.8.6:report-aggregate -f fhir-examples
mvn -T2C test org.jacoco:jacoco-maven-plugin:0.8.7:report-aggregate -f fhir-examples

# fhir-parent
export BUILD_PROFILES=" $(jq -r '.build[] | select(.type == "fhir-parent").profiles | map(.) | join(",")' build/release/config/release.json)"
mvn -T2C test org.jacoco:jacoco-maven-plugin:0.8.6:report-aggregate -f fhir-parent -P "${BUILD_PROFILES}"
mvn -T2C test org.jacoco:jacoco-maven-plugin:0.8.7:report-aggregate -f fhir-parent -P "${BUILD_PROFILES}" -Dtest=$(tests)

# EOF

0 comments on commit bd6d6fc

Please sign in to comment.