From 601dc1f2f7386ca6ddd151ea7260d570bef4f669 Mon Sep 17 00:00:00 2001 From: nhkhai Date: Wed, 20 Mar 2024 10:55:13 +0800 Subject: [PATCH 01/11] Update CI.yml Added generation of the HTML test report. Fixed syntax. --- .github/workflows/CI.yml | 43 ++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4b801a8..1bcb628 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,58 +1,63 @@ -# This workflow will build a Java Spring Boot Application with Maven, and run test cases. +# This workflow will build a Java Spring Boot Application with Maven then run test cases. name: Build and Test Java Spring Boot Application on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] jobs: - run-unit-tests: + build-and-run-tests: runs-on: ubuntu-latest services: postgres: - image: postgres:latest - + 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. + + # 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. + # Maps the TCP port 5432 on the service container to the host. - 5432:5432 steps: - name: Pull repository uses: actions/checkout@v4.1.2 - + - name: Set up JDK uses: actions/setup-java@v4.2.1 with: - java-version: '21' - distribution: 'temurin' - # cache: maven # Uncomment and configure if needed. - + java-version: "21" + distribution: "temurin" + # Uncomment and configure if needed. + # cache: maven + - 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: Generate HTML test report + run: mvn surefire-report:report + + # Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive (Optional). # - 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. - + # Skip tests since they were already run. + run: mvn package -DskipTests + - name: Save Jar file uses: actions/upload-artifact@v4.3.1 with: From 2298983eaa49bbbdb87d8b70b68e02a3a4e5d156 Mon Sep 17 00:00:00 2001 From: nhkhai Date: Wed, 20 Mar 2024 10:57:19 +0800 Subject: [PATCH 02/11] Update CI.yml Downgraded the Java JDK version to match the project. --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1bcb628..07e7d36 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -39,7 +39,7 @@ jobs: - name: Set up JDK uses: actions/setup-java@v4.2.1 with: - java-version: "21" + java-version: "17" distribution: "temurin" # Uncomment and configure if needed. # cache: maven From 9c3a5bad3578fb4b6ff6510a2b34533635dfdcf4 Mon Sep 17 00:00:00 2001 From: nhkhai Date: Wed, 20 Mar 2024 11:00:32 +0800 Subject: [PATCH 03/11] Update pom.xml Fixed the formatting syntax. --- pom.xml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 1305c5c..4f23c01 100644 --- a/pom.xml +++ b/pom.xml @@ -1,12 +1,13 @@ - 4.0.0 org.springframework.boot spring-boot-starter-parent 3.2.3 - + sg.com.smartinventory smart-inventory @@ -21,7 +22,6 @@ org.springframework.boot spring-boot-starter-web - org.springframework.boot spring-boot-starter-data-jpa @@ -30,7 +30,6 @@ org.springframework.boot spring-boot-starter-validation -