-
Notifications
You must be signed in to change notification settings - Fork 4
94 lines (82 loc) · 2.93 KB
/
test-with-allure-report.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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}}/