Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/actions/restore-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: 'Restore third-party dependencies'
description: 'Restores dependencies from NuGet and npm'

runs:
using: 'composite'
steps:
- name: Restore .NET packages
run: dotnet restore
shell: bash
- name: Restore Node modules
working-directory: CSF.Screenplay.JsonToHtmlReport.Template/src
run: npm ci
shell: bash
62 changes: 62 additions & 0 deletions .github/actions/run-all-tests-with-coverage/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: 'Run all tests, with coverage'
description: 'Runs all tests for CSF.Screenplay (JS and .NET), with coverage; requires that all .NET projects are already built'
inputs:
configuration:
description: 'The .NET configuration'
default: 'Debug'
tfm:
description: 'The .NET Target Framework Moniker'
required: true
test-results-path:
description: 'The path at which to save test results'
default: 'TestResults'
outputs:
failures:
description: 'Gets a value: `true` or `false` indicating whether or not the tests failed'
value: ${{ steps.emit_output.failures }}

runs:
using: 'composite'
steps:
- name: Run .NET tests with coverage
env:
Configuration: ${{ inputs.configuration }}
Tfm: ${{ inputs.tfm }}
id: dotnet_tests
shell: bash {0}
run: |
for proj in Tests/*.Tests
do
projNameArray=(${proj//// })
projName=${projNameArray[1]}
assemblyPath=$proj/bin/$Configuration/$Tfm/$projName.dll
coverlet "$assemblyPath" --target "dotnet" --targetargs "test $proj -c $Configuration --no-build --logger:nunit --test-adapter-path:." -f=opencover -o="${{ inputs.test-results-path }}/$projName.opencover.xml"
exitCode=$?
if [ $exitCode -ne 0 ]
then
echo "One or more tests have failed; this build should eventually fail"
echo "failures=true" >> "$GITHUB_OUTPUT"
fi
done
- name: Run Client script tests with coverage
id: js_tests
shell: bash {0}
working-directory: CSF.Screenplay.JsonToHtmlReport.Template/src
run: |
npm test
exitCode=$?
if [ $exitCode -ne 0 ]
then
echo "One or more tests have failed; this build should eventually fail"
echo "failures=true" >> "$GITHUB_OUTPUT"
fi
- name: Emit output
id: emit_output
run: |
if [ ${{ steps.dotnet_tests.outputs.failures }} -eq 'true' -o ${{ steps.js_tests.outputs.failures }} -eq 'true' ]
then
echo "failures=true" >> "$GITHUB_OUTPUT"
else
echo "failures=false" >> "$GITHUB_OUTPUT"
fi
shell: bash
22 changes: 22 additions & 0 deletions .github/actions/setup-build-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 'Setup build dependencies'
description: 'Installs and configures mandatory dependencies to build CSF.Screenplay'
inputs:
dotnet-version:
description: 'The version of the .NET SDK to install'
default: '8.0.x'

runs:
using: 'composite'
steps:
- name: Add .NET global tools location to PATH
run: echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH"
shell: bash
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version }}
- name: Install DocFX
run: dotnet tool install --global docfx
shell: bash
- name: Install Node.js for building JSON-to-HTML report converter
uses: actions/setup-node@v6.2.0
48 changes: 48 additions & 0 deletions .github/actions/setup-test-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: 'Setup test dependencies'
description: 'Installs and configures additional dependencies to thoroughly test CSF.Screenplay'
inputs:
java-version:
description: 'The version of Java to install'
default: 21
java-dist:
description: 'The distribution of Java to install'
default: 'zulu'
x-display:
description: 'The XServer display to configure for web browsers'
default: ':99'
x-resolution:
description: 'The XServer screen resolution `widthxheight` for web browsers'
default: '1280x1024'

runs:
using: 'composite'
steps:
# Installation
- name: Install SonarScanner
run: dotnet tool install --global dotnet-sonarscanner
shell: bash
- name: Install Coverlet console
run: dotnet tool install --global coverlet.console
shell: bash
- name: Install Java JDK for SonarScanner
uses: actions/setup-java@v5.1.0
with:
java-version: ${{ inputs.java-version }}
distribution: ${{ inputs.java-dist }}

# Prepare to run Chrome
# See https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md
- name: Disable AppArmor restrictions so Chrome may run
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
shell: bash
- name: Start an Xvfb display so Chrome may run
run: Xvfb -ac ${{ inputs.x-display }} -screen 0 ${{ inputs.x-resolution }}x16 &
shell: bash

# Prime Selenium manager with initial config
- name: Setup Selenium Manager config
run: |
mkdir ~/.cache/selenium
cp Tools/se-config.toml ~/.cache/selenium
shell: bash

45 changes: 45 additions & 0 deletions .github/actions/start-sonarscanner/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: 'Start SonarScanner'
description: 'Starts up SonarScanner, to analyse a build & test run'
inputs:
project:
description: 'The SonarQube project name'
required: true
build-version:
description: 'The build version string to pass to SonarQube'
required: true
username:
description: 'The SonarQube login username'
required: true
secret-key:
description: 'The SonarQube secret key'
required: true
sonar-cloud-url:
description: 'The SonarCloud URL'
default: 'https://sonarcloud.io'
js-coverage-path:
description: 'The file system path at which to find the JS lcov report'
required: true
analysis-properties-path:
description: 'The file system path at which to find the SonarQube analysis properties file'
default: '.sonarqube-analysisproperties.xml'


runs:
using: 'composite'
steps:
- name: Start SonarScanner
env:
BranchName: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }}
BranchParam: ${{ github.event_name == 'pull_request' && 'sonar.pullrequest.branch' || 'sonar.branch.name' }}
PullRequestParam: ${{ github.event_name == 'pull_request' && format('/d:sonar.pullrequest.key={0}', github.event.number) || '' }}
shell: bash
run: >
dotnet sonarscanner begin
/k:${{ inputs.project }}
/v:${{ inputs.build-version }}
/o:${{ inputs.username }}
/d:sonar.host.url=${{ inputs.sonar-cloud-url }}
/d:sonar.token=${{ inputs.secret-key }}
/d:${{ env.BranchParam }}=${{ env.BranchName }} ${{ env.PullRequestParam }}
/d:sonar.javascript.lcov.reportPaths=$PWD/${{ inputs.js-coverage-path }}
/s:$PWD/${{ inputs.analysis-properties-path }}
52 changes: 52 additions & 0 deletions .github/actions/upload-ci-artifacts/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: 'Upload CI artifacts'
description: 'Uploads artifacts from a CI run (full build and test), following a full test run'
inputs:
configuration:
description: 'The .NET configuration'
default: 'Debug'
tfm:
description: 'The .NET Target Framework Moniker'
required: true

runs:
using: 'composite'
steps:
- name: Upload .NET test results artifacts
uses: actions/upload-artifact@v7
with:
name: NUnit test results
path: Tests/*.Tests/**/TestResults.xml
- name: Upload verbose webdriver log artifacts
# This step is only relevant if the ChromeDriver with verbose logging is selected, such as via
# appsettings.json in CSF.Screenplay.Selenium.Tests.
# If verbose logs aren't created then this step is skipped to avoid a build warning about missing artifacts.
if: ${{ hashFiles('**/chrome-verbose-log.txt') != '' }}
uses: actions/upload-artifact@v7
with:
name: Verbose webdriver logs
path: '**/chrome-verbose-log.txt'
- name: Upload JS test results artifacts
uses: actions/upload-artifact@v7
with:
name: Client script test results
path: CSF.Screenplay.JsonToHtmlReport.Template/src/TestResults/**/*
- name: Upload Screenplay JSON report artifact
uses: actions/upload-artifact@v7
with:
name: Screenplay JSON reports
path: Tests/**/ScreenplayReport.json
- name: Convert Screenplay reports to HTML
continue-on-error: true
run: |
for report in $(find Tests/ -type f -name "ScreenplayReport.json")
do
reportDir=$(dirname "$report")
outputFile="$reportDir/ScreenplayReport.html"
dotnet run --no-build --framework ${{ inputs.tfm }} -c ${{ inputs.configuration }} --project CSF.Screenplay.JsonToHtmlReport --ReportPath "$report" --OutputPath "$outputFile"
done
shell: bash
- name: Upload Screenplay HTML report artifact
uses: actions/upload-artifact@v7
with:
name: Screenplay HTML reports
path: Tests/**/ScreenplayReport.html
34 changes: 10 additions & 24 deletions .github/workflows/crossBrowserTesting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ concurrency:
cancel-in-progress: false

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_run:
workflows: [.NET CI]
types: [completed]
schedule:
- cron: "27 20 * * 0"

Expand Down Expand Up @@ -61,6 +60,7 @@ jobs:
name: Run tests
runs-on: ubuntu-24.04
timeout-minutes: 30
if: ${{ github.event_name == 'schedule' || github.event.workflow_run.conclusion == 'success' }}

env:
RunNumber: ${{ github.run_number }}.${{ github.run_attempt }}
Expand All @@ -82,27 +82,13 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v6

# Install build dependencies

- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DotnetVersion }}
- name: Install Node.js for building JSON-to-HTML report converter
uses: actions/setup-node@v6.2.0

# Environment setup pre-build

- name: Restore .NET packages
run: dotnet restore
- name: Restore Node modules
run: |
cd CSF.Screenplay.JsonToHtmlReport.Template/src
npm ci
cd ../..

# Build and test the solution
fetch-depth: 0
lfs: true
- name: Setup build dependencies
uses: ./.github/actions/setup-build-dependencies
- name: Restore third party libs
uses: ./.github/actions/restore-dependencies

- name: Build the solution
run: dotnet build -c ${{ env.Configuration }}
Expand Down
Loading
Loading