-
Notifications
You must be signed in to change notification settings - Fork 3
184 lines (162 loc) · 6.08 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: Run tests with allure report
on:
pull_request:
branches:
- master
paths:
- 'Aquality.Appium.Mobile.Template/**'
- 'scripts/**'
push:
branches: [ master ]
workflow_dispatch:
inputs:
environment:
type: choice
description: 'App environment'
required: true
default: 'stage'
options:
- prod
- stage
jobs:
build-and-test-android:
env:
platformName: android
BUILD_CONFIGURATION: Release
SOLUTION_NAME: Aquality.Appium.Mobile.Template/Aquality.Appium.Mobile.Template.sln
ALLURE_RESULTS: Aquality.Appium.Mobile.Template/Aquality.Appium.Mobile.Template.SpecFlow/bin/android/Release/net8.0/allure-results
ENVIRONMENT: ${{ github.event.inputs.environment == '' && 'stage' || github.event.inputs.environment }}
ANDROID_PROFILE: Nexus 6
ANDROID_TARGET: google_apis
ANDROID_API_LEVEL: 28
ANDROID_ARCH: x86_64
concurrency: test-android-${{ github.event.inputs.environment == '' && 'stage' || github.event.inputs.environment }}
name: Run tests against Android
runs-on: macos-12
outputs:
dotnet_tests: ${{ steps.dotnet_tests.outcome }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Install and Run Appium Server
run: |
chmod +x ./scripts/PrepareAppiumServerForAndroid.sh
./scripts/PrepareAppiumServerForAndroid.sh
- name: Build
run: dotnet build ${{ env.SOLUTION_NAME }} -c ${{ env.BUILD_CONFIGURATION }}
- name: Test against Android
id: dotnet_tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.ANDROID_API_LEVEL }}
target: ${{ env.ANDROID_TARGET }}
arch: ${{ env.ANDROID_ARCH }}
profile: ${{ env.ANDROID_PROFILE }}
script: dotnet test --no-build ${{ env.SOLUTION_NAME }} -c ${{ env.BUILD_CONFIGURATION }}
- name: Upload results as artifacts
if: always()
uses: actions/upload-artifact@master
with:
name: allure-results-android
path: ${{ env.ALLURE_RESULTS }}
build-and-test-ios:
env:
platformName: ios
BUILD_CONFIGURATION: Release
SOLUTION_NAME: Aquality.Appium.Mobile.Template/Aquality.Appium.Mobile.Template.sln
ALLURE_RESULTS: Aquality.Appium.Mobile.Template/Aquality.Appium.Mobile.Template.SpecFlow/bin/ios/Release/net6.0/allure-results
ENVIRONMENT: ${{ github.event.inputs.environment == '' && 'stage' || github.event.inputs.environment }}
IOS_SIM_MODEL: iPhone 8
concurrency: test-ios-${{ github.event.inputs.environment == '' && 'stage' || github.event.inputs.environment }}
name: Run tests against iOS
runs-on: macos-12
outputs:
dotnet_tests: ${{ steps.dotnet_tests.outcome }}
steps:
- uses: actions/checkout@v3
- name: Install and Run Appium Server
run: |
chmod +x ./scripts/PrepareAppiumServerForIos.sh
./scripts/PrepareAppiumServerForIos.sh
- name: Setup iOS simulator
if: always()
uses: futureware-tech/simulator-action@v2
with:
model: ${{ env.IOS_SIM_MODEL }}
shutdown_after_job: false
- name: "Wait for simulator to be ready"
run: |
SIM_UID="$(xcrun simctl list devices | grep -m 1 "$IOS_SIM_MODEL" | grep -E -o -i "([0-9A-F]{8}-([0-9A-F]{4}-){3}[0-9A-F]{12})")"
xcrun simctl bootstatus $SIM_UID
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Build
run: dotnet build ${{ env.SOLUTION_NAME }} -c ${{ env.BUILD_CONFIGURATION }}
- name: Test against iOS
if: always()
id: dotnet_tests
run: dotnet test --no-build ${{ env.SOLUTION_NAME }} -c ${{ env.BUILD_CONFIGURATION }}
- name: Upload results as artifacts
if: always()
uses: actions/upload-artifact@master
with:
name: allure-results-ios
path: ${{ env.ALLURE_RESULTS }}
deploy-report:
if: always()
name: Generate and deploy Allure Report
needs: [build-and-test-android, build-and-test-ios]
runs-on: ubuntu-latest
env:
GH_PAGES_URL: https://aquality-automation.github.io/aquality-appium-mobile-dotnet-template
steps:
- name: Get Allure history
uses: actions/checkout@v3
if: always()
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
- name: Download Android results artifacts
if: always()
uses: actions/download-artifact@master
with:
name: allure-results-android
path: target/allure-results
- name: Download iOS results artifacts
if: always()
uses: actions/download-artifact@master
with:
name: allure-results-ios
path: target/allure-results
- name: Generate Allure Report
uses: simple-elf/allure-report-action@master
if: always()
id: allure-report
with:
allure_results: target/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: ${{ needs.build-and-test-android.outputs.dotnet_tests == 'success' && needs.build-and-test-ios.outputs.dotnet_tests == 'success' && 'success' || 'failure' }}
sha: ${{github.event.pull_request.head.sha || github.sha}}
target_url: ${{ env.GH_PAGES_URL }}/${{github.run_number}}/