editted build.yml and pom.xml

This commit is contained in:
KoonQi 2023-09-06 00:30:39 +08:00
parent 714bc57b29
commit 484fdc2344
2 changed files with 55 additions and 46 deletions

View file

@ -3,59 +3,60 @@ name: Build and Test
on: on:
push: push:
branches: branches:
- '*' - "*"
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Set up JDK 17 - name: Set up JDK 17
uses: actions/setup-java@v2 uses: actions/setup-java@v2
with: with:
java-version: '17' java-version: "17"
distribution: 'adopt' distribution: "adopt"
- name: Build with Maven - name: Build with Maven
run: mvn clean package run: mvn clean package
- name: Run tests with Maven - name: Run tests with Maven
run: mvn test run: mvn test
# Store build artifacts for history # Store build artifacts for history
- name: Archive Build Artifacts - name: Archive Build Artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: build-artifacts name: build-artifacts
path: target/ path: target/
# Static Code Analysis with Checkstyle (Replace with your preferred tool) # Static Code Analysis with Checkstyle
- name: Static Code Analysis - name: Static Code Analysis with Checkstyle
run: | run: |
# Install and run Checkstyle (replace with your tool) # Install and run Checkstyle
# Example: mvn checkstyle:check mvn org.apache.maven.plugins:maven-checkstyle-plugin:3.1.1:checkstyle
echo "Run your static code analysis tool here"
# Store static code analysis reports # Run Checkstyle
- name: Archive Static Code Analysis Reports mvn checkstyle:check
uses: actions/upload-artifact@v2
with:
name: static-code-analysis-reports
path: path/to/static/code/analysis/reports
# Code Coverage (Replace with your preferred tool) # Store static code analysis reports
- name: Code Coverage - name: Archive Static Code Analysis Reports
run: | uses: actions/upload-artifact@v2
# Run your code coverage tool here with:
# Example: mvn jacoco:report name: static-code-analysis-reports
echo "Run your code coverage tool here" path: .github/workflows/reports/checkstyle/
# Store code coverage reports # Code Coverage
- name: Archive Code Coverage Reports - name: Code Coverage
uses: actions/upload-artifact@v2 run: |
with: # Run JaCoCo report generation
name: code-coverage-reports mvn jacoco:report
path: path/to/code/coverage/reports
# Store code coverage reports
- name: Archive Code Coverage Reports
uses: actions/upload-artifact@v2
with:
name: code-coverage-reports
path: .github/workflows/reports/jacoco/

16
pom.xml
View file

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?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> <modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.samples</groupId> <groupId>org.springframework.samples</groupId>
<artifactId>spring-petclinic</artifactId> <artifactId>spring-petclinic</artifactId>
@ -33,6 +35,10 @@
<nohttp-checkstyle.version>0.0.11</nohttp-checkstyle.version> <nohttp-checkstyle.version>0.0.11</nohttp-checkstyle.version>
<spring-format.version>0.0.39</spring-format.version> <spring-format.version>0.0.39</spring-format.version>
<!-- ... other properties ... -->
<testcontainers.version>1.16.3</testcontainers.version>
</properties> </properties>
<dependencies> <dependencies>
@ -166,7 +172,8 @@
<configuration> <configuration>
<rules> <rules>
<requireJavaVersion> <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> <version>${java.version}</version>
</requireJavaVersion> </requireJavaVersion>
</rules> </rules>
@ -370,7 +377,8 @@
<configuration> <configuration>
<inputPath>${basedir}/src/main/scss/</inputPath> <inputPath>${basedir}/src/main/scss/</inputPath>
<outputPath>${basedir}/src/main/resources/static/resources/css/</outputPath> <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> </configuration>
</plugin> </plugin>
</plugins> </plugins>
@ -444,4 +452,4 @@
</profile> </profile>
</profiles> </profiles>
</project> </project>