Skip to content

Commit

Permalink
Merge pull request smallrye#81 from dmlloyd/test-env
Browse files Browse the repository at this point in the history
Test on Linux, Mac, and Windows
  • Loading branch information
dmlloyd authored Mar 8, 2021
2 parents 4e852cd + 2df7a55 commit 2595414
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 7 deletions.
75 changes: 72 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,78 @@ on:
- 'README*'

jobs:
build:
build-linux:
runs-on: ubuntu-latest
name: build with JDK 11
name: build with JDK 11 (Linux)

steps:
- uses: actions/checkout@v2
name: checkout

- uses: AdoptOpenJDK/install-jdk@v1
name: set up JDK 11
with:
version: 11

- uses: AdoptOpenJDK/install-jdk@v1
name: set up JDK 10
with:
version: 10
targets: 'JAVA_HOME_10'

- uses: AdoptOpenJDK/install-jdk@v1
name: set up JDK 9
with:
version: 9
targets: 'JAVA_HOME_9'

- uses: AdoptOpenJDK/install-jdk@v1
name: set up JDK 8
with:
version: 8
targets: 'JAVA_HOME_8'

- name: build with maven
run: mvn -B formatter:validate verify --file pom.xml -Djava8.home=$JAVA_HOME_8 -Djava9.home=$JAVA_HOME_9 -Djava10.home=$JAVA_HOME_10

build-windows:
runs-on: windows-latest
name: build with JDK 11 (Windows)

steps:
- uses: actions/checkout@v2
name: checkout

- uses: AdoptOpenJDK/install-jdk@v1
name: set up JDK 11
with:
version: 11

- uses: AdoptOpenJDK/install-jdk@v1
name: set up JDK 10
with:
version: 10
targets: 'JAVA_HOME_10'

- uses: AdoptOpenJDK/install-jdk@v1
name: set up JDK 9
with:
version: 9
targets: 'JAVA_HOME_9'

- uses: AdoptOpenJDK/install-jdk@v1
name: set up JDK 8
with:
version: 8
targets: 'JAVA_HOME_8'

- name: build with maven
shell: bash
run: mvn -B formatter:validate verify --file pom.xml -Djava8.home=$JAVA_HOME_8 -Djava9.home=$JAVA_HOME_9 -Djava10.home=$JAVA_HOME_10

build-macos:
runs-on: macos-latest
name: build with JDK 11 (Mac OS)

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -52,7 +121,7 @@ jobs:
run: mvn -B formatter:validate verify --file pom.xml -Djava8.home=$JAVA_HOME_8 -Djava9.home=$JAVA_HOME_9 -Djava10.home=$JAVA_HOME_10

quality:
needs: [build]
needs: [build-linux,build-macos,build-windows]
if: github.event_name == 'push' && github.repository == 'smallrye/smallrye-common'
runs-on: ubuntu-latest
name: quality
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -79,8 +80,8 @@ void processAsPath(@TempDir Path tempDir) throws Exception {
Path filePath = tempDir.resolve("resources.jar");
jar.as(ZipExporter.class).exportTo(filePath.toFile());

URL resource = new URL("jar:file:" + filePath.toString() + "!/resources.properties");
Properties properties = ClassPathUtils.processAsPath(resource, path -> {
URI resource = new URI("jar", filePath.toUri().toASCIIString() + "!/resources.properties", null);
Properties properties = ClassPathUtils.processAsPath(resource.toURL(), path -> {
Properties properties1 = new Properties();
try (InputStreamReader reader = new InputStreamReader(Files.newInputStream(path))) {
properties1.load(reader);
Expand All @@ -102,8 +103,8 @@ void readStream(@TempDir Path tempDir) throws Exception {
Path filePath = tempDir.resolve("resources.jar");
jar.as(ZipExporter.class).exportTo(filePath.toFile());

URL resource = new URL("jar:file:" + filePath.toString() + "!/resources.properties");
Properties properties = ClassPathUtils.readStream(resource, inputStream -> {
URI resource = new URI("jar", filePath.toUri().toASCIIString() + "!/resources.properties", null);
Properties properties = ClassPathUtils.readStream(resource.toURL(), inputStream -> {
Properties properties1 = new Properties();
try (InputStreamReader reader = new InputStreamReader(inputStream)) {
properties1.load(reader);
Expand Down

0 comments on commit 2595414

Please sign in to comment.