-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
133 lines (131 loc) · 4.62 KB
/
action.yml
File metadata and controls
133 lines (131 loc) · 4.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Split Tests Java
author: donnerbart@users.noreply.github.com
description: Splits a JUnit test suite for parallelization with equal time
branding:
icon: shuffle
color: blue
inputs:
split-index:
description: Index of this instance executing the tests (integer)
required: true
type: number
split-total:
description: Total number of instances executing the tests (integer)
required: true
type: number
glob:
description: Glob pattern to find test files (string)
required: true
type: string
exclude-glob:
description: Glob pattern to exclude test files (string)
required: false
type: string
default: ""
junit-glob:
description: Glob pattern to find JUnit reports (string)
required: false
type: string
format:
description: The output format (choice)
required: false
type: choice
options:
- list
- gradle
default: list
average-time:
deprecationMessage: This option is deprecated and should no longer be used. Use new-test-time instead.
description: Use the average test time from tests with JUnit reports for tests without JUnit reports (boolean)
required: false
type: boolean
default: false
new-test-time:
description: Configures the calculation of the test time for tests without JUnit reports (choice)
required: false
type: choice
options:
- zero
- average
- min
- max
default: average
working-directory:
description: The working directory. Defaults to the current directory (string)
type: string
required: false
calculate-optimal-total-split:
description: Calculates the optimal test split. Logs a warning if split-total does not match (boolean)
type: boolean
required: false
max-optimal-total-split-calculations:
description: The maximum number of calculate-optimal-total-split calculations (integer)
type: integer
required: false
debug:
description: Enables debug logging (boolean)
required: false
type: boolean
default: false
outputs:
test-suite:
description: A subset of tests, based on the the split index and split type
value: ${{ steps.split-tests-java.outputs.test-suite }}
split-total:
description: Total number of instances executing the tests
value: ${{ inputs.split-total }}
split-index:
description: Index of this instance executing the tests
value: ${{ inputs.split-index }}
runs:
using: composite
steps:
- name: Set environment variables
shell: bash
run: |
: "${DOWNLOAD_JAR:=true}"
: "${JAR_PATH:=split-tests-java.jar}"
echo "DOWNLOAD_JAR=$DOWNLOAD_JAR" >> $GITHUB_ENV
echo "JAR_PATH=$JAR_PATH" >> $GITHUB_ENV
- name: Install split-tests-java
shell: bash
run: |
if [[ "$DOWNLOAD_JAR" == "true" ]]; then
curl -s -L -o "$JAR_PATH" "https://github.com/donnerbart/split-tests-java/releases/latest/download/split-tests-java.jar"
fi
- name: Split tests
id: split-tests-java
shell: bash
run: |
COMMAND="java -jar $JAR_PATH --split-index ${{ inputs.split-index }} --split-total ${{ inputs.split-total }} --glob ${{ inputs.glob }}"
if [ -n "${{ inputs.exclude-glob }}" ]; then
COMMAND="$COMMAND --exclude-glob ${{ inputs.exclude-glob }}"
fi
if [ -n "${{ inputs.junit-glob }}" ]; then
COMMAND="$COMMAND --junit-glob ${{ inputs.junit-glob }}"
fi
if [ -n "${{ inputs.format }}" ]; then
COMMAND="$COMMAND --format ${{ inputs.format }}"
fi
if [ -n "${{ inputs.new-test-time }}" ]; then
COMMAND="$COMMAND --new-test-time ${{ inputs.new-test-time }}"
elif [ -n "${{ inputs.average-time }}" ]; then
echo "Warning! Using deprecated option average-time. Please use new-test-time instead!"
COMMAND="$COMMAND --new-test-time average"
fi
if [ -n "${{ inputs.working-directory }}" ]; then
COMMAND="$COMMAND --working-directory ${{ inputs.working-directory }}"
fi
if [ -n "${{ inputs.calculate-optimal-total-split }}" ]; then
COMMAND="$COMMAND --calculate-optimal-total-split"
fi
if [ -n "${{ inputs.max-optimal-total-split-calculations }}" ]; then
COMMAND="$COMMAND --max-optimal-total-split-calculations ${{ inputs.max-optimal-total-split-calculations }}"
fi
if [ -n "${{ inputs.debug }}" ]; then
COMMAND="$COMMAND --debug"
fi
echo "Command: $COMMAND"
TESTS=$($COMMAND)
echo "This runner will execute the following tests: $TESTS"
echo "test-suite=${TESTS}" >> $GITHUB_OUTPUT