Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BFD-3244: Improve Common GitHub Actions Workflows #2174

Merged
merged 5 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-ansible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
image_tag: ${{ inputs.image_tag }}
steps:
- name: 'Checkout repo'
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: 'Run Tests for ${{ inputs.role }} Role'
run: |
export IMAGE_TAG="${image_tag:-$(git rev-parse --short HEAD)}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-base-container-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" \
Expand Down
105 changes: 34 additions & 71 deletions .github/workflows/ci-java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
files: ${{ steps.workflow_files.outputs.files }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2
- id: workflow_files
Expand All @@ -43,9 +43,9 @@ jobs:
needs: workflow
if: needs.workflow.outputs.files
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: 'Setup JDK'
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
Expand All @@ -56,22 +56,43 @@ jobs:
mvn-verify:
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@v3
uses: actions/checkout@v4
- name: 'Setup JDK'
uses: actions/setup-java@v3
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 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
Expand Down Expand Up @@ -102,82 +123,24 @@ jobs:
docker push "$FULL_COMMIT_TAG"
working-directory: apps

# NOTE: Temporarily disable fhir-validation in support of BFD-2198
# TODO: Re-enable post BFD-2198 with more thoughtful implementation
# fhir-validate:
# runs-on: ubuntu-20.04
# steps:
# - name: 'Checkout repo'
# uses: actions/checkout@v3
# - name: 'Create local branch references'
# # Check out the branches to build references for use in the next step
# run: git fetch && git checkout master && git checkout $GITHUB_HEAD_REF
# - name: 'Set up Python'
# if: steps.run_check.outputs.skip == 'false'
# uses: actions/setup-python@v3
# with:
# python-version: '3.10.5'
# - name: 'Check for new/modified resources'
# id: run_check
# # Checks if there are any modified resources in the endpoint responses
# # grep returns non-zero exit code when no matches are found, so only skip if the condition fails
# run: |
# can_skip=$(if [[ $(python3 ops/fhir_validations/diff_check.py) ]]; then echo "true"; else echo "false"; fi)
# if [[ $can_skip == 'true' ]]; then echo "No modified resources found, skipping rest of job."; else echo "Found modified resources, validating..."; fi
# echo ::set-output name=skip::$can_skip
# - name: 'Install Python dependencies'
# if: steps.run_check.outputs.skip == 'false'
# run: |
# python -m pip install --upgrade pip
# pip install -r ops/fhir_validations/requirements.txt
# - name: 'Set up JDK'
# if: steps.run_check.outputs.skip == 'false'
# uses: actions/setup-java@v1
# with:
# java-version: '11'
# - name: 'Download FHIR validator'
# if: steps.run_check.outputs.skip == 'false'
# uses: wei/wget@v1
# with:
# #TODO: Pinning to 5.6.68 due to bug in latest release, re-evaluate later.
# args: https://github.com/hapifhir/org.hl7.fhir.core/releases/download/5.6.68/validator_cli.jar
# - name: 'Verify FHIR resource'
# id: validate_fhir
# if: steps.run_check.outputs.skip == 'false'
# run: |
# is_valid="false"
# if output=$(python3 ops/fhir_validations/validations.py -r) ; then is_valid="true" ; fi
# echo "$output"
# output=$([[ $output =~ .*(Results:[^$'\n']*).* ]] && echo "${BASH_REMATCH[1]}")
# echo ::set-output name=valid::$is_valid
# echo ::set-output name=output::$output
# - name: 'Job Outcome'
# if: steps.run_check.outputs.skip == 'false'
# run: |
# is_valid="${{ steps.validate_fhir.outputs.valid }}"
# output="${{ steps.validate_fhir.outputs.output }}"
# echo "$output" >> $GITHUB_STEP_SUMMARY
# printf "$output\n"
# if [ "$is_valid" = "false" ] ; then exit 1 ; fi

# ansible system testing
ansible-role-bfd-pipeline:
needs: mvn-verify
needs: mvn-verify-system
uses: ./.github/workflows/ci-ansible.yml
with:
role: bfd-pipeline
bfd_version: ${{ needs.mvn-verify.outputs.BFD_PARENT_VERSION }}
bfd_version: ${{ needs.mvn-verify-system.outputs.BFD_PARENT_VERSION }}

ansible-role-bfd-server:
needs: mvn-verify
needs: mvn-verify-system
uses: ./.github/workflows/ci-ansible.yml
with:
role: bfd-server
bfd_version: ${{ needs.mvn-verify.outputs.BFD_PARENT_VERSION }}
bfd_version: ${{ needs.mvn-verify-system.outputs.BFD_PARENT_VERSION }}

ansible-role-bfd-db-migrator:
needs: mvn-verify
needs: mvn-verify-system
uses: ./.github/workflows/ci-ansible.yml
with:
role: bfd-db-migrator
bfd_version: ${{ needs.mvn-verify.outputs.BFD_PARENT_VERSION }}
bfd_version: ${{ needs.mvn-verify-system.outputs.BFD_PARENT_VERSION }}
4 changes: 2 additions & 2 deletions .github/workflows/ci-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
working-directory: ${{ matrix.project.directory }}
steps:
- name: 'Checkout repo'
uses: actions/checkout@v3
uses: actions/checkout@v4

# Try to use cache from this or ancestor branches.
# Also sets a hook that will cache this build after the job is complete.
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
working-directory: ${{ matrix.project.directory }}
steps:
- name: 'Checkout repo'
uses: actions/checkout@v3
uses: actions/checkout@v4

# Try to use cache from this or ancestor branches.
# Also sets a hook that will cache this build after the job is complete.
Expand Down
Loading