Skip to content

Update github actions #7

Update github actions

Update github actions #7

name: Test & Report
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
inputs:
testSuite:
description: "Which tests to run"
type: choice
required: true
default: smoke
options:
- smoke
- regression
- LoginPage
- SecureArea
permissions:
contents: write
pages: write
id-token: write
jobs:
test_chromium:
name: Run tests (Chromium)
runs-on: ubuntu-latest
env:
BROWSER: chromium
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- name: Restore
run: dotnet restore Tests.csproj
- name: Build
run: dotnet build Tests.csproj --configuration Release --no-restore
- name: Install Playwright browsers
run: pwsh bin/Release/net8.0/playwright.ps1 install --with-deps
- name: Run tests (Chromium)
env:
TEST_SUITE: ${{ github.event.inputs.testSuite }}
run: |
if [ "$TEST_SUITE" = "smoke" ]; then
FILTER='TestCategory=smoke'
elif [ "$TEST_SUITE" = "regression" ]; then
FILTER=''
elif [ "$TEST_SUITE" = "LoginPage" ]; then
FILTER='FullyQualifiedName~LoginPageTests'
elif [ "$TEST_SUITE" = "SecureArea" ]; then
FILTER='FullyQualifiedName~SecureAreaTests'
else
FILTER=''
fi
if [ -z "$FILTER" ]; then
dotnet test Tests.csproj --configuration Release
else
dotnet test Tests.csproj --configuration Release --filter "$FILTER"
fi
- name: Upload Allure results (Chromium)
if: always()
uses: actions/upload-artifact@v4
with:
name: allure-results-chromium
path: "**/allure-results"
if-no-files-found: ignore
test_firefox:
name: Run tests (Firefox)
runs-on: ubuntu-latest
env:
BROWSER: firefox
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- name: Restore
run: dotnet restore Tests.csproj
- name: Build
run: dotnet build Tests.csproj --configuration Release --no-restore
- name: Install Playwright browsers
run: pwsh bin/Release/net8.0/playwright.ps1 install --with-deps
- name: Run tests (Firefox)
env:
TEST_SUITE: ${{ github.event.inputs.testSuite }}
run: |
if [ "$TEST_SUITE" = "smoke" ]; then
FILTER='TestCategory=smoke'
elif [ "$TEST_SUITE" = "regression" ]; then
FILTER=''
elif [ "$TEST_SUITE" = "LoginPage" ]; then
FILTER='FullyQualifiedName~LoginPageTests'
elif [ "$TEST_SUITE" = "SecureArea" ]; then
FILTER='FullyQualifiedName~SecureAreaTests'
else
FILTER=''
fi
if [ -z "$FILTER" ]; then
dotnet test Tests.csproj --configuration Release
else
dotnet test Tests.csproj --configuration Release --filter "$FILTER"
fi
- name: Upload Allure results (Firefox)
if: always()
uses: actions/upload-artifact@v4
with:
name: allure-results-firefox
path: "**/allure-results"
if-no-files-found: ignore
test_webkit:
name: Run tests (WebKit)
runs-on: ubuntu-latest
env:
BROWSER: webkit
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- name: Restore
run: dotnet restore Tests.csproj
- name: Build
run: dotnet build Tests.csproj --configuration Release --no-restore
- name: Install Playwright browsers
run: pwsh bin/Release/net8.0/playwright.ps1 install --with-deps
- name: Run tests (WebKit)
env:
TEST_SUITE: ${{ github.event.inputs.testSuite }}
run: |
if [ "$TEST_SUITE" = "smoke" ]; then
FILTER='TestCategory=smoke'
elif [ "$TEST_SUITE" = "regression" ]; then
FILTER=''
elif [ "$TEST_SUITE" = "LoginPage" ]; then
FILTER='FullyQualifiedName~LoginPageTests'
elif [ "$TEST_SUITE" = "SecureArea" ]; then
FILTER='FullyQualifiedName~SecureAreaTests'
else
FILTER=''
fi
if [ -z "$FILTER" ]; then
dotnet test Tests.csproj --configuration Release
else
dotnet test Tests.csproj --configuration Release --filter "$FILTER"
fi
- name: Upload Allure results (WebKit)
if: always()
uses: actions/upload-artifact@v4
with:
name: allure-results-webkit
path: "**/allure-results"
if-no-files-found: ignore
report:
name: Generate & Publish Allure report
runs-on: ubuntu-latest
needs:
- test_chromium
- test_firefox
- test_webkit
# Prevent multiple deployments running at the same time
concurrency:
group: pages
cancel-in-progress: false
# Required for GitHub Pages deployment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Allure results
uses: actions/download-artifact@v4
with:
path: ./allure-results
- name: Generate Allure report
if: always()
uses: simple-elf/allure-report-action@v1.13
with:
allure_results: allure-results
allure_report: allure-report
gh_pages: gh-pages
allure_history: allure-history
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./allure-report
retention-days: 1
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4