Skip to content

Commit a82fc5c

Browse files
authored
Merge pull request #92 from hazendaz/master
Board github actions and fix issue with license hader problem
2 parents ff15c13 + 52742b0 commit a82fc5c

File tree

9 files changed

+196
-37
lines changed

9 files changed

+196
-37
lines changed

.github/workflows/ci.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#
2+
# Copyright 2015-2020 the original author or authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
name: Java CI
18+
19+
on: [push, pull_request]
20+
21+
jobs:
22+
test:
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
matrix:
26+
os: [ubuntu-latest, macOS-latest, windows-latest]
27+
java: [8, 11, 15, 16-ea]
28+
fail-fast: false
29+
max-parallel: 4
30+
name: Test JDK ${{ matrix.java }}, ${{ matrix.os }}
31+
32+
steps:
33+
- uses: actions/checkout@v2
34+
- name: Set up JDK
35+
uses: actions/setup-java@v1
36+
with:
37+
java-version: ${{ matrix.java }}
38+
- name: Test with Maven
39+
run: ./mvnw test -B -D"license.skip=true"

.github/workflows/sonar.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#
2+
# Copyright 2015-2020 the original author or authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
name: SonarCloud
18+
19+
on:
20+
push:
21+
branches:
22+
- master
23+
24+
jobs:
25+
build:
26+
if: github.repository_owner == 'mybatis'
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v2
30+
with:
31+
# Disabling shallow clone is recommended for improving relevancy of reporting
32+
fetch-depth: 0
33+
- name: Set up JDK
34+
uses: actions/setup-java@v1
35+
with:
36+
java-version: 11
37+
- name: Analyze with SonarCloud
38+
run: ./mvnw verify sonar:sonar -B -Dsonar.projectKey=mybatis_freemarker-scripting -Dsonar.organization=mybatis -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN -Dlicense.skip=true
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/sonatype.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#
2+
# Copyright 2015-2020 the original author or authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
name: Sonatype
18+
19+
on:
20+
push:
21+
branches:
22+
- master
23+
24+
jobs:
25+
build:
26+
if: github.repository_owner == 'mybatis'
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v2
30+
- name: Set up JDK
31+
uses: actions/setup-java@v1
32+
with:
33+
java-version: 11
34+
- name: Deploy to Sonatype
35+
run: ./mvnw deploy -DskipTests -B --settings ./.mvn/settings.xml -Dlicense.skip=true
36+
env:
37+
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
38+
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}

.mvn/extensions.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Copyright 2015-2020 the original author or authors.
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
18+
-->
19+
<extensions>
20+
<extension>
21+
<groupId>fr.jcgay.maven</groupId>
22+
<artifactId>maven-profiler</artifactId>
23+
<version>3.0</version>
24+
</extension>
25+
</extensions>

travis/settings.xml renamed to .mvn/settings.xml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright 2015-2016 the original author or authors.
4+
Copyright 2015-2020 the original author or authors.
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -26,8 +26,11 @@
2626
</server>
2727
<server>
2828
<id>gh-pages</id>
29-
<username>git</username>
30-
<password>${env.CI_SITE_PASSWORD}</password>
29+
</server>
30+
<server>
31+
<id>github</id>
32+
<username>${env.CI_DEPLOY_USERNAME}</username>
33+
<password>${env.GITHUB_TOKEN}</password>
3134
</server>
3235
</servers>
3336
</settings>

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
language: java
22

33
jdk:
4-
- openjdk16
5-
- openjdk15
6-
- openjdk11
74
- openjdk8
85

96
after_success:

pom.xml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,38 @@
110110
</dependency>
111111
</dependencies>
112112

