Skip to content

Commit 5fa687f

Browse files
authored
Merge pull request #40 from seriouszyx/dev
feat: switch travis-ci to GitHub Actions CI and setup semantic-release
2 parents b7e2d4c + 59dde16 commit 5fa687f

File tree

4 files changed

+193
-43
lines changed

4 files changed

+193
-43
lines changed

.github/workflows/maven-ci.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
services:
9+
mysql:
10+
image: mysql
11+
env:
12+
MYSQL_ROOT_PASSWORD: casbin_test
13+
MYSQL_DATABASE: casbin
14+
MYSQL_USER: casbin_test
15+
MYSQL_PASSWORD: TEST_casbin
16+
ports:
17+
- 3306:3306
18+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
19+
postgres:
20+
image: postgres
21+
env:
22+
POSTGRES_DB: casbin
23+
POSTGRES_USER: casbin_test
24+
POSTGRES_PASSWORD: TEST_casbin
25+
ports:
26+
- 5432:5432
27+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
28+
sqlserver:
29+
image: mcr.microsoft.com/mssql/server:2019-latest
30+
env:
31+
SA_PASSWORD: 9G3iqmzQDw9zCXII
32+
ACCEPT_EULA: Y
33+
ports:
34+
- 1433:1433
35+
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v2
39+
with:
40+
fetch-depth: '0'
41+
42+
- name: Install mssql-tools
43+
run: |
44+
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
45+
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
46+
sudo apt-get update
47+
sudo apt-get install mssql-tools unixodbc-dev
48+
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
49+
50+
- name: Create database for sqlserver
51+
run: sqlcmd -S 127.0.0.1,1433 -U sa -P '9G3iqmzQDw9zCXII' -Q "CREATE DATABASE casbin"
52+
53+
- name: Set up JDK 1.8
54+
uses: actions/setup-java@v1
55+
with:
56+
java-version: 1.8
57+
server-id: ossrh
58+
server-username: OSSRH_JIRA_USERNAME
59+
server-password: OSSRH_JIRA_PASSWORD
60+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
61+
gpg-passphrase: GPG_PASSPHRASE
62+
63+
- name: Build with Maven
64+
run: mvn clean test cobertura:cobertura
65+
66+
- name: Codecov
67+
uses: codecov/codecov-action@v1
68+
with:
69+
token: ${{ secrets.CODECOV_TOKEN }}
70+
71+
- name: Set up Node.js
72+
uses: actions/setup-node@v2
73+
with:
74+
node-version: 16
75+
76+
- name: Sematic Release
77+
run: |
78+
npm install -g @conveyal/maven-semantic-release semantic-release
79+
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
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
83+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
84+
OSSRH_JIRA_USERNAME: ${{ secrets.OSSRH_JIRA_USERNAME }}
85+
OSSRH_JIRA_PASSWORD: ${{ secrets.OSSRH_JIRA_PASSWORD }}

.travis.yml

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

pom.xml

Lines changed: 105 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818
<url>https://github.com/jcasbin/jdbc-adapter/issues</url>
1919
</issueManagement>
2020

21-
<ciManagement>
22-
<system>Travis CI</system>
23-
<url>https://travis-ci.com/jcasbin/jdbc-adapter</url>
24-
</ciManagement>
25-
2621
<parent>
2722
<groupId>org.sonatype.oss</groupId>
2823
<artifactId>oss-parent</artifactId>
@@ -52,8 +47,40 @@
5247
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5348
</properties>
5449

