Merge pull request #9 from rzliau/kq

merge .yml file to the most updated one
This commit is contained in:
Chan Koon Qi 2023-09-07 15:46:53 +08:00 committed by GitHub
commit b8ab561cf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 67 additions and 18 deletions

View file

@ -2,24 +2,65 @@ name: Build and Test
on:
push:
branches: [main]
branches:
- "*" # Trigger on all branches
pull_request:
branches: [main] # Trigger on pull requests to the 'main' branch
jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-latest # Use the latest version of Ubuntu as the runner
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2 # Checkout your repository's code
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- name: Set up JDK 17
uses: actions/setup-java@v2 # Set up Java Development Kit (JDK) version 17
with:
java-version: "17"
distribution: "adopt"
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Run tests with Maven
run: mvn -B test --file pom.xml
- name: Build with Maven
run: mvn -B package --file pom.xml
# Build your project using Maven in non-interactive mode and specify the POM file.
- name: Run tests with Maven
run: mvn -B test --file pom.xml
# Run tests using Maven in non-interactive mode and specify the POM file.
# Store build artifacts for history
- name: Archive Build Artifacts
uses: actions/upload-artifact@v2 # Upload build artifacts to the workflow
with:
name: build-artifacts # Name for the uploaded artifacts
path: target/ # Path to the build artifacts (typically 'target/' for Maven)
# Static Code Analysis with Checkstyle
- name: Static Code Analysis with Checkstyle
run: |
# Install and run Checkstyle
mvn org.apache.maven.plugins:maven-checkstyle-plugin:3.1.1:checkstyle
# Run Checkstyle using Maven.
mvn checkstyle:check
# Store static code analysis reports
- name: Archive Static Code Analysis Reports
uses: actions/upload-artifact@v2
with:
name: static-code-analysis-reports
path: target/checkstyle-result.xml # Path to the Checkstyle report.
# Code Coverage
- name: Code Coverage
run: |
# Run JaCoCo report generation
mvn jacoco:report
# Store code coverage reports
- name: Archive Code Coverage Reports
uses: actions/upload-artifact@v2
with:
name: code-coverage-reports
path: target/site/jacoco/ # Path to the code coverage report.

18
pom.xml
View file

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.samples</groupId>
<artifactId>spring-petclinic</artifactId>
@ -33,6 +35,7 @@
<nohttp-checkstyle.version>0.0.11</nohttp-checkstyle.version>
<spring-format.version>0.0.39</spring-format.version>
</properties>
<dependencies>
@ -166,7 +169,8 @@
<configuration>
<rules>
<requireJavaVersion>
<message>This build requires at least Java ${java.version}, update your JVM, and run the build again</message>
<message>This build requires at least Java ${java.version}, update your JVM, and
run the build again</message>
<version>${java.version}</version>
</requireJavaVersion>
</rules>
@ -191,6 +195,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle.version}</version>
<configuration>
<failOnViolation>false</failOnViolation>
</configuration>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
@ -370,7 +377,8 @@
<configuration>
<inputPath>${basedir}/src/main/scss/</inputPath>
<outputPath>${basedir}/src/main/resources/static/resources/css/</outputPath>
<includePath>${project.build.directory}/webjars/META-INF/resources/webjars/bootstrap/${webjars-bootstrap.version}/scss/</includePath>
<includePath>
${project.build.directory}/webjars/META-INF/resources/webjars/bootstrap/${webjars-bootstrap.version}/scss/</includePath>
</configuration>
</plugin>
</plugins>
@ -408,7 +416,7 @@
<ignore />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecution>ˇˇ
<pluginExecutionFilter>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
@ -444,4 +452,4 @@
</profile>
</profiles>
</project>
</project>