Skip to content

Commit 171f9c9

Browse files
committed
Update CI
1 parent e176233 commit 171f9c9

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

.github/workflows/main.yml

+24-13
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,43 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
java_version: ['8', '11', '14']
27+
java_version: ['8', '11', '17']
2828
os: ['ubuntu-20.04']
2929
env:
3030
JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
3131
steps:
32-
- uses: actions/checkout@v2
32+
- uses: actions/checkout@v3
3333
- name: Set up JDK
34-
uses: actions/setup-java@v2
34+
uses: actions/setup-java@v3
3535
with:
36-
distribution: "adopt"
36+
distribution: 'temurin'
3737
java-version: ${{ matrix.java_version }}
38+
cache: 'maven'
3839
server-id: sonatype-nexus-snapshots
3940
server-username: CI_DEPLOY_USERNAME
4041
server-password: CI_DEPLOY_PASSWORD
41-
- uses: actions/cache@v2.1.6
42-
with:
43-
path: ~/.m2/repository
44-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
45-
restore-keys: |
46-
${{ runner.os }}-maven-
42+
# See https://github.com/actions/setup-java/blob/v2/docs/advanced-usage.md#Publishing-using-Apache-Maven
43+
# gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
44+
# gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
4745
- name: Build
48-
run: ./mvnw -V -B -ff -ntp verify
46+
run: ./mvnw -B -q -ff -ntp verify
47+
- name: Extract project Maven version
48+
id: projectVersion
49+
run: echo ::set-output name=version::$(./mvnw org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -DforceStdout -Dexpression=project.version -q)
4950
- name: Deploy snapshot
50-
if: github.event_name != 'pull_request' && matrix.java_version == '8'
51+
if: github.event_name != 'pull_request' && matrix.java_version == '8' && endsWith(steps.projectVersion.outputs.version, '-SNAPSHOT')
5152
env:
5253
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
5354
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
5455
# MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
55-
run: ./mvnw -V -B -ff -DskipTests -ntp source:jar deploy
56+
run: ./mvnw -B -q -ff -DskipTests -ntp source:jar deploy
57+
- name: Generate code coverage
58+
if: github.event_name != 'pull_request' && matrix.java_version == '8'
59+
run: ./mvnw -B -q -ff -ntp test
60+
- name: Publish code coverage
61+
if: github.event_name != 'pull_request' && matrix.java_version == '8'
62+
uses: codecov/codecov-action@v1
63+
with:
64+
token: ${{ secrets.CODECOV_TOKEN }}
65+
file: ./target/site/jacoco/jacoco.xml
66+
flags: unittests

0 commit comments

Comments
 (0)