113+
<!-- Due to bug in package handling on formatter/impsort/license plugins, skip the 'DefaultPackageNameMapper' as it ends up adding duplicate headers. -->
114+
<build>
115+
<pluginManagement>
116+
<plugins>
117+
<plugin>
118+
<groupId>net.revelc.code.formatter</groupId>
119+
<artifactId>formatter-maven-plugin</artifactId>
120+
<configuration>
121+
<excludes combine.children="append">
122+
<exclude>**/DefaultPackageNameMapper.java</exclude>
123+
</excludes>
124+
</configuration>
125+
</plugin>
126+
<plugin>
127+
<groupId>net.revelc.code</groupId>
128+
<artifactId>impsort-maven-plugin</artifactId>
129+
<configuration>
130+
<excludes combine.children="append">
131+
<exclude>**/DefaultPackageNameMapper.java</exclude>
132+
</excludes>
133+
</configuration>
134+
</plugin>
135+
<plugin>
136+
<groupId>com.mycila</groupId>
137+
<artifactId>license-maven-plugin</artifactId>
138+
<configuration>
139+
<excludes combine.children="append">
140+
<exclude>**/DefaultPackageNameMapper.java</exclude>
141+
</excludes>
142+
</configuration>
143+
</plugin>
144+
</plugins>
145+
</pluginManagement>
146+
</build>
113147
</project>

src/test/java/DefaultPackageNameMapper.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,6 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
/**
17-
* Copyright 2018-2019 the original author or authors.
18-
*
19-
* Licensed under the Apache License, Version 2.0 (the "License");
20-
* you may not use this file except in compliance with the License.
21-
* You may obtain a copy of the License at
22-
*
23-
* http://www.apache.org/licenses/LICENSE-2.0
24-
*
25-
* Unless required by applicable law or agreed to in writing, software
26-
* distributed under the License is distributed on an "AS IS" BASIS,
27-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28-
* See the License for the specific language governing permissions and
29-
* limitations under the License.
30-
*/
3116
import java.util.List;
3217

3318
import org.mybatis.scripting.freemarker.Name;

travis/after_success.sh

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
#
3-
# Copyright 2015-2019 the original author or authors.
3+
# Copyright 2015-2020 the original author or authors.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -23,35 +23,32 @@ echo "Current commit detected: ${commit_message}"
2323
# We build for several JDKs on Travis.
2424
# Some actions, like analyzing the code (Coveralls) and uploading
2525
# artifacts on a Maven repository, should only be made for one version.
26-
26+
2727
# If the version is 1.8, then perform the following actions.
28-
# 1. Upload artifacts to Sonatype.
29-
# 2. Use -q option to only display Maven errors and warnings.
30-
# 3. Use --settings to force the usage of our "settings.xml" file.
31-
# 4. Notify Coveralls.
32-
# 5. Deploy site
28+
# 1. Notify Coveralls.
29+
# 2. Deploy site (disabled as solution not complete).
30+
31+
# Parameters
32+
# 1. Use -q option to only display Maven errors and warnings.
33+
# 2. Use --settings to force the usage of our "settings.xml" file.
3334

3435
if [ $TRAVIS_REPO_SLUG == "mybatis/freemarker-scripting" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ] && [[ "$commit_message" != *"[maven-release-plugin]"* ]]; then
3536

3637
if [ $TRAVIS_JDK_VERSION == "openjdk8" ]; then
3738

38-
# Deploy to sonatype
39-
./mvnw clean deploy -q --settings ./travis/settings.xml
40-
echo -e "Successfully deployed SNAPSHOT artifacts to Sonatype under Travis job ${TRAVIS_JOB_NUMBER}"
41-
4239
# Deploy to coveralls
43-
./mvnw clean test jacoco:report coveralls:report -q --settings ./travis/settings.xml
40+
./mvnw clean test jacoco:report coveralls:report -q --settings ./mvn/settings.xml
4441
echo -e "Successfully ran coveralls under Travis job ${TRAVIS_JOB_NUMBER}"
4542

4643
# Deploy to site
47-
# Cannot currently run site this way
48-
# ./mvnw site site:deploy -q --settings ./travis/settings.xml
49-
# echo -e "Successfully deploy site under Travis job ${TRAVIS_JOB_NUMBER}"
44+
# Cannot currently run site this way
45+
# ./mvnw site site:deploy -q --settings ./mvn/settings.xml
46+
# echo -e "Successfully deploy site under Travis job ${TRAVIS_JOB_NUMBER}"
5047
else
5148
echo "Java Version does not support additonal activity for travis CI"
5249
fi
5350
else
5451
echo "Travis Pull Request: $TRAVIS_PULL_REQUEST"
5552
echo "Travis Branch: $TRAVIS_BRANCH"
5653
echo "Travis build skipped"
57-
fi
54+
fi

0 commit comments

Comments
 (0)