Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Commit

Permalink
Rebase joschi/setup-jdk action on actions/setup-java
Browse files Browse the repository at this point in the history
Rebase on actions/setup-java in order to benefit from some features in
that repository and add the setup-jdk modifications in a way, which makes
future merges from actions/setup-java simpler.
  • Loading branch information
joschi committed May 25, 2020
1 parent 4003c04 commit 3668709
Show file tree
Hide file tree
Showing 15 changed files with 897 additions and 178 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/test-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: 'nightly'
on:
schedule:
- cron: '0 0 * * *'
jobs:
run:
name: Run
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, macOS-latest, windows-latest]
jdk-version: [8, 11, 14]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: npm install
run: npm install
- name: Clear tool cache
if: runner.os != 'windows'
run: mv "${{ runner.tool_cache }}" "${{ runner.tool_cache }}.old"
- name: Clear tool cache (Windows)
if: runner.os == 'windows'
run: move "${{ runner.tool_cache }}" "${{ runner.tool_cache }}.old"
- name: Setup Java ${{ matrix.java-version}}
uses: ./
with:
java-version: ${{ matrix.jdk-version }}
- name: Verify Java ${{ matrix.java-version}}
if: runner.os != 'windows'
run: __tests__/verify-java.sh ${{ matrix.java-version }}
- name: Verify Java ${{ matrix.java-version}} (Windows)
if: runner.os == 'windows'
run: __tests__/verify-java.ps1 ${{ matrix.java-version }}
35 changes: 18 additions & 17 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest]
operating-system: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -24,7 +24,8 @@ jobs:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest]
operating-system: [ubuntu-latest, macOS-latest, windows-latest]
java-version: [8, 11, 14]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -34,16 +35,16 @@ jobs:
- name: Clear tool cache (Windows)
if: runner.os == 'windows'
run: move "${{ runner.tool_cache }}" "${{ runner.tool_cache }}.old"
- name: Setup Java 13
- name: Setup Java ${{ matrix.java-version}}
uses: ./
with:
java-version: 13.0.2
- name: Verify Java 13
java-version: ${{ matrix.java-version }}
- name: Verify Java ${{ matrix.java-version}}
if: runner.os != 'windows'
run: __tests__/verify-java.sh 13.0.2
- name: Verify Java 13 (Windows)
run: __tests__/verify-java.sh ${{ matrix.java-version }}
- name: Verify Java ${{ matrix.java-version}} (Windows)
if: runner.os == 'windows'
run: __tests__/verify-java.ps1 13.0.2
run: __tests__/verify-java.ps1 ${{ matrix.java-version }}

