Skip to content

Update CI

Update CI #10

Workflow file for this run

name: Java CI with Maven
on:
pull_request:
branches: [ main ]
permissions:
contents: write
pages: write
id-token: write
actions: read
checks: write
jobs:
build:
name: Build On
strategy:
max-parallel: 4
matrix:
os: [ ubuntu-latest, windows-latest, macos-13 ]
runs-on: ${{ matrix.os }}
steps:
- name: Clone code from repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
cache: maven
- name: Cache m2 dependencies
uses: actions/cache@v4.0.2
with:
path: .m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Install Firefox on MacOS
if: ${{ matrix.os == 'macos-13' }}
run: brew install --cask firefox
- name: Build with Maven for Ubuntu and macOS
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-13' }}
run: mvn clean -e install -Dmaven.test.skip=true
- name: Build with Maven for Windows
if: ${{ matrix.os == 'windows-latest' }}
run: mvn clean -e install '-Dmaven.test.skip=true'
- name: Set CI_RUN Environment Variable
run: echo "CI_RUN=true" >> $GITHUB_ENV
- name: Run Framework test
run: mvn test -Dtest=FrameworkTest
- name: Run tests with Maven on Windows with Firefox
if: ${{ matrix.os == 'windows-latest' }}
run: mvn test -Pfirefox '-Dsurefire.reportNameSuffix=firefox'
- name: Run tests with Maven on macOS with Firefox
if: ${{ matrix.os == 'macos-13' }}
run: mvn test -Pfirefox -Dsurefire.reportNameSuffix=firefox
- name: Run tests with Maven on Windows with Chrome
if: ${{ matrix.os == 'windows-latest' }}
run: mvn test -Pchrome '-Dsurefire.reportNameSuffix=chrome'
- name: Run tests with Maven on macOS with Chrome
if: ${{ matrix.os == 'macos-13' }}
run: mvn test -Pchrome -Dsurefire.reportNameSuffix=chrome
- name: Run 'Smoke' group tests on Ubuntu
if: ${{ matrix.os == 'ubuntu-latest' }}
run: mvn test -Psmoke
- name: Run 'Regression' group tests on Ubuntu
if: ${{ matrix.os == 'ubuntu-latest' }}
run: mvn test -Pregression
- name: Run cross-browser testing on Ubuntu with Chrome and Firefox
if: ${{ matrix.os == 'ubuntu-latest' }}
run: mvn test -PcrossBrowser
- name: Run File loading test
if: ${{ matrix.os == 'ubuntu-latest' }}
run: mvn test -Dtest=FileLoadingTest
- name: Test Reporter
uses: dorny/test-reporter@v1.9.1
if: success() || failure()
with:
name: Opencart project test report for ${{ matrix.os }}
path: target/surefire-reports/TEST-*.xml
reporter: java-junit
- name: Load Allure test report history
uses: actions/checkout@v4
if: ${{ matrix.os == 'ubuntu-latest' }}
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
- name: Build Allure test report
uses: simple-elf/allure-report-action@v1.7
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
gh_pages: gh-pages
allure_history: allure-history
allure_results: target/allure-results
- name: Publish Allure test report
uses: peaceiris/actions-gh-pages@v3
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: allure-history
- name: Attach screenshots
uses: actions/upload-artifact@v4
if: always()
with:
path: screenshots
check-java-code-style:
name: Check Java code style
runs-on: ubuntu-latest
steps:
- name: Clone code from repo
uses: actions/checkout@v4
with:
fetch-depth: 0