Skip to content

Commit 8f2a059

Browse files
add jdk8 compatibility (#13)
* add jdk8 compatibility * add jdk8 compatibility
1 parent 738f482 commit 8f2a059

File tree

3 files changed

+89
-4
lines changed

3 files changed

+89
-4
lines changed

.github/workflows/ci-actions.yml

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,91 @@ jobs:
3838
uses: joschi/setup-jdk@b9cc6eabf7e7e3889766b5cee486f874c9e1bd2d
3939
with:
4040
java-version: 11
41+
- name: Compute cache restore key
42+
# Always recompute on a push so that the maven repo doesnt grow indefinitely with old versions
43+
run: |
44+
if ${{ github.event_name == 'pull_request' }}; then echo "::set-env name=COMPUTED_RESTORE_KEY::q2maven-"; fi
45+
- name: Cache Maven Repository
46+
id: cache-maven
47+
uses: n1hility/cache@v2
48+
with:
49+
path: ~/.m2/repository
50+
# Improves the reusability of the cache to limit key changes
51+
key: q2maven-${{ hashFiles('pom.xml') }}
52+
restore-keys: ${{ env.COMPUTED_RESTORE_KEY }}
53+
restore-only: ${{ github.event_name == 'pull_request' }}
54+
- name: Build
55+
run: |
56+
mvn -e -B -DskipTests=true -DskipDocs clean install
57+
- name: Tar Maven Repo
58+
shell: bash
59+
run: tar -czvf maven-repo.tgz -C ~ .m2/repository
60+
- name: Persist Maven Repo
61+
uses: actions/upload-artifact@v1
62+
with:
63+
name: maven-repo
64+
path: maven-repo.tgz
65+
66+
linux-jvm-tests:
67+
name: JDK ${{matrix.java-version}} JVM Tests
68+
timeout-minutes: 120
69+
needs: build-jdk11
70+
strategy:
71+
fail-fast: false
72+
matrix:
73+
java-version: [8, 11, 13]
74+
75+
runs-on: ubuntu-latest
76+
77+
steps:
78+
- uses: actions/checkout@v2
79+
- name: Set up JDK ${{ matrix.java-version }}
80+
# Uses sha for added security since tags can be updated
81+
uses: joschi/setup-jdk@b9cc6eabf7e7e3889766b5cee486f874c9e1bd2d
82+
with:
83+
java-version: ${{ matrix.java-version }}
84+
- name: Download Maven Repo
85+
uses: actions/download-artifact@v1
86+
with:
87+
name: maven-repo
88+
path: .
89+
- name: Extract Maven Repo
90+
shell: bash
91+
run: tar -xzvf maven-repo.tgz -C ~
92+
- name: Build with Maven
93+
run: mvn install
94+
- name: Prepare failure archive (if maven failed)
95+
if: failure()
96+
shell: bash
97+
run: find . -name '*-reports' -type d | tar -czvf test-reports.tgz -T -
98+
- name: Upload failure Archive (if maven failed)
99+
uses: actions/upload-artifact@v1
100+
if: failure()
101+
with:
102+
name: test-reports-linux-jvm${{matrix.java-version}}
103+
path: 'test-reports.tgz'
104+
105+
code-scan:
106+
name: JDK 8 JVM Code Scan
107+
timeout-minutes: 120
108+
needs: build-jdk11
109+
runs-on: ubuntu-latest
110+
111+
steps:
112+
- uses: actions/checkout@v2
113+
- name: Set up JDK 8
114+
# Uses sha for added security since tags can be updated
115+
uses: joschi/setup-jdk@b9cc6eabf7e7e3889766b5cee486f874c9e1bd2d
116+
with:
117+
java-version: 8
118+
- name: Download Maven Repo
119+
uses: actions/download-artifact@v1
120+
with:
121+
name: maven-repo
122+
path: .
123+
- name: Extract Maven Repo
124+
shell: bash
125+
run: tar -xzvf maven-repo.tgz -C ~
41126
- name: Build with Maven and Coverage
42127
if: github.event_name == 'pull_request'
43128
run: mvn verify -P coverage
@@ -57,5 +142,5 @@ jobs:
57142
uses: actions/upload-artifact@v1
58143
if: failure()
59144
with:
60-
name: test-reports-linux-jvm11
145+
name: test-reports-linux-jvm-codescan
61146
path: 'test-reports.tgz'

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
<packaging>jar</packaging>
3131

3232
<properties>
33-
<maven.compiler.source>11</maven.compiler.source>
34-
<maven.compiler.target>11</maven.compiler.target>
33+
<maven.compiler.source>1.8</maven.compiler.source>
34+
<maven.compiler.target>1.8</maven.compiler.target>
3535
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3636
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
3737

src/main/java/io/github/project/openubl/xmlsenderws/webservices/managers/smart/SmartBillServiceManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static SmartBillServiceModel send(byte[] file, String username, String pa
6363
}
6464

6565
Optional<DocumentType> documentTypeOptional = DocumentType.valueFromDocumentType(xmlContentModel.getDocumentType());
66-
if (documentTypeOptional.isEmpty()) {
66+
if (!documentTypeOptional.isPresent()) {
6767
throw new UnsupportedDocumentTypeException(xmlContentModel.getDocumentType() + " is not supported yet");
6868
}
6969

0 commit comments

Comments
 (0)