Include testNG project structure into README.md #87
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run tests with allure report | |
on: | |
pull_request: | |
branches: | |
- master | |
paths: | |
- 'aquality-selenium-template/**' | |
- 'aquality-selenium-template-cucumber/**' | |
- 'aquality-selenium-template-testng/**' | |
- 'scripts/**' | |
push: | |
branches: [ master ] | |
workflow_dispatch: | |
inputs: | |
environment: | |
type: choice | |
description: 'Website environment' | |
required: true | |
default: 'stage' | |
options: | |
- prod | |
- stage | |
jobs: | |
build-and-test: | |
env: | |
CUCUMBER_ALLURE_RESULTS: aquality-selenium-template-cucumber/target/allure-results | |
TESTNG_ALLURE_RESULTS: aquality-selenium-template-testng/target/allure-results | |
ENVIRONMENT: ${{ github.event.inputs.environment == '' && 'stage' || github.event.inputs.environment }} | |
GH_PAGES_URL: https://aquality-automation.github.io/aquality-selenium-java-template | |
concurrency: test-${{ github.event.inputs.environment == '' && 'stage' || github.event.inputs.environment }} | |
name: Run tests and generate Allure Report | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
cache: maven | |
- name: Install Google Chrome | |
run: | | |
chmod +x ./scripts/InstallChrome.sh | |
./scripts/InstallChrome.sh | |
- name: Test with Maven | |
id: maven_tests | |
run: mvn test | |
- name: Copy TestNG allure result to the Cucumber allure result | |
if: always() | |
run: cp -r ${{ env.TESTNG_ALLURE_RESULTS }}/. ${{ env.CUCUMBER_ALLURE_RESULTS }} | |
- name: Get Allure history | |
uses: actions/checkout@v2 | |
if: always() | |
continue-on-error: true | |
with: | |
ref: gh-pages | |
path: gh-pages | |
- name: Generate Allure Report | |
uses: simple-elf/allure-report-action@master | |
if: always() | |
id: allure-report | |
with: | |
allure_results: ${{ env.CUCUMBER_ALLURE_RESULTS }} | |
gh_pages: gh-pages | |
allure_report: allure-report | |
allure_history: allure-history | |
keep_reports: 20 | |
- name: Deploy report to Github Pages | |
if: always() | |
uses: peaceiris/actions-gh-pages@v2 | |
env: | |
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PUBLISH_BRANCH: gh-pages | |
PUBLISH_DIR: allure-history | |
- name: Post the link to the report | |
if: always() | |
uses: Sibz/github-status-action@v1 | |
with: | |
authToken: ${{secrets.GITHUB_TOKEN}} | |
context: 'Test report' | |
state: ${{ steps.maven_tests.outcome }} | |
sha: ${{github.event.pull_request.head.sha || github.sha}} | |
target_url: ${{ env.GH_PAGES_URL }}/${{github.run_number}}/ |