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
+ exclude :
40
+ - os : macos-latest
41
+ browser : firefoxheadless # Webdriver download if not working with Firefox at GHA
42
+ java-version : 8
43
+
26
44
runs-on : ${{ matrix.os }}
27
45
name : Test on ${{ matrix.os }} with Java ${{ matrix.java-version }} using browser ${{ matrix.browser }}
28
46
steps :
29
47
- uses : actions/checkout@v2
30
48
- name : Set up JDK ${{ matrix.java-version }}
31
- uses : actions/setup-java@v1.2 .0
49
+ uses : actions/setup-java@v2.3 .0
32
50
with :
51
+ distribution : zulu
33
52
java-version : ${{ matrix.java-version }}
34
53
java-package : jdk+fx # needed for jbrowser
35
54
- name : Set up other dependencies
36
55
run : |
37
56
${{ matrix.install_dependencies }}
38
57
${{ matrix.set_display }}
39
58
- name : Build with Maven
40
- run : mvn -B verify --file pom.xml -P 'build,${{ matrix.browser }}'
59
+ run : mvn -B -ntp -q verify --file pom.xml -P 'build,${{ matrix.browser }}'
41
60
- name : Delete output.xml (on Win)
42
61
run : |
43
62
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)"
63
+ echo "REPORT_FILE= $(Get-ChildItem target/robotframework-reports -Include *report.html -Recurse -Name)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
45
64
if : always() && runner.os == 'Windows'
46
65
47
66
- name : Delete output.xml (on Unix-like)
48
67
run : |
49
68
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#.*/##')"
69
+ echo "REPORT_FILE= $(find target/robotframework-reports -type f -name '*report.html' | sed 's#.*/##')" >> $GITHUB_ENV
51
70
if : always() && runner.os != 'Windows'
52
71
53
72
- name : Archive acceptances test results
54
- uses : actions/upload-artifact@v1.0.0
73
+ uses : actions/upload-artifact@v2.2.4
55
74
with :
56
75
name : at-results-${{ matrix.browser }}-${{ matrix.os }}-${{ matrix.java-version }}
57
76
path : target/robotframework-reports
58
77
if : always() && job.status == 'failure'
59
78
60
- - name : Upload results
79
+ - name : Upload results on failure
80
+ id : upload_results
61
81
run : |
62
82
echo '<html><head><meta http-equiv = "refresh" content =" 0 ; url = /${{ env.REPORT_FILE }}"></head></html>' > target/robotframework-reports/index.html
63
83
zip -r -j site.zip target/robotframework-reports > no_output 2>&1
64
84
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())")"
85
+ echo "::set-output name=REPORT_URL::$(cat response.json|python -c "import sys, json; print('https://' + json.load(sys.stdin)['subdomain'] + '.netlify.com')")"
86
+ echo "::set-output name=JOB_STATUS::$(python -c "print('${{ job.status }}'.lower())")"
67
87
if : always() && job.status == 'failure'
68
88
69
- - uses : octokit/request-action@57ec46afcc4c58c813af3afe67e57ced1ea9f165
89
+ - uses : octokit/request-action@7e93b91076fad3920c29d44eb2a6311d929db3dd
70
90
name : Update status with Github Status API
71
- id : update_status
91
+ id : update_status_pr
72
92
with :
73
- route : POST /repos/:repository/statuses/:sha
93
+ route : POST /repos/{repository}/statuses/{sha}
94
+ repository : ${{ github.repository }}
95
+ sha : ${{ github.event.pull_request.head.sha }}
96
+ state : " ${{steps.upload_results.outputs.JOB_STATUS}}"
97
+ target_url : " ${{steps.upload_results.outputs.REPORT_URL}}"
98
+ description : " Link to test report."
99
+ context : at-results-${{ matrix.browser }}-${{ matrix.os }}-${{ matrix.java-version }}
100
+ env :
101
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
102
+ if : always() && job.status == 'failure' && github.event.pull_request
103
+
104
+ - uses : octokit/request-action@7e93b91076fad3920c29d44eb2a6311d929db3dd
105
+ name : Update status with Github Status API
106
+ id : update_status_push
107
+ with :
108
+ route : POST /repos/{repository}/statuses/{sha}
74
109
repository : ${{ github.repository }}
75
110
sha : ${{ github.sha }}
76
111
state : " ${{env.JOB_STATUS}}"
@@ -79,21 +114,22 @@ jobs:
79
114
context : at-results-${{ matrix.browser }}-${{ matrix.os }}-${{ matrix.java-version }}
80
115
env :
81
116
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
82
- if : always() && job.status == 'failure'
117
+ if : always() && job.status == 'failure' && github.event.push
83
118
84
119
release :
85
120
needs : [build_and_test]
86
- if : github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/selenium4' || startsWith(github.ref, 'refs/tags/')
121
+ if : github.event.push
87
122
runs-on : ubuntu-latest
88
123
name : Release package
89
124
steps :
90
125
- uses : actions/checkout@v2
91
126
- name : Set up JDK
92
- uses : actions/setup-java@v1.2 .0
127
+ uses : actions/setup-java@v2.3 .0
93
128
with :
129
+ distribution : zulu
94
130
java-version : 8
95
131
- name : Release Maven package
96
- uses : samuelmeuli/action-maven-publish@1221d1fa792cab948a772c5e7c1f3abe84aec3bf
132
+ uses : samuelmeuli/action-maven-publish@201a45a3f311b2ee888f252ba9f4194257545709
97
133
with :
98
134
gpg_private_key : ${{ secrets.gpg_private_key }}
99
135
gpg_passphrase : ${{ secrets.gpg_passphrase }}
0 commit comments