Skip to content

Upgrade to .NET 8 and update package versions (#18) #82

Upgrade to .NET 8 and update package versions (#18)

Upgrade to .NET 8 and update package versions (#18) #82

name: Run tests with allure report
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
paths:
- 'Aquality.Selenium.Template/**'
- 'scripts/**'
workflow_dispatch:
inputs:
environment:
type: choice
description: 'Website environment'
required: true
default: 'Stage'
options:
- Prod
- Stage
jobs:
build-and-test:
env:
BUILD_CONFIGURATION: Release
SOLUTION_NAME: Aquality.Selenium.Template/Aquality.Selenium.Template.sln
ALLURE_RESULTS: Aquality.Selenium.Template/Aquality.Selenium.Template.SpecFlow/bin/Release/net8.0/allure-results
ALLURE_NUNIT_RESULTS: Aquality.Selenium.Template/Aquality.Selenium.Template.NUnit/bin/Release/net8.0/allure-results
ENVIRONMENT: ${{ github.event.inputs.environment == '' && 'Stage' || github.event.inputs.environment }}
GH_PAGES_URL: https://aquality-automation.github.io/aquality-selenium-dotnet-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: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Install Google Chrome
run: |
chmod +x ./scripts/InstallChrome.sh
./scripts/InstallChrome.sh
- name: Build
run: dotnet build ${{ env.SOLUTION_NAME }} -c ${{ env.BUILD_CONFIGURATION }}
- name: Test
id: dotnet_test
run: dotnet test --no-build ${{ env.SOLUTION_NAME }} -c ${{ env.BUILD_CONFIGURATION }}
- name: Copy NUnit allure result to the SpecFlow allure result
if: always()
run: cp -r ${{ env.ALLURE_NUNIT_RESULTS }}/. ${{ env.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.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.dotnet_test.outcome }}
sha: ${{github.event.pull_request.head.sha || github.sha}}
target_url: ${{ env.GH_PAGES_URL }}/${{github.run_number}}/