1
1
name : Java CI
2
2
3
- on : [push, pull_request]
3
+ on :
4
+ pull_request :
5
+ push :
6
+ tags :
7
+ branches :
8
+ - develop
9
+ - selenium4
10
+
4
11
5
12
jobs :
6
13
build_and_test :
9
16
matrix :
10
17
os : [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
11
18
java-version : [ 8 ]
12
- browser : ['jbrowser', 'googlechromeheadless', 'firefoxheadless'] # 'htmlunitwithjs' not working with Selenium4
19
+ browser : ['jbrowser', 'googlechromeheadless', 'firefoxheadless', 'edgeheadless' ] # 'htmlunitwithjs' not working with Selenium4
13
20
include :
14
21
- os : ubuntu-latest
15
22
set_display : export DISPLAY=:99; Xvfb :99 -screen 0 1024x768x24 -ac -noreset & sleep 3
16
- install_dependencies : sudo apt-get -y -q install xvfb zip curl
23
+ install_dependencies : |
24
+ curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
25
+ sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
26
+ sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list'
27
+ sudo rm microsoft.gpg
28
+ sudo apt update
29
+ sudo apt-get -y -q install xvfb zip curl microsoft-edge-beta
17
30
- os : windows-latest
18
31
install_dependencies : choco install firefox googlechrome curl zip -y --no-progress
19
32
- os : macos-latest
20
33
install_dependencies : |
21
- brew cask install firefox
22
- brew cask install google-chrome
34
+ brew install --cask firefox
35
+ brew install --cask google-chrome
36
+ brew install --cask microsoft-edge
23
37
brew install zip
24
38
brew install curl
25
39
@@ -28,49 +42,66 @@ jobs:
28
42
steps :
29
43
- uses : actions/checkout@v2
30
44
- name : Set up JDK ${{ matrix.java-version }}
31
- uses : actions/setup-java@v1.2 .0
45
+ uses : actions/setup-java@v2.3 .0
32
46
with :
47
+ distribution : zulu
33
48
java-version : ${{ matrix.java-version }}
34
49
java-package : jdk+fx # needed for jbrowser
35
50
- name : Set up other dependencies
36
51
run : |
37
52
${{ matrix.install_dependencies }}
38
53
${{ matrix.set_display }}
39
54
- name : Build with Maven
40
- run : mvn -B verify --file pom.xml -P 'build,${{ matrix.browser }}'
55
+ run : mvn -B -ntp -q verify --file pom.xml -P 'build,${{ matrix.browser }}'
41
56
- name : Delete output.xml (on Win)
42
57
run : |
43
58
Get-ChildItem target/robotframework-reports -Include *output.xml -Recurse | Remove-Item
44
- echo "::set-env name= REPORT_FILE:: $(Get-ChildItem target/robotframework-reports -Include *report.html -Recurse -Name)"
59
+ echo "REPORT_FILE= $(Get-ChildItem target/robotframework-reports -Include *report.html -Recurse -Name)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
45
60
if : always() && runner.os == 'Windows'
46
61
47
62
- name : Delete output.xml (on Unix-like)
48
63
run : |
49
64
find target/robotframework-reports -type f -name '*output.xml' -exec rm {} +
50
- echo "::set-env name= REPORT_FILE:: $(find target/robotframework-reports -type f -name '*report.html' | sed 's#.*/##')"
65
+ echo "REPORT_FILE= $(find target/robotframework-reports -type f -name '*report.html' | sed 's#.*/##')" >> $GITHUB_ENV
51
66
if : always() && runner.os != 'Windows'
52
67
53
68
- name : Archive acceptances test results
54
- uses : actions/upload-artifact@v1.0.0
69
+ uses : actions/upload-artifact@v2.2.4
55
70
with :
56
71
name : at-results-${{ matrix.browser }}-${{ matrix.os }}-${{ matrix.java-version }}
57
72
path : target/robotframework-reports
58
73
if : always() && job.status == 'failure'
59
74
60
- - name : Upload results
75
+ - name : Upload results on failure
76
+ id : upload_results
61
77
run : |
62
78
echo '<html><head><meta http-equiv = "refresh" content =" 0 ; url = /${{ env.REPORT_FILE }}"></head></html>' > target/robotframework-reports/index.html
63
79
zip -r -j site.zip target/robotframework-reports > no_output 2>&1
64
80
curl -s -H "Content-Type: application/zip" -H "Authorization: Bearer ${{ secrets.NETLIFY_TOKEN }}" --data-binary "@site.zip" https://api.netlify.com/api/v1/sites > response.json
65
- echo "::set-env name=REPORT_URL::$(cat response.json|python -c "import sys, json; print('https://' + json.load(sys.stdin)['subdomain'] + '.netlify.com')")"
66
- echo "::set-env name=JOB_STATUS::$(python -c "print('${{ job.status }}'.lower())")"
81
+ echo "::set-output name=REPORT_URL::$(cat response.json|python -c "import sys, json; print('https://' + json.load(sys.stdin)['subdomain'] + '.netlify.com')")"
82
+ echo "::set-output name=JOB_STATUS::$(python -c "print('${{ job.status }}'.lower())")"
67
83
if : always() && job.status == 'failure'
68
84
69
- - uses : octokit/request-action@57ec46afcc4c58c813af3afe67e57ced1ea9f165
85
+ - uses : octokit/request-action@7e93b91076fad3920c29d44eb2a6311d929db3dd
70
86
name : Update status with Github Status API
71
- id : update_status
87
+ id : update_status_pr
72
88
with :
73
- route : POST /repos/:repository/statuses/:sha
89
+ route : POST /repos/{repository}/statuses/{sha}
90
+ repository : ${{ github.repository }}
91
+ sha : ${{ github.event.pull_request.head.sha }}
92
+ state : " ${{steps.upload_results.outputs.JOB_STATUS}}"
93
+ target_url : " ${{steps.upload_results.outputs.REPORT_URL}}"
94
+ description : " Link to test report."
95
+ context : at-results-${{ matrix.browser }}-${{ matrix.os }}-${{ matrix.java-version }}
96
+ env :
97
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
98
+ if : always() && job.status == 'failure' && github.event.pull_request
99
+
100
+ - uses : octokit/request-action@7e93b91076fad3920c29d44eb2a6311d929db3dd
101
+ name : Update status with Github Status API
102
+ id : update_status_push
103
+ with :
104
+ route : POST /repos/{repository}/statuses/{sha}
74
105
repository : ${{ github.repository }}
75
106
sha : ${{ github.sha }}
76
107
state : " ${{env.JOB_STATUS}}"
@@ -79,21 +110,22 @@ jobs:
79
110
context : at-results-${{ matrix.browser }}-${{ matrix.os }}-${{ matrix.java-version }}
80
111
env :
81
112
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
82
- if : always() && job.status == 'failure'
113
+ if : always() && job.status == 'failure' && github.event.push
83
114
84
115
release :
85
116
needs : [build_and_test]
86
- if : github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/selenium4' || startsWith(github.ref, 'refs/tags/')
117
+ if : github.event.push
87
118
runs-on : ubuntu-latest
88
119
name : Release package
89
120
steps :
90
121
- uses : actions/checkout@v2
91
122
- name : Set up JDK
92
- uses : actions/setup-java@v1.2 .0
123
+ uses : actions/setup-java@v2.3 .0
93
124
with :
125
+ distribution : zulu
94
126
java-version : 8
95
127
- name : Release Maven package
96
- uses : samuelmeuli/action-maven-publish@1221d1fa792cab948a772c5e7c1f3abe84aec3bf
128
+ uses : samuelmeuli/action-maven-publish@201a45a3f311b2ee888f252ba9f4194257545709
97
129
with :
98
130
gpg_private_key : ${{ secrets.gpg_private_key }}
99
131
gpg_passphrase : ${{ secrets.gpg_passphrase }}
0 commit comments