-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
130 lines (126 loc) · 4.71 KB
/
java-examples.yml
File metadata and controls
130 lines (126 loc) · 4.71 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
name: Run Java examples
on:
workflow_dispatch:
schedule:
- cron: '35 22 * * *'
pull_request:
branches:
- trunk
paths:
- 'examples/java/**'
push:
branches:
- trunk
paths:
- 'examples/java/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DISPLAY: :99
GITHUB_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }}
GH_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }}
jobs:
tests:
strategy:
fail-fast: false
matrix:
os: [ ubuntu, windows, macos ]
release: [ stable, nightly ]
runs-on: ${{ format('{0}-latest', matrix.os) }}
steps:
- name: Checkout GitHub repo
uses: actions/checkout@v6
- name: Remove driver directories Windows
if: matrix.os == 'windows'
run: |
rm "$env:ChromeWebDriver" -r -v
rm "$env:EdgeWebDriver" -r -v
rm "$env:GeckoWebDriver" -r -v
- name: Remove driver directories Non-Windows
if: matrix.os != 'windows'
run: |
sudo rm -rf $CHROMEWEBDRIVER $EDGEWEBDRIVER $GECKOWEBDRIVER
- name: Start Xvfb
if: matrix.os == 'ubuntu'
run: Xvfb :99 &
- name: Set up Java
id: java
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 17
- name: Import test cert non-Windows
if: matrix.os != 'windows'
run: sudo keytool -import -noprompt -trustcacerts -alias SeleniumHQ -file examples/java/src/test/resources/tls.crt -keystore ${{ steps.java.outputs.path }}/lib/security/cacerts -storepass changeit
- name: Import test cert Windows
if: matrix.os == 'windows'
run: keytool -import -noprompt -trustcacerts -alias SeleniumHQ -file examples/java/src/test/resources/tls.crt -keystore ${{ steps.java.outputs.path }}/lib/security/cacerts -storepass changeit
- name: Run Tests Stable (in Maven)
if: matrix.release == 'stable'
uses: nick-invision/retry@v3.0.2
with:
timeout_minutes: 40
max_attempts: 3
command: |
cd examples/java
mvn -B test -D"jdk.internal.httpclient.disableHostnameVerification=true"
- name: Run Tests Stable (in Gradle)
if: matrix.release == 'stable'
uses: nick-invision/retry@v3.0.2
with:
timeout_minutes: 40
max_attempts: 3
command: |
cd examples/java
./gradlew test --tests 'dev.selenium.*UsingSeleniumTest'
- name: Run Tests Nightly Linux/macOS
if: matrix.release == 'nightly' && matrix.os != 'windows'
uses: nick-invision/retry@v3.0.2
with:
timeout_minutes: 40
max_attempts: 3
command: |
# Get current selenium.version from Maven
current_version=$(mvn -f examples/java/pom.xml help:evaluate -Dexpression=selenium.version -q -DforceStdout)
echo "Current selenium.version: $current_version"
# If version is in the form X.Y.Z, bump minor and set to SNAPSHOT
if [[ $current_version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
next_minor=$((minor + 1))
new_version="$major.$next_minor.0-SNAPSHOT"
echo "Using selenium.version $new_version for tests"
cd examples/java
mvn -B -U test -D"jdk.internal.httpclient.disableHostnameVerification=true" -Dselenium.version=$new_version
fi
- name: Run Tests Nightly Windows
if: matrix.release == 'nightly' && matrix.os == 'windows'
uses: nick-invision/retry@v3.0.2
with:
timeout_minutes: 40
max_attempts: 3
command: |
# Get current selenium.version from Maven
$current_version = & mvn -f examples/java/pom.xml help:evaluate -Dexpression=selenium.version -q -DforceStdout
Write-Output "Current selenium.version: $current_version"
# If version is in the form X.Y.Z, bump minor and set to SNAPSHOT
if ($current_version -match '^([0-9]+)\.([0-9]+)\.([0-9]+)$') {
$major = $matches[1]
$minor = $matches[2]
$next_minor = [int]$minor + 1
$new_version = "$major.$next_minor.0-SNAPSHOT"
Write-Output "Using selenium.version $new_version for tests"
cd examples/java
mvn -B -U test "-Djdk.internal.httpclient.disableHostnameVerification=true" "-Dselenium.version=$new_version"
}
- name: Upload test report
uses: actions/upload-artifact@v6
if: failure()
with:
name: test-report-${{matrix.os}}-${{matrix.release}}
retention-days: 14
path: |
examples/java/target/surefire-reports
examples/java/build/reports
examples/java/build/test-results