Skip to content

[Mobile] force an exception if appium session is not opened #51

[Mobile] force an exception if appium session is not opened

[Mobile] force an exception if appium session is not opened #51

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Build WebEngine (Main Branch Only)
on:
pull_request:
branches:
- main
- 'preview/**'
- preview
jobs:
build:
runs-on: windows-latest
steps:
# checkout
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Install .NET Coverage
run: |
dotnet tool install --global dotnet-coverage
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v1
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
dotnet tool install --global dotnet-sonarscanner --version 5.2.0
# Restore
- name: Restore
run: dotnet restore "./src"
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
if("${{github.base_ref}}".Contains("main")) { $suffix = "" } else { $suffix = "-preview" }
.\.sonar\scanner\dotnet-sonarscanner begin /k:"AxaGuilDEv_webengine-dotnet" /o:"axaguildev" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
dotnet build "./src" --no-restore --configuration Debug -p:AssemblyVersion=1.2.${{github.run_number}} -p:Version=1.2.${{github.run_number}}$suffix
dotnet-coverage collect 'dotnet test "./src/WebEngine.Test" --filter TestCategory!=Mobile' -f xml -o 'coverage.xml'
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
#Do not run dotnet pack because the project is already configured to generate nupkg during build.
#- name: Dotnet Pack
# run: dotnet pack "./src" --no-restore --no-build -p:PackageVersion=1.1.${{github.run_number}} -o "./nuget"
- name: Copy package to artifact folder
shell: powershell
run: |
mkdir "nuget"
Get-ChildItem ./src -Recurse -File -Filter Axa*.nupkg | % {Copy-Item -Path $_.FullName -Destination "./nuget/$_"}
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: build-artifact
path: "./nuget"
- name: Publish Nuget to GitHub registry
run: dotnet nuget push 'nuget/**/AxaFrance*.nupkg' -k ${{ secrets.NUGET_TOKEN }} -s 'https://api.nuget.org/v3/index.json' --skip-duplicate
- name: Tag commit
uses: tvdias/[email protected]
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
tag: "1.1.${{github.run_number}}"