Skip to content

Commit 2ddda6b

Browse files
authored
feat: improve pom.xml, CI scripts (#7)
1 parent 65f0575 commit 2ddda6b

File tree

3 files changed

+240
-1
lines changed

3 files changed

+240
-1
lines changed

.github/workflows/maven-ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
with:
13+
fetch-depth: '0'
14+
15+
- name: Start MongoDB
16+
uses: supercharge/[email protected]
17+
with:
18+
mongodb-version: 4.2
19+
20+
- name: Set up JDK 1.8
21+
uses: actions/setup-java@v1
22+
with:
23+
java-version: 1.8
24+
server-id: ossrh
25+
server-username: OSSRH_JIRA_USERNAME
26+
server-password: OSSRH_JIRA_PASSWORD
27+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
28+
gpg-passphrase: GPG_PASSPHRASE
29+
30+
- name: Build with Maven
31+
run: mvn clean test cobertura:cobertura
32+
33+
- name: Codecov
34+
uses: codecov/codecov-action@v1
35+
with:
36+
token: ${{ secrets.CODECOV_TOKEN }}
37+
38+
- name: Set up Node.js
39+
uses: actions/setup-node@v2
40+
with:
41+
node-version: 20
42+
43+
- name: Semantic Release
44+
run: |
45+
npm install -g @conveyal/maven-semantic-release semantic-release
46+
semantic-release --prepare @conveyal/maven-semantic-release --publish @semantic-release/github,@conveyal/maven-semantic-release --verify-conditions @semantic-release/github,@conveyal/maven-semantic-release --verify-release @conveyal/maven-semantic-release
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
50+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
51+
OSSRH_JIRA_USERNAME: ${{ secrets.OSSRH_JIRA_USERNAME }}
52+
OSSRH_JIRA_PASSWORD: ${{ secrets.OSSRH_JIRA_PASSWORD }}

maven-settings.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<settings>
2+
<servers>
3+
<server>
4+
<id>ossrh</id>
5+
<username>${OSSRH_JIRA_USERNAME}</username>
6+
<password>${OSSRH_JIRA_PASSWORD}</password>
7+
</server>
8+
</servers>
9+
<profiles>
10+
<profile>
11+
<id>ossrh</id>
12+
<activation>
13+
<activeByDefault>true</activeByDefault>
14+
</activation>
15+
<properties>
16+
<gpg.executable>gpg</gpg.executable>
17+
<gpg.keyname>${GPG_KEY_NAME}</gpg.keyname>
18+
<gpg.passphrase>${GPG_PASSPHRASE}</gpg.passphrase>
19+
</properties>
20+
</profile>
21+
</profiles>
22+
</settings>

pom.xml

Lines changed: 166 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,179 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

7-
<groupId>org.jim</groupId>
7+
<groupId>org.casbin</groupId>
88
<artifactId>jcasbin-mongo-adapter</artifactId>
99
<version>1.0-SNAPSHOT</version>
1010

11+
<name>Mongo Adapter for JCasbin</name>
12+
<description>Load policy from Mongo supported database or save policy to it</description>
13+
<url>https://github.com/jcasbin/jcasbin-mongo-adapter</url>
14+
<inceptionYear>2018</inceptionYear>
15+
16+
<issueManagement>
17+
<system>Github</system>
18+
<url>https://github.com/jcasbin/jcasbin-mongo-adapter/issues</url>
19+
</issueManagement>
20+
21+
<parent>
22+
<groupId>org.sonatype.oss</groupId>
23+
<artifactId>oss-parent</artifactId>
24+
<version>7</version>
25+
</parent>
26+
<licenses>
27+
<license>
28+
<name>The Apache Software License, Version 2.0</name>
29+
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
30+
<distribution>repo</distribution>
31+
</license>
32+
</licenses>
33+
<scm>
34+
<url>https://github.com/jcasbin/jcasbin-mongo-adapter</url>
35+
<connection>[email protected]:jcasbin/jcasbin-mongo-adapter.git</connection>
36+
<developerConnection>https://github.com/hsluoyz</developerConnection>
37+
</scm>
38+
<developers>
39+
<developer>
40+
<name>Yang Luo</name>
41+
<email>[email protected]</email>
42+
<url>https://github.com/hsluoyz</url>
43+
</developer>
44+
</developers>
45+
1146
<properties>
47+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1248
<maven.compiler.source>8</maven.compiler.source>
1349
<maven.compiler.target>8</maven.compiler.target>
1450
</properties>
51+
52+
<distributionManagement>
53+
<snapshotRepository>
54+
<id>ossrh</id>
55+
<url>https://central.sonatype.com</url>
56+
</snapshotRepository>
57+
</distributionManagement>
58+
59+
<build>
60+
<plugins>
61+
<plugin>
62+
<groupId>org.apache.maven.plugins</groupId>
63+
<artifactId>maven-gpg-plugin</artifactId>
64+
<version>1.5</version>
65+
<executions>
66+
<execution>
67+
<id>sign-artifacts</id>
68+
<phase>verify</phase>
69+
<goals>
70+
<goal>sign</goal>
71+
</goals>
72+
</execution>
73+
</executions>
74+
<configuration>
75+
<!-- Prevent gpg from using pinentry programs -->
76+
<gpgArguments>
77+
<arg>--pinentry-mode</arg>
78+
<arg>loopback</arg>
79+
</gpgArguments>
80+
</configuration>
81+
</plugin>
82+
<plugin>
83+
<groupId>org.eluder.coveralls</groupId>
84+
<artifactId>coveralls-maven-plugin</artifactId>
85+
<version>4.3.0</version>
86+
</plugin>
87+
<plugin>
88+
<groupId>org.jacoco</groupId>
89+
<artifactId>jacoco-maven-plugin</artifactId>
90+
<version>0.7.6.201602180812</version>
91+
<executions>
92+
<execution>
93+
<id>prepare-agent</id>
94+
<goals>
95+
<goal>prepare-agent</goal>
96+
</goals>
97+
</execution>
98+
</executions>
99+
</plugin>
100+
<plugin>
101+
<!-- Allow attaching Javadoc during releases -->
102+
<groupId>org.apache.maven.plugins</groupId>
103+
<artifactId>maven-javadoc-plugin</artifactId>
104+
<version>2.10.4</version>
105+
<configuration>
106+
<source>11</source>
107+
<detectJavaApiLink>false</detectJavaApiLink>
108+
<!-- Turn off Java 8 strict Javadoc checking -->
109+
<additionalparam>-Xdoclint:none</additionalparam>
110+
<tags>
111+
<tag>
112+
<name>notnull</name>
113+
<placement>a</placement>
114+
<head>Not null</head>
115+
</tag>
116+
<tag>
117+
<name>default</name>
118+
<placement>a</placement>
119+
<head>Default:</head>
120+
</tag>
121+
</tags>
122+
</configuration>
123+
<executions>
124+
<!-- Compress Javadoc into JAR and include that JAR when deploying. -->
125+
<execution>
126+
<id>attach-javadocs</id>
127+
<goals>
128+
<goal>jar</goal>
129+
</goals>
130+
</execution>
131+
</executions>
132+
</plugin>
133+
<plugin>
134+
<!-- Include zipped source code in releases -->
135+
<groupId>org.apache.maven.plugins</groupId>
136+
<artifactId>maven-source-plugin</artifactId>
137+
<executions>
138+
<execution>
139+
<id>attach-sources</id>
140+
<goals>
141+
<goal>jar-no-fork</goal>
142+
</goals>
143+
</execution>
144+
</executions>
145+
</plugin>
146+
<plugin>
147+
<!-- Automatically close and deploy from OSSRH -->
148+
<groupId>org.sonatype.central</groupId>
149+
<artifactId>central-publishing-maven-plugin</artifactId>
150+
<version>0.5.0</version>
151+
<extensions>true</extensions>
152+
<configuration>
153+
<publishingServerId>ossrh</publishingServerId>
154+
<!-- Release versions will be synced to Maven Central automatically. -->
155+
<autoPublish>true</autoPublish>
156+
</configuration>
157+
</plugin>
158+
<plugin>
159+
<groupId>org.apache.maven.plugins</groupId>
160+
<artifactId>maven-compiler-plugin</artifactId>
161+
<configuration>
162+
<source>1.8</source>
163+
<target>1.8</target>
164+
</configuration>
165+
</plugin>
166+
<plugin>
167+
<groupId>org.codehaus.mojo</groupId>
168+
<artifactId>cobertura-maven-plugin</artifactId>
169+
<version>2.7</version>
170+
<configuration>
171+
<formats>
172+
<format>html</format>
173+
<format>xml</format>
174+
</formats>
175+
<check />
176+
</configuration>
177+
</plugin>
178+
</plugins>
179+
</build>
15180
<dependencies>
16181
<dependency>
17182
<groupId>org.projectlombok</groupId>

0 commit comments

Comments
 (0)