Skip to content

chore(build): enable cross compilation plugin for Java 17 #1027

chore(build): enable cross compilation plugin for Java 17

chore(build): enable cross compilation plugin for Java 17 #1027

Workflow file for this run

name: PR Build
on: [ pull_request ]
env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Xmx2g -Xms2g
CONTAINER_REGISTRY: us-docker.pkg.dev/spinnaker-community/docker
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: actions/setup-java@v4
with:
java-version: |
11
17
distribution: 'zulu'
cache: 'gradle'
- name: Prepare build variables
id: build_variables
run: |
echo REPO="${GITHUB_REPOSITORY##*/}" >> $GITHUB_OUTPUT
echo VERSION="$(git describe --tags --abbrev=0 --match='v[0-9]*' | cut -c2-)-dev-pr-$(git rev-parse --short HEAD)-$(date --utc +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT
- name: Build
env:
ORG_GRADLE_PROJECT_version: ${{ steps.build_variables.outputs.VERSION }}
run: ./gradlew -PenableCrossCompilerPlugin=true build ${{ steps.build_variables.outputs.REPO }}-web:installDist
- name: Build slim container image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.slim
platforms: linux/amd64,linux/arm64
tags: |
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:latest"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:latest-slim"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-slim"
- name: Build ubuntu container image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.ubuntu
platforms: linux/amd64,linux/arm64
tags: |
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:latest-ubuntu"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-ubuntu"
- name: Build slim JRE 11 container image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.java11.slim
platforms: linux/amd64,linux/arm64
tags: |
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:latest-java11"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:latest-java11-slim"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-slim"
- name: Build ubuntu JRE 11 container image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.java11.ubuntu
platforms: linux/amd64,linux/arm64
tags: |
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:latest-java11-ubuntu"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-ubuntu"
- name: Build local slim container image for testing
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.slim
load: true
platforms: local
tags: |
"${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}"
- name: Test local slim container image
env:
FULL_DOCKER_IMAGE_NAME: "${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}"
run: ./gradlew ${{ steps.build_variables.outputs.REPO }}-integration:test