add unit test step in gradle ci #6881
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and publish native (GraalVM) images | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*.*.*' | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build_native_docker_image: | |
name: Build and publish the native (GraalVM) Docker image | |
runs-on: ubuntu-24.04 | |
env: | |
DOCKER_IMAGE_NAME: '${{ github.repository_owner }}/jhipster-lite-native' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: ${{ env.DOCKER_IMAGE_NAME }} | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'oracle' | |
java-version: '21' | |
check-latest: false | |
- name: Cache local Maven repository | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Build application with Buildpacks | |
run: | | |
./mvnw -Pnative -DskipTests clean spring-boot:build-image -Dspring-boot.build-image.imageName=${{ env.DOCKER_IMAGE_NAME }} -Ddevelocity.cache.remote.enabled=false | |
- name: Test native image | |
working-directory: tests-ci | |
run: ./start_docker_container.sh ${{ env.DOCKER_IMAGE_NAME }} | |
- name: Login to Docker Registry | |
if: startsWith(github.ref, 'refs/tags/v') | |
env: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
uses: docker/[email protected] | |
id: login-hub | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Tag the native (GraalVM) Docker image and push it | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
docker tag ${{ env.DOCKER_IMAGE_NAME }} ${{ env.DOCKER_IMAGE_NAME }}:latest | |
docker tag ${{ env.DOCKER_IMAGE_NAME }} ${{ env.DOCKER_IMAGE_NAME }}:${{ github.ref_name }} | |
docker push --all-tags ${{ env.DOCKER_IMAGE_NAME }} |