Skip to content

BFD-3323: Onboard NAVA Team #11611

BFD-3323: Onboard NAVA Team

BFD-3323: Onboard NAVA Team #11611

Workflow file for this run

name: 'CI - Java'
on:
pull_request:
merge_group:
env:
# workflow file matchers - workflow jobs will only run if matching files are found
# please see https://github.com/CMSgov/beneficiary-fhir-data/pull/773 for why we
# are using this workflow logic
# NOTE: I can't find anything in the spec that suggests that '\' is used as a string-continuation
# symbol. However, see the following StackOverflow post for an example:
# https://stackoverflow.com/questions/6268391/is-there-a-way-to-represent-a-long-string-that-doesnt-have-any-whitespace-on-mul
workflow_files_re: "(\
^apps/pom.xml|\
^apps/Dockerfile|\
^apps/bfd-|\
^ops/ansible/roles/bfd-db-migrator/|\
^ops/ansible/roles/bfd-pipeline/|\
^ops/ansible/roles/bfd-server/|\
^.github/workflows/ci-ansible.yml|\
^.github/workflows/ci-java.yml)"
jobs:
workflow:
name: Checking workflow
runs-on: ubuntu-20.04
outputs:
files: ${{ steps.workflow_files.outputs.files }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- id: workflow_files
name: Set output
run: |
echo "files<<EOF" >> $GITHUB_OUTPUT
echo "$(git diff --name-only --diff-filter=ACMRTD HEAD^ HEAD | grep -E '${{ env.workflow_files_re }}')" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
mvn-fmt-maven-plugin:
runs-on: ubuntu-20.04
needs: workflow
if: needs.workflow.outputs.files
steps:
- uses: actions/checkout@v4
- name: 'Setup JDK'
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
- name: 'Run maven ${{ matrix.mvn_commmand }}'
run: mvn com.spotify.fmt:fmt-maven-plugin:check
working-directory: ./apps
mvn-verify:
runs-on: ubuntu-20.04
needs: workflow
if: needs.workflow.outputs.files
steps:
- name: 'Checkout repo'
uses: actions/checkout@v4
- name: 'Setup JDK'
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
cache: 'maven'
- name: 'Run Maven Build'
run: mvn --threads 1C --quiet --batch-mode -Dmaven.build.cache.enabled=false -Dapidocgen.skip=false -DbfdOps.skip=false verify
working-directory: ./apps
# TODO: Conformance testing is currently missing from mvn-verify. BFD-3245 will re-examine conformance regression testing in BFD.
mvn-verify-system:
runs-on: ubuntu-20.04
needs: workflow
outputs:
BFD_PARENT_VERSION: ${{ steps.bfd-parent-version.outputs.BFD_PARENT_VERSION }}
if: needs.workflow.outputs.files
steps:
- name: 'Checkout repo'
uses: actions/checkout@v4
- name: 'Setup JDK'
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
cache: 'maven'
- name: 'Run Maven Build without Tests'
run: mvn --threads 1C --quiet --batch-mode -Dmaven.build.cache.enabled=false -DskipTests -DskipITs verify
working-directory: ./apps
- name: 'Install yq'
run: |
sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq
sudo chmod +x /usr/bin/yq
- name: Login to GitHub Container Registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" \
| docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Determine the BFD Parent Version
id: bfd-parent-version
run: |
echo "BFD_PARENT_VERSION=$(yq '.project.version' apps/pom.xml)" >> "$GITHUB_OUTPUT"
echo "BFD_PARENT_VERSION=$(yq '.project.version' apps/pom.xml)" >> "$GITHUB_ENV"
- name: Build and Deliver Apps Container Image
run: |
SANITIZED_REF="${GITHUB_REF_NAME////-}"
IMAGE_NAME="ghcr.io/cmsgov/bfd-apps"
SHORT_SHA="$(git rev-parse --short HEAD)"
FULL_BRANCH_TAG="${IMAGE_NAME}:${SANITIZED_REF}" # human readable, branch name tag
FULL_COMMIT_TAG="${IMAGE_NAME}:${SHORT_SHA}" # a short sha suffixed image tag
echo "Building ${BFD_PARENT_VERSION} Container"
docker build --tag "$FULL_BRANCH_TAG" --build-arg="BFD_VERSION=${BFD_PARENT_VERSION}" .
docker tag "$FULL_BRANCH_TAG" "$FULL_COMMIT_TAG"
docker push "$FULL_BRANCH_TAG"
docker push "$FULL_COMMIT_TAG"
working-directory: apps
# ansible system testing
ansible-role-bfd-pipeline:
needs: mvn-verify-system
uses: ./.github/workflows/ci-ansible.yml
with:
role: bfd-pipeline
bfd_version: ${{ needs.mvn-verify-system.outputs.BFD_PARENT_VERSION }}
ansible-role-bfd-server:
needs: mvn-verify-system
uses: ./.github/workflows/ci-ansible.yml
with:
role: bfd-server
bfd_version: ${{ needs.mvn-verify-system.outputs.BFD_PARENT_VERSION }}
ansible-role-bfd-db-migrator:
needs: mvn-verify-system
uses: ./.github/workflows/ci-ansible.yml
with:
role: bfd-db-migrator
bfd_version: ${{ needs.mvn-verify-system.outputs.BFD_PARENT_VERSION }}