Skip to content

Merge pull request #4 from nhkhai/main #3

Merge pull request #4 from nhkhai/main

Merge pull request #4 from nhkhai/main #3

Workflow file for this run

# This workflow will build a Java Spring Boot Application with Maven, and run test cases.
name: Build and Test Java Spring Boot Application
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
run-unit-tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
# POSTGRES_PASSWORD: postgres
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_DB: smart_inventory
# Set health checks to wait until postgres has started.
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host.
- 5432:5432
steps:
- name: Pull repository
uses: actions/[email protected]
- name: Set up JDK
uses: actions/[email protected]
with:
java-version: '21'
distribution: 'temurin'
# cache: maven # Uncomment and configure if needed.
- name: Run unit tests
run: mvn test
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive.
# - name: Update dependency graph
# uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
- name: Build Jar file
run: mvn package -DskipTests # Skip tests since they were already run.
- name: Save Jar file
uses: actions/[email protected]
with:
name: smart-inventory-0.0.1-SNAPSHOT
path: target/smart-inventory-0.0.1-SNAPSHOT.jar
retention-days: 1