Skip to content

Commit 01f4422

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents e494666 + d920b7d commit 01f4422

10 files changed

Lines changed: 5191 additions & 53 deletions

File tree

‎.github/workflows/lint-yaml.yml‎

Lines changed: 0 additions & 12 deletions
This file was deleted.

‎.github/workflows/workflow.yml‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,16 @@ jobs:
3535
if: runner.os == 'windows'
3636
run: move "${{ runner.tool_cache }}" "${{ runner.tool_cache }}.old"
3737
- name: Setup Java 13
38+
id: setup-java
3839
uses: ./
3940
with:
4041
java-version: 13.0.2
4142
- name: Verify Java 13
4243
if: runner.os != 'windows'
43-
run: __tests__/verify-java.sh 13.0.2
44+
run: __tests__/verify-java.sh 13.0.2 "${{ steps.setup-java.outputs.path }}" "${{ steps.setup-java.outputs.version }}"
4445
- name: Verify Java 13 (Windows)
4546
if: runner.os == 'windows'
46-
run: __tests__/verify-java.ps1 13.0.2
47+
run: __tests__/verify-java.ps1 13.0.2 "${{ steps.setup-java.outputs.path }}" "${{ steps.setup-java.outputs.version }}"
4748

4849
test-proxy:
4950
runs-on: ubuntu-latest
@@ -62,11 +63,12 @@ jobs:
6263
- name: Clear tool cache
6364
run: rm -rf $RUNNER_TOOL_CACHE/*
6465
- name: Setup Java 13
66+
id: setup-java
6567
uses: ./
6668
with:
6769
java-version: 13.0.2
6870
- name: Verify Java 13
69-
run: __tests__/verify-java.sh 13.0.2
71+
run: __tests__/verify-java.sh 13.0.2 "${{ steps.setup-java.outputs.path }}" "${{ steps.setup-java.outputs.version }}"
7072

7173
test-bypass-proxy:
7274
runs-on: ubuntu-latest
@@ -78,8 +80,9 @@ jobs:
7880
- name: Clear tool cache
7981
run: rm -rf $RUNNER_TOOL_CACHE/*
8082
- name: Setup Java 13
83+
id: setup-java
8184
uses: ./
8285
with:
8386
java-version: 13.0.2
8487
- name: Verify Java 13
85-
run: __tests__/verify-java.sh 13.0.2
88+
run: __tests__/verify-java.sh 13.0.2 "${{ steps.setup-java.outputs.path }}" "${{ steps.setup-java.outputs.version }}"

‎__tests__/verify-java.ps1‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,23 @@ if (!$java_version.Contains($args[0]))
99
{
1010
throw "Unexpected version"
1111
}
12+
13+
if ($args.Count -lt 2 -or !$args[1])
14+
{
15+
throw "Must supply java path argument"
16+
}
17+
18+
if ($args[1] -ne $Env:JAVA_HOME)
19+
{
20+
throw "Unexpected path"
21+
}
22+
23+
if ($args.Count -lt 3 -or !$args[2])
24+
{
25+
throw "Must supply java version argument"
26+
}
27+
28+
if ($args[0] -ne $args[2])
29+
{
30+
throw "Unexpected version"
31+
}

‎__tests__/verify-java.sh‎

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,33 @@
11
#!/bin/sh
22

33
if [ -z "$1" ]; then
4-
echo "Must supply java version argument"
4+
echo "::error::Must supply java version argument"
55
exit 1
66
fi
77

88
java_version="$(java -version 2>&1)"
99
echo "Found java version: $java_version"
1010
if [ -z "$(echo $java_version | grep --fixed-strings $1)" ]; then
11-
echo "Unexpected version"
11+
echo "::error::Unexpected version"
12+
exit 1
13+
fi
14+
15+
if [ -z "$2" ]; then
16+
echo "::error::Must supply java path argument"
17+
exit 1
18+
fi
19+
20+
if [ "$2" != "$JAVA_HOME" ]; then
21+
echo "::error::Unexpected path"
22+
exit 1
23+
fi
24+
25+
if [ -z "$3" ]; then
26+
echo "::error::Must supply java version argument"
27+
exit 1
28+
fi
29+
30+
if [ "$1" != "$3" ]; then
31+
echo "::error::Unexpected version"
1232
exit 1
1333
fi

‎action.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ inputs:
4343
description: 'Environment variable name for the GPG private key passphrase. Default is
4444
$GPG_PASSPHRASE.'
4545
required: false
46+
outputs:
47+
path:
48+
description: 'Path to where the java environment has been installed (same as $JAVA_HOME)'
49+
version:
50+
description: 'Actual version of the java environment that has been installed'
4651
runs:
4752
using: 'node12'
4853
main: 'dist/setup/index.js'

0 commit comments

Comments
 (0)