50+
<distributionManagement>
51+
<snapshotRepository>
52+
<id>ossrh</id>
53+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
54+
</snapshotRepository>
55+
<repository>
56+
<id>ossrh</id>
57+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
58+
</repository>
59+
</distributionManagement>
60+
5561
<build>
5662
<plugins>
63+
<plugin>
64+
<groupId>org.apache.maven.plugins</groupId>
65+
<artifactId>maven-gpg-plugin</artifactId>
66+
<version>1.5</version>
67+
<executions>
68+
<execution>
69+
<id>sign-artifacts</id>
70+
<phase>verify</phase>
71+
<goals>
72+
<goal>sign</goal>
73+
</goals>
74+
</execution>
75+
</executions>
76+
<configuration>
77+
<!-- Prevent gpg from using pinentry programs -->
78+
<gpgArguments>
79+
<arg>--pinentry-mode</arg>
80+
<arg>loopback</arg>
81+
</gpgArguments>
82+
</configuration>
83+
</plugin>
5784
<plugin>
5885
<groupId>org.eluder.coveralls</groupId>
5986
<artifactId>coveralls-maven-plugin</artifactId>
@@ -72,12 +99,83 @@
7299
</execution>
73100
</executions>
74101
</plugin>
102+
<plugin>
103+
<!-- Allow attaching Javadoc during releases -->
104+
<groupId>org.apache.maven.plugins</groupId>
105+
<artifactId>maven-javadoc-plugin</artifactId>
106+
<version>2.10.4</version>
107+
<configuration>
108+
<source>11</source>
109+
<detectJavaApiLink>false</detectJavaApiLink>
110+
<!-- Turn off Java 8 strict Javadoc checking -->
111+
<additionalparam>-Xdoclint:none</additionalparam>
112+
<tags>
113+
<tag>
114+
<name>notnull</name>
115+
<placement>a</placement>
116+
<head>Not null</head>
117+
</tag>
118+
<tag>
119+
<name>default</name>
120+
<placement>a</placement>
121+
<head>Default:</head>
122+
</tag>
123+
</tags>
124+
</configuration>
125+
<executions>
126+
<!-- Compress Javadoc into JAR and include that JAR when deploying. -->
127+
<execution>
128+
<id>attach-javadocs</id>
129+
<goals>
130+
<goal>jar</goal>
131+
</goals>
132+
</execution>
133+
</executions>
134+
</plugin>
135+
<plugin>
136+
<!-- Include zipped source code in releases -->
137+
<groupId>org.apache.maven.plugins</groupId>
138+
<artifactId>maven-source-plugin</artifactId>
139+
<executions>
140+
<execution>
141+
<id>attach-sources</id>
142+
<goals>
143+
<goal>jar-no-fork</goal>
144+
</goals>
145+
</execution>
146+
</executions>
147+
</plugin>
148+
<plugin>
149+
<!-- Automatically close and deploy from OSSRH -->
150+
<groupId>org.sonatype.plugins</groupId>
151+
<artifactId>nexus-staging-maven-plugin</artifactId>
152+
<version>1.6.7</version>
153+
<extensions>true</extensions>
154+
<configuration>
155+
<serverId>ossrh</serverId>
156+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
157+
<!-- Release versions will be synced to Maven Central automatically. -->
158+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
159+
</configuration>
160+
</plugin>
75161
<plugin>
76162
<groupId>org.apache.maven.plugins</groupId>
77163
<artifactId>maven-compiler-plugin</artifactId>
78164
<configuration>
79-
<source>8</source>
80-
<target>8</target>
165+
<source>1.8</source>
166+
<target>1.8</target>
167+
</configuration>
168+
</plugin>
169+
<plugin>
170+
<groupId>org.codehaus.mojo</groupId>
171+
<artifactId>cobertura-maven-plugin</artifactId>
172+
<version>2.7</version>
173+
<configuration>
174+
<formats>
175+
<format>html</format>
176+
<format>xml</format>
177+
</formats>
178+
<check />
81179
</configuration>
82180
</plugin>
83181
</plugins>

src/test/java/org/casbin/adapter/AdapterCreator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public interface AdapterCreator {
2626
}
2727

2828
class MySQLAdapterCreator implements AdapterCreator {
29-
private String url = "jdbc:mysql://localhost:3306/casbin?serverTimezone=GMT%2B8";
29+
private String url = "jdbc:mysql://127.0.0.1:3306/casbin?serverTimezone=GMT%2B8&useSSL=false&allowPublicKeyRetrieval=true";
3030
private String username = "casbin_test";
3131
private String password = "TEST_casbin";
3232
private String driver = "com.mysql.cj.jdbc.Driver";
@@ -71,8 +71,8 @@ public JDBCAdapter createViaDataSource() throws Exception {
7171

7272
class PgAdapterCreator implements AdapterCreator {
7373
private String url = "jdbc:postgresql://localhost:5432/casbin";
74-
private String username = "postgres";
75-
private String password = "";
74+
private String username = "casbin_test";
75+
private String password = "TEST_casbin";
7676
private String driver = "org.postgresql.Driver";
7777

7878
@Override

0 commit comments

Comments
 (0)