test-proxy:
runs-on: ubuntu-latest
Expand All @@ -61,25 +62,25 @@ jobs:
- uses: actions/checkout@v2
- name: Clear tool cache
run: rm -rf $RUNNER_TOOL_CACHE/*
- name: Setup Java 13
- name: Setup Java 11
uses: ./
with:
java-version: 13.0.2
- name: Verify Java 13
run: __tests__/verify-java.sh 13.0.2
java-version: 11
- name: Verify Java 11
run: __tests__/verify-java.sh 11

test-bypass-proxy:
runs-on: ubuntu-latest
env:
https_proxy: http://no-such-proxy:3128
no_proxy: github.com,static.azul.com
no_proxy: github.com,static.azul.com,api.adoptopenjdk.net,github-production-release-asset-2e65be.s3.amazonaws.com
steps:
- uses: actions/checkout@v2
- name: Clear tool cache
run: rm -rf $RUNNER_TOOL_CACHE/*
- name: Setup Java 13
- name: Setup Java 11
uses: ./
with:
java-version: 13.0.2
- name: Verify Java 13
run: __tests__/verify-java.sh 13.0.2
java-version: 11
- name: Verify Java 11
run: __tests__/verify-java.sh 11
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

The MIT License (MIT)

Copyright (c) 2018 GitHub, Inc. and contributors
Copyright (c) 2018 GitHub, Inc. and contributors, Jochen Schalanda

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -19,4 +19,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
73 changes: 23 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# setup-java
# setup-jdk

<p align="left">
<a href="https://github.com/actions/setup-java"><img alt="GitHub Actions status" src="https://github.com/actions/setup-java/workflows/Main%20workflow/badge.svg"></a>
<a href="https://github.com/joschi/setup-jdk"><img alt="GitHub Actions status" src="https://github.com/joschi/setup-jdk/workflows/Main%20workflow/badge.svg"></a>
</p>

This action sets up a java environment for use in actions by:
This action sets up a Java development environment with the OpenJDK distribution from [AdoptOpenJDK](https://adoptopenjdk.net/) for use in actions by:

- optionally downloading and caching a requested version of java by version and adding to PATH. Default downloads are populated from the [Zulu Community distribution of OpenJDK](http://static.azul.com/zulu/bin/)
- registering problem matchers for error output
- Downloading and caching a version of the OpenJDK by version and adding to `PATH`. Downloads from [AdoptOpenJDK](https://adoptopenjdk.net/).
- Registering problem matchers for error output.

The action is based on [actions/setup-java](https://github.com/actions/setup-java) and is using the [AdoptOpenJDK API](https://api.adoptopenjdk.net/) for fetching the JDK binaries.

# Usage

Expand All @@ -17,47 +19,18 @@ See [action.yml](action.yml)
```yaml
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: joschi/setup-jdk@v2
with:
java-version: '9.0.4' # The JDK version to make available on the path.
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64 # (x64 or x86) - defaults to x64
java-version: '11' # The OpenJDK version to make available on the path
architecture: 'x64' # defaults to 'x64'
- run: java -cp java HelloWorldApp
```
Examples of version specifications that the java-version parameter will accept:
- A major Java version
e.g. ```6, 7, 8, 9, 10, 11, 12, 13, ...```

- A semver Java version specification

e.g. ```8.0.232, 7.0.181, 11.0.4```

e.g. ```8.0.x, >11.0.3, >=13.0.1, <8.0.212```

- An early access (EA) Java version

e.g. ```14-ea, 15-ea```

e.g. ```14.0.0-ea, 15.0.0-ea```

e.g. ```14.0.0-ea.28, 15.0.0-ea.2``` (syntax for specifying an EA build number)

Note that, per semver rules, EA builds will be matched by explicit EA version specifications.

- 1.x syntax

e.g. ```1.8``` (same as ```8```)

e.g. ```1.8.0.212``` (same as ```8.0.212```)

## Local file
```yaml
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: joschi/setup-jdk@v2
with:
java-version: '4.0.0'
architecture: x64
Expand All @@ -69,18 +42,18 @@ steps:
```yaml
jobs:
build:
runs-on: ubuntu-16.04
runs-on: ubuntu-latest
strategy:
matrix:
# test against latest update of each major Java version, as well as specific updates of LTS versions:
java: [ 1.6, 6.0.83, 7, 7.0.181, 8, 8.0.192, 9.0.x, 10, 11.0.x, 11.0.3, 12, 13 ]
java: [ '8', '11', '13' ]
name: Java ${{ matrix.java }} sample
steps:
- uses: actions/checkout@v2
- name: Setup java
uses: actions/setup-java@v1
uses: joschi/setup-jdk@v2
with:
java-version: ${{ matrix.java }}
architecture: x64
- run: java -cp java HelloWorldApp
```
Expand All @@ -94,9 +67,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
uses: joschi/setup-jdk@v2
with:
java-version: 1.8
java-version: '8'

- name: Build with Maven
run: mvn -B package --file pom.xml
Expand All @@ -107,9 +80,9 @@ jobs:
GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password

- name: Set up Apache Maven Central
uses: actions/setup-java@v1
with: # running setup-java again overwrites the settings.xml
java-version: 1.8
uses: joschi/setup-jdk@v2
with: # running setup-jdk again overwrites the settings.xml
java-version: '8'
server-id: maven # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
Expand Down Expand Up @@ -160,7 +133,7 @@ jobs:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
uses: joschi/setup-jdk@v2
- name: Build with Gradle
run: gradle build
Expand Down Expand Up @@ -189,9 +162,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8 for Shared Runner
uses: actions/setup-java@v1
uses: joschi/setup-jdk@v2
with:
java-version: 1.8
java-version: '8'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
Expand Down
Loading

0 comments on commit 3668709

Please sign in to comment.