Skip to content

Build

Build #882

Workflow file for this run

name: Build
on:
workflow_call:
inputs:
push:
type: boolean
default: false
force-deploy:
type: boolean
default: false
outputs:
version:
value: ${{ jobs.build-gradle.outputs.version }}
workflow_dispatch:
inputs:
push:
description: Push images
type: boolean
default: false
force-deploy:
description: Force re-tagging and deployment of images
type: boolean
default: false
env:
push: ${{ !(github.event_name == 'push' && github.ref_name != 'main') && inputs.push }}
jobs:
build-gradle:
name: Gradle build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project:
- accredited-programmes-and-oasys
- approved-premises-and-delius
- approved-premises-and-oasys
- arns-and-delius
- assessment-summary-and-delius
- cas2-and-delius
- cas3-and-delius
- core-person-record-and-delius
- court-case-and-delius
- create-and-vary-a-licence-and-delius
- custody-key-dates-and-delius
- domain-events-and-delius
- dps-and-delius
- effective-proposal-framework-and-delius
- external-api-and-delius
- hdc-licences-and-delius
- hmpps-auth-and-delius
- make-recall-decisions-and-delius
- manage-offences-and-delius
- manage-pom-cases-and-delius
- manage-supervision-and-delius
- manage-supervision-and-oasys
- oasys-and-delius
- offender-events-and-delius
- opd-and-delius
- pathfinder-and-delius
- pre-sentence-reports-to-delius
- prison-case-notes-to-probation
- prison-custody-status-to-delius
- prison-education-and-delius
- prison-identifier-and-delius
- prisoner-profile-and-delius
- probation-search-and-delius
- refer-and-monitor-and-delius
- resettlement-passport-and-delius
- risk-assessment-scores-to-delius
- sentence-plan-and-delius
- sentence-plan-and-oasys
- soc-and-delius
- tier-to-delius
- unpaid-work-and-delius
- workforce-allocations-to-delius
- subject-access-requests-and-delius
- common-platform-and-delius
- ims-and-delius
# ^ add new projects here
# GitHub Actions doesn't support dynamic choices, we must add each project here to enable manual deployments
# See https://github.com/community/community/discussions/11795
outputs:
version: ${{ steps.version.outputs.version }}
changes: ${{ steps.check-changes.outputs.changes }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- uses: gradle/actions/setup-gradle@v4
- name: Set version
id: version
run: |
version=$(date '+%Y-%m-%d').${{ github.run_number }}.$(echo ${{ github.sha }} | cut -c1-7)
echo "ORG_GRADLE_PROJECT_version=$version" | tee -a "$GITHUB_ENV"
echo "version=$version" | tee -a "$GITHUB_OUTPUT"
- name: Build and test
run: ./gradlew ${{ matrix.project }}:check
env:
SPRING_PROFILES_ACTIVE: oracle
- name: Push images
if: env.push == 'true'
run: ./gradlew ${{ matrix.project }}:jib
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_PASSWORD: ${{ github.token }}
FORCE_DEPLOY: ${{ inputs.force-deploy }}
- name: Check changes
id: check-changes
run: echo "changes=$(find changed -mindepth 1 -maxdepth 1 -printf "%f\n" | jq -R . | jq -s -c '. // []')" | tee -a "$GITHUB_OUTPUT"
- name: Output changes
run: echo '${{ steps.check-changes.outputs.changes }}' > ${{ matrix.project }}-changes.json
- name: Store changes
uses: actions/upload-artifact@v4
with:
name: changes-${{ matrix.project }}
path: ${{ matrix.project }}-changes.json
- uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.project }}
path: |
**/build/jacoco
**/build/reports/jacoco/**/*.xml
**/build/test-results
build-docker:
name: Docker build
runs-on: ubuntu-latest
strategy:
matrix:
project:
- person-search-index-from-delius
- redrive-dead-letter-queues
- feature-flags
steps:
- uses: actions/checkout@v4
- name: Set version
id: version
run: |
version=$(date '+%Y-%m-%d').${{ github.run_number }}.$(echo ${{ github.sha }} | cut -c1-7)
echo "version=$version" | tee -a "$GITHUB_OUTPUT"
- name: Build Docker images
uses: ./.github/actions/docker-build
id: build
with:
project: ${{ matrix.project }}
push: ${{ env.push }}
version: ${{ steps.version.outputs.version }}
force-deploy: ${{ inputs.force-deploy }}
- name: Output changes
run: echo '${{ steps.build.outputs.changes }}' > ${{ matrix.project }}-changes.json
- name: Store changes
uses: actions/upload-artifact@v4
with:
name: changes-${{ matrix.project }}
path: ${{ matrix.project }}-changes.json