Skip to content

Run DotNet examples #1122

Run DotNet examples

Run DotNet examples #1122

name: Run DotNet examples
on:
schedule:
- cron: '35 22 * * *'
workflow_dispatch:
pull_request:
branches:
- trunk
paths:
- 'examples/dotnet/**'
push:
branches:
- trunk
paths:
- 'examples/dotnet/**'
env:
DISPLAY: :99
GITHUB_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }}
GH_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }}
jobs:
tests:
strategy:
fail-fast: false
matrix:
os: [ ubuntu, windows, macos ]
release: [ stable, nightly ]
runs-on: ${{ format('{0}-latest', matrix.os) }}
steps:
- name: Checkout GitHub repo
uses: actions/checkout@v4
- name: Remove driver directories Windows
if: matrix.os == 'windows'
run: |
rm "$env:ChromeWebDriver" -r -v
rm "$env:EdgeWebDriver" -r -v
rm "$env:GeckoWebDriver" -r -v
- name: Remove driver directories Non-Windows
if: matrix.os != 'windows'
run: |
sudo rm -rf $CHROMEWEBDRIVER $EDGEWEBDRIVER $GECKOWEBDRIVER
- name: Start Xvfb
if: matrix.os == 'ubuntu'
run: Xvfb :99 &
- name: Set up .Net Stable
if: matrix.release == 'stable'
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.x
- name: Set up .Net Nightly
if: matrix.release == 'nightly'
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.x
source-url: https://nuget.pkg.github.com/seleniumhq/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Update Nightly version non-Windows
if: matrix.release == 'nightly' && matrix.os != 'windows'
run:
|
latest_nightly=$(./scripts/latest-nightly-version.sh nuget Selenium.WebDriver)
dotnet add examples/dotnet/SeleniumDocs/SeleniumDocs.csproj package Selenium.WebDriver --version $latest_nightly
dotnet add examples/dotnet/SeleniumDocs/SeleniumDocs.csproj package Selenium.Support --version $latest_nightly
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Nightly version Windows
if: matrix.release == 'nightly' && matrix.os == 'windows'
shell: pwsh
run:
|
$latest_nightly = ./scripts/latest-nightly-version.ps1 nuget Selenium.WebDriver
dotnet add examples/dotnet/SeleniumDocs/SeleniumDocs.csproj package Selenium.WebDriver --version $latest_nightly
dotnet add examples/dotnet/SeleniumDocs/SeleniumDocs.csproj package Selenium.Support --version $latest_nightly
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
- name: Run tests
uses: nick-fields/[email protected]
with:
timeout_minutes: 20
max_attempts: 3
command: |
cd examples/dotnet/SeleniumDocs
dotnet test