1- name : Java CI with Maven
1+ name : selenium_test
22
33on :
4+ push :
5+ branches : [main]
46 pull_request :
5- branches : [ main ]
7+ branches : [main]
68
79permissions :
8- contents : write
9- pages : write
10- id-token : write
11- actions : read
1210 checks : write
11+ pull-requests : write
12+ contents : read
1313
1414jobs :
15- build :
16- name : Build On
17-
18- strategy :
19- max-parallel : 4
20- matrix :
21- os : [ ubuntu-latest, windows-latest, macos-13 ]
22-
23- runs-on : ${{ matrix.os }}
24-
15+ selenium_test :
16+ runs-on : ubuntu-latest
2517 steps :
26- - name : Clone code from repo
27- uses : actions/checkout@v4
28- with :
29- fetch-depth : 0
18+ - name : Checkout repository
19+ uses : actions/checkout@v3
3020
3121 - name : Set up JDK 17
32- uses : actions/setup-java@v4
22+ uses : actions/setup-java@v3
3323 with :
24+ distribution : temurin
3425 java-version : ' 17'
35- distribution : ' corretto'
36- cache : maven
3726
38- - name : Cache m2 dependencies
39- uses : actions/cache@v4.0.2
27+ - name : Cache Maven repository
28+ uses : actions/cache@v3
4029 with :
41- path : .m2/repository
30+ path : ~/ .m2
4231 key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
43- restore-keys : |
44- ${{ runner.os }}-maven-
45-
46- - name : Install Firefox on MacOS
47- if : ${{ matrix.os == 'macos-13' }}
48- run : brew install --cask firefox
49-
50- - name : Build with Maven for Ubuntu and macOS
51- if : ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-13' }}
52- run : mvn clean -e install -Dmaven.test.skip=true
53-
54- - name : Build with Maven for Windows
55- if : ${{ matrix.os == 'windows-latest' }}
56- run : mvn clean -e install '-Dmaven.test.skip=true'
57-
58- - name : Set CI_RUN Environment Variable
59- run : echo "CI_RUN=true" >> $GITHUB_ENV
60-
61- - name : Run Framework test
62- run : mvn test -Dtest=FrameworkTest
63-
64- - name : Run tests with Maven on Windows with Firefox
65- if : ${{ matrix.os == 'windows-latest' }}
66- run : mvn test -Pfirefox '-Dsurefire.reportNameSuffix=firefox'
67-
68- - name : Run tests with Maven on macOS with Firefox
69- if : ${{ matrix.os == 'macos-13' }}
70- run : mvn test -Pfirefox -Dsurefire.reportNameSuffix=firefox
71-
72- - name : Run tests with Maven on Windows with Chrome
73- if : ${{ matrix.os == 'windows-latest' }}
74- run : mvn test -Pchrome '-Dsurefire.reportNameSuffix=chrome'
75-
76- - name : Run tests with Maven on macOS with Chrome
77- if : ${{ matrix.os == 'macos-13' }}
78- run : mvn test -Pchrome -Dsurefire.reportNameSuffix=chrome
32+ restore-keys : ${{ runner.os }}-maven-
7933
80- - name : Run 'Smoke' group tests on Ubuntu
81- if : ${{ matrix.os == 'ubuntu-latest' }}
82- run : mvn test -Psmoke
34+ - name : Install Chrome
35+ uses : browser-actions/setup-chrome@latest
8336
84- - name : Run 'Regression' group tests on Ubuntu
85- if : ${{ matrix.os == 'ubuntu-latest' }}
86- run : mvn test -Pregression
37+ - name : Run Maven tests
38+ run : mvn clean test
8739
88- - name : Run cross-browser testing on Ubuntu with Chrome and Firefox
89- if : ${{ matrix.os == 'ubuntu-latest' }}
90- run : mvn test -PcrossBrowser
91-
92- - name : Run File loading test
93- if : ${{ matrix.os == 'ubuntu-latest' }}
94- run : mvn test -Dtest=FileLoadingTest
95-
96- - name : Test Reporter
97- uses : dorny/test-reporter@v1.9.1
98- if : success() || failure()
99- with :
100- name : Opencart project test report for ${{ matrix.os }}
101- path : target/surefire-reports/TEST-*.xml
102- reporter : java-junit
103-
104- - name : Load Allure test report history
105- uses : actions/checkout@v4
106- if : ${{ matrix.os == 'ubuntu-latest' }}
107- continue-on-error : true
40+ - name : Upload Surefire Reports (for debugging)
41+ if : failure() # Загружаем отчеты только в случае ошибки
42+ uses : actions/upload-artifact@v4
10843 with :
109- ref : gh-pages
110- path : gh-pages
44+ name : surefire-reports
45+ path : target/surefire-reports
11146
112- - name : Build Allure test report
113- uses : simple-elf/allure-report-action@v1.7
114- if : ${{ matrix.os == 'ubuntu-latest' }}
115- with :
116- gh_pages : gh-pages
117- allure_history : allure-history
118- allure_results : target/allure-results
47+ - name : Generate Allure Report
48+ run : mvn allure:report
11949
120- - name : Publish Allure test report
121- uses : peaceiris/actions-gh-pages@v3
122- if : ${{ matrix.os == 'ubuntu-latest' }}
123- with :
124- github_token : ${{ secrets.GITHUB_TOKEN }}
125- publish_branch : gh-pages
126- publish_dir : allure-history
127-
128- - name : Attach screenshots
50+ - name : Upload Allure Report Artifact
12951 uses : actions/upload-artifact@v4
130- if : always()
13152 with :
132- path : screenshots
133-
134- check-java-code-style :
135- name : Check Java code style
136- runs-on : ubuntu-latest
53+ name : allure-report
54+ path : target/site/allure-maven-plugin
13755
138- steps :
139- - name : Clone code from repo
140- uses : actions/checkout@v4
56+ - name : Deploy Allure Report to GitHub Pages
57+ uses : peaceiris/actions-gh-pages@v3
14158 with :
142- fetch-depth : 0
59+ github_token : ${{ secrets.EPOLIF_TOKEN }}
60+ publish_dir : target/site/allure-maven-plugin
0 commit comments