Skip to content

Commit 9b13b14

Browse files
committed
maven build with ci
1 parent 348acb7 commit 9b13b14

15 files changed

Lines changed: 194 additions & 407 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: build and test on pull request
2+
on:
3+
pull_request:
4+
branches: [main]
5+
jobs:
6+
build-and-test:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v5
10+
- name: Malware Scanner # https://github.com/dell/common-github-actions/blob/main/malware-scanner/README.md
11+
uses: dell/common-github-actions/malware-scanner@main
12+
with:
13+
directories: .
14+
options: -ri
15+
- name: Set up JDK 21 for x64
16+
uses: actions/setup-java@v4
17+
with:
18+
java-version: "21"
19+
distribution: "temurin"
20+
architecture: x64
21+
- run: mvn package -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: build and test on release
2+
on:
3+
push:
4+
tags:
5+
- "*"
6+
jobs:
7+
build-and-release:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v5
11+
- name: Set up JDK 21 for x64
12+
uses: actions/setup-java@v4
13+
with:
14+
java-version: "21"
15+
distribution: "temurin"
16+
architecture: x64
17+
- run: mvn package -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true
18+
- name: "upload release assets"
19+
uses: softprops/action-gh-release@cd28b0f5ee8571b76cfdaa62a30d51d752317477 #https://github.com/softprops/action-gh-release/issues/216
20+
if: github.ref_type == 'tag'
21+
with:
22+
body: |
23+
:closed_book: File 1 of 1 uploaded: java-xml-grepper.jar
24+
files: |
25+
target/java-xml-grepper.jar
26+
append_body: true

.github/workflows/scan-malware.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: scan-malware
2+
on:
3+
pull_request:
4+
branches: [main]
5+
jobs:
6+
scan-malware:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v5
10+
- name: Malware Scanner # https://github.com/dell/common-github-actions/blob/main/malware-scanner/README.md
11+
uses: dell/common-github-actions/malware-scanner@main
12+
with:
13+
directories: .
14+
options: -ri

.github/workflows/scan-semgrep.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: scan-semgrep
2+
on:
3+
pull_request: {}
4+
workflow_dispatch: {}
5+
merge_group:
6+
types: [checks_requested]
7+
jobs:
8+
scan-semgrep:
9+
name: semgrep/ci
10+
runs-on: ubuntu-latest
11+
container:
12+
image: semgrep/semgrep
13+
# Skip any PR created by dependabot and any check triggered by merge group
14+
if: (github.actor != 'dependabot[bot]') && (github.event != 'merge_group')
15+
steps:
16+
- uses: actions/checkout@v4
17+
- run: semgrep ci
18+
env:
19+
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}

BUILD

Lines changed: 0 additions & 38 deletions
This file was deleted.

WORKSPACE

Lines changed: 0 additions & 78 deletions
This file was deleted.

deprecated_pom.xml

Lines changed: 0 additions & 70 deletions
This file was deleted.

pom.xml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>io.codeclou</groupId>
6+
<artifactId>java-xml-grepper</artifactId>
7+
<version>1.1.0</version>
8+
<organization>
9+
<name>codeclou.io</name>
10+
<url>http://codeclou.io/</url>
11+
</organization>
12+
<licenses>
13+
<license>
14+
<name>MIT</name>
15+
<url>https://github.com/codeclou/java-xml-grepper/blob/main/LICENSE</url>
16+
</license>
17+
</licenses>
18+
<name>java-xml-grepper</name>
19+
<description>java-xml-grepper</description>
20+
<packaging>jar</packaging>
21+
<dependencies>
22+
<dependency>
23+
<groupId>commons-cli</groupId>
24+
<artifactId>commons-cli</artifactId>
25+
<version>1.11.0</version>
26+
<scope>compile</scope>
27+
</dependency>
28+
<dependency>
29+
<groupId>org.junit.jupiter</groupId>
30+
<artifactId>junit-jupiter-engine</artifactId>
31+
<version>5.11.0-M2</version>
32+
<scope>test</scope>
33+
</dependency>
34+
<dependency>
35+
<groupId>commons-io</groupId>
36+
<artifactId>commons-io</artifactId>
37+
<version>2.21.0</version>
38+
<scope>test</scope>
39+
</dependency>
40+
<dependency>
41+
<groupId>com.openpojo</groupId>
42+
<artifactId>openpojo</artifactId>
43+
<version>0.9.1</version>
44+
<scope>test</scope>
45+
</dependency>
46+
</dependencies>
47+
<build>
48+
<plugins>
49+
<plugin>
50+
<groupId>org.apache.maven.plugins</groupId>
51+
<artifactId>maven-surefire-plugin</artifactId>
52+
<configuration>
53+
<forkCount>0</forkCount>
54+
<reuseForks>true</reuseForks>
55+
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
56+
</configuration>
57+
</plugin>
58+
<plugin>
59+
<groupId>org.openclover</groupId>
60+
<artifactId>clover-maven-plugin</artifactId>
61+
<version>4.5.2</version>
62+
</plugin>
63+
<plugin>
64+
<artifactId>maven-assembly-plugin</artifactId>
65+
<version>3.1.0</version>
66+
<configuration>
67+
<finalName>java-xml-grepper</finalName>
68+
<archive>
69+
<manifest>
70+
<mainClass>io.codeclou.java.xml.grepper.Main</mainClass>
71+
</manifest>
72+
</archive>
73+
<descriptorRefs>
74+
<descriptorRef>jar-with-dependencies</descriptorRef>
75+
</descriptorRefs>
76+
<appendAssemblyId>false</appendAssemblyId>
77+
</configuration>
78+
<executions>
79+
<execution>
80+
<id>make-assembly</id>
81+
<phase>package</phase>
82+
<goals>
83+
<goal>single</goal>
84+
</goals>
85+
</execution>
86+
</executions>
87+
</plugin>
88+
</plugins>
89+
</build>
90+
<properties>
91+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
92+
<maven.compiler.source>21</maven.compiler.source>
93+
<maven.compiler.target>21</maven.compiler.target>
94+
</properties>
95+
</project>

src/main/java/io/codeclou/java/xml/grepper/Main.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public class Main {
2727

2828
public static void main(String [] args) throws Exception {
2929
XmlGrepper xmlGrepper = new XmlGrepper();
30-
xmlGrepper.run(args);
30+
Boolean hasErrors = xmlGrepper.run(args);
31+
System.exit(hasErrors ? 1 : 0);
3132
}
3233

3334
}

0 commit comments

Comments
 (0)