Skip to content

Commit 33125cb

Browse files
committed
WIP #238 - Add CI for Reqnroll support verification
1 parent 2138ddb commit 33125cb

2 files changed

Lines changed: 177 additions & 142 deletions

File tree

.github/workflows/dotnetCi.yml

Lines changed: 139 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -41,152 +41,149 @@ jobs:
4141
DISPLAY: :99
4242

4343
steps:
44-
- name: Checkout
45-
uses: actions/checkout@v4
46-
47-
# Install build dependencies
48-
49-
- name: Add .NET global tools location to PATH
50-
run: echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH"
51-
- name: Install .NET
52-
uses: actions/setup-dotnet@v4
53-
with:
54-
dotnet-version: ${{ env.DotnetVersion }}
55-
- name: Install SonarScanner
56-
run: dotnet tool install --global dotnet-sonarscanner
57-
- name: Install Coverlet console
58-
run: dotnet tool install --global coverlet.console
59-
- name: Install DocFX
60-
run: dotnet tool install --global docfx
61-
- name: Install Node.js for building JSON-to-HTML report converter
62-
uses: actions/setup-node@v6.2.0
63-
- name: Install Java JDK for SonarScanner
64-
uses: actions/setup-java@v5.1.0
65-
with:
66-
java-version: 21
67-
distribution: 'zulu'
68-
- name: Install GUI packages so Chrome may run
69-
run: |
70-
sudo apt-get update
71-
sudo apt install -y xorg xvfb gtk2-engines-pixbuf dbus-x11 xfonts-base xfonts-100dpi xfonts-75dpi xfonts-cyrillic xfonts-scalable psmisc
72-
73-
# Environment setup pre-build
74-
75-
- name: Setup Selenium Manager config
76-
run: |
77-
mkdir ~/.cache/selenium
78-
cp Tools/se-config.toml ~/.cache/selenium
79-
- name: Start an Xvfb display so Chrome may run
80-
run: Xvfb -ac $DISPLAY -screen 0 1280x1024x16 &
81-
- name: Restore .NET packages
82-
run: dotnet restore
83-
- name: Restore Node modules
84-
run: |
85-
cd CSF.Screenplay.JsonToHtmlReport.Template/src
86-
npm ci
87-
cd ../..
88-
89-
# Build and test the solution
90-
91-
- name: Start SonarScanner
92-
run: >
93-
dotnet sonarscanner begin
94-
/k:${{ env.SonarCloudProject }}
95-
/v:GitHub_build_${{ env.RunNumber }}
96-
/o:${{ env.SonarCloudUsername }}
97-
/d:sonar.host.url=${{ env.SonarCloudUrl }}
98-
/d:sonar.token=${{ env.SonarCloudSecretKey }}
99-
/d:${{ env.BranchParam }}=${{ env.BranchName }} ${{ env.PullRequestParam }}
100-
/d:sonar.javascript.lcov.reportPaths=CSF.Screenplay.JsonToHtmlReport.Template/src/TestResults/lcov.info
101-
/s:$PWD/.sonarqube-analysisproperties.xml
102-
- name: Build the solution
103-
run: dotnet build -c ${{ env.Configuration }} --no-incremental
104-
- name: Run .NET tests with coverage
105-
id: dotnet_tests
106-
continue-on-error: true
107-
run: |
108-
for proj in Tests/*.Tests
109-
do
110-
projNameArray=(${proj//// })
111-
projName=${projNameArray[1]}
112-
assemblyPath=$proj/bin/$Configuration/$Tfm/$projName.dll
113-
coverlet "$assemblyPath" --target "dotnet" --targetargs "test $proj -c $Configuration --no-build --logger:nunit --test-adapter-path:." -f=opencover -o="TestResults/$projName.opencover.xml"
44+
- name: Checkout
45+
uses: actions/checkout@v4
46+
47+
# Install build dependencies
48+
49+
- name: Add .NET global tools location to PATH
50+
run: echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH"
51+
- name: Install .NET
52+
uses: actions/setup-dotnet@v4
53+
with:
54+
dotnet-version: ${{ env.DotnetVersion }}
55+
- name: Install SonarScanner
56+
run: dotnet tool install --global dotnet-sonarscanner
57+
- name: Install Coverlet console
58+
run: dotnet tool install --global coverlet.console
59+
- name: Install DocFX
60+
run: dotnet tool install --global docfx
61+
- name: Install Node.js for building JSON-to-HTML report converter
62+
uses: actions/setup-node@v6.2.0
63+
- name: Install Java JDK for SonarScanner
64+
uses: actions/setup-java@v5.1.0
65+
with:
66+
java-version: 21
67+
distribution: 'zulu'
68+
- name: Install GUI packages so Chrome may run
69+
run: |
70+
sudo apt-get update
71+
sudo apt install -y xorg xvfb gtk2-engines-pixbuf dbus-x11 xfonts-base xfonts-100dpi xfonts-75dpi xfonts-cyrillic xfonts-scalable psmisc
72+
73+
# Environment setup pre-build
74+
75+
- name: Setup Selenium Manager config
76+
run: |
77+
mkdir ~/.cache/selenium
78+
cp Tools/se-config.toml ~/.cache/selenium
79+
- name: Start an Xvfb display so Chrome may run
80+
run: Xvfb -ac $DISPLAY -screen 0 1280x1024x16 &
81+
- name: Restore .NET packages
82+
run: dotnet restore
83+
- name: Restore Node modules
84+
run: |
85+
cd CSF.Screenplay.JsonToHtmlReport.Template/src
86+
npm ci
87+
cd ../..
88+
89+
# Build and test the solution
90+
91+
- name: Start SonarScanner
92+
run: >
93+
dotnet sonarscanner begin
94+
/k:${{ env.SonarCloudProject }}
95+
/v:GitHub_build_${{ env.RunNumber }}
96+
/o:${{ env.SonarCloudUsername }}
97+
/d:sonar.host.url=${{ env.SonarCloudUrl }}
98+
/d:sonar.token=${{ env.SonarCloudSecretKey }}
99+
/d:${{ env.BranchParam }}=${{ env.BranchName }} ${{ env.PullRequestParam }}
100+
/d:sonar.javascript.lcov.reportPaths=CSF.Screenplay.JsonToHtmlReport.Template/src/TestResults/lcov.info
101+
/s:$PWD/.sonarqube-analysisproperties.xml
102+
- name: Build the solution
103+
run: dotnet build -c ${{ env.Configuration }} --no-incremental
104+
- name: Run .NET tests with coverage
105+
id: dotnet_tests
106+
continue-on-error: true
107+
run: |
108+
for proj in Tests/*.Tests
109+
do
110+
projNameArray=(${proj//// })
111+
projName=${projNameArray[1]}
112+
assemblyPath=$proj/bin/$Configuration/$Tfm/$projName.dll
113+
coverlet "$assemblyPath" --target "dotnet" --targetargs "test $proj -c $Configuration --no-build --logger:nunit --test-adapter-path:." -f=opencover -o="TestResults/$projName.opencover.xml"
114+
if [ $? -ne 0 ]
115+
then
116+
echo "failures=true" >> $GITHUB_OUTPUT
117+
fi
118+
done
119+
- name: Run JavaScript tests with coverage
120+
id: js_tests
121+
continue-on-error: true
122+
run: |
123+
cd CSF.Screenplay.JsonToHtmlReport.Template/src
124+
npm test
114125
if [ $? -ne 0 ]
115126
then
116127
echo "failures=true" >> $GITHUB_OUTPUT
117128
fi
118-
done
119-
- name: Run JavaScript tests with coverage
120-
id: js_tests
121-
continue-on-error: true
122-
run: |
123-
cd CSF.Screenplay.JsonToHtmlReport.Template/src
124-
npm test
125-
if [ $? -ne 0 ]
126-
then
127-
echo "failures=true" >> $GITHUB_OUTPUT
128-
fi
129-
cd ../..
130-
131-
# Post-test tasks (artifacts, overall status)
132-
133-
- name: Stop SonarScanner
134-
run:
135-
dotnet sonarscanner end /d:sonar.token=${{ env.SonarCloudSecretKey }}
136-
- name: Gracefully stop Xvfb
137-
run: killall Xvfb
138-
continue-on-error: true
139-
- name: Upload test results artifacts
140-
uses: actions/upload-artifact@v4
141-
with:
142-
name: NUnit test results
143-
path: Tests/*.Tests/**/TestResults.xml
144-
- name: Upload Screenplay JSON report artifact
145-
uses: actions/upload-artifact@v4
146-
with:
147-
name: Screenplay JSON reports
148-
path: Tests/**/ScreenplayReport_*.json
149-
- name: Convert Screenplay reports to HTML
150-
continue-on-error: true
151-
run: |
152-
for report in $(find Tests/ -type f -name "ScreenplayReport_*.json")
153-
do
154-
reportDir=$(dirname "$report")
155-
outputFile="$reportDir/ScreenplayReport.html"
156-
dotnet run --no-build --framework $Tfm --project CSF.Screenplay.JsonToHtmlReport --ReportPath "$report" --OutputPath "$outputFile"
157-
done
158-
- name: Upload Screenplay HTML report artifact
159-
uses: actions/upload-artifact@v4
160-
with:
161-
name: Screenplay HTML reports
162-
path: Tests/**/ScreenplayReport.html
163-
- name: Fail the build if any test failures
164-
if: ${{ steps.dotnet_tests.outputs.failures == 'true' || steps.js_tests.outputs.failures == 'true' }}
165-
run: |
166-
echo "Failing the build due to test failures"
167-
exit 1
168-
169-
# Build the apps in release mode and publish artifacts
170-
171-
- name: Clean the solution ahead of building in release config
172-
run: dotnet clean
173-
- name: Build, in release configuration
174-
run: dotnet pack -p:VersionSuffix=$VersionSuffix -o packages
175-
- name: Upload build result artifacts
176-
uses: actions/upload-artifact@v4
177-
with:
178-
name: Build results (NuGet)
179-
path: packages/*.nupkg
180-
- name: Build docs website
181-
run: dotnet build -c Docs
182-
- name: Upload docs website artifact
183-
uses: actions/upload-artifact@v4
184-
with:
185-
name: Docs website
186-
path: docs/**/*
187-
188-
# publishDocs:
189-
# TODO: Take the docco site artifact and publish it to master
129+
cd ../..
130+
131+
# Post-test tasks (artifacts, overall status)
132+
133+
- name: Stop SonarScanner
134+
run:
135+
dotnet sonarscanner end /d:sonar.token=${{ env.SonarCloudSecretKey }}
136+
- name: Gracefully stop Xvfb
137+
run: killall Xvfb
138+
continue-on-error: true
139+
- name: Upload test results artifacts
140+
uses: actions/upload-artifact@v4
141+
with:
142+
name: NUnit test results
143+
path: Tests/*.Tests/**/TestResults.xml
144+
- name: Upload Screenplay JSON report artifact
145+
uses: actions/upload-artifact@v4
146+
with:
147+
name: Screenplay JSON reports
148+
path: Tests/**/ScreenplayReport_*.json
149+
- name: Convert Screenplay reports to HTML
150+
continue-on-error: true
151+
run: |
152+
for report in $(find Tests/ -type f -name "ScreenplayReport_*.json")
153+
do
154+
reportDir=$(dirname "$report")
155+
outputFile="$reportDir/ScreenplayReport.html"
156+
dotnet run --no-build --framework $Tfm --project CSF.Screenplay.JsonToHtmlReport --ReportPath "$report" --OutputPath "$outputFile"
157+
done
158+
- name: Upload Screenplay HTML report artifact
159+
uses: actions/upload-artifact@v4
160+
with:
161+
name: Screenplay HTML reports
162+
path: Tests/**/ScreenplayReport.html
163+
- name: Fail the build if any test failures
164+
if: ${{ steps.dotnet_tests.outputs.failures == 'true' || steps.js_tests.outputs.failures == 'true' }}
165+
run: |
166+
echo "Failing the build due to test failures"
167+
exit 1
168+
169+
# Build the apps in release mode and publish artifacts
170+
171+
- name: Clean the solution ahead of building in release config
172+
run: dotnet clean
173+
- name: Build, in release configuration
174+
run: dotnet pack -p:VersionSuffix=$VersionSuffix -o packages
175+
- name: Upload build result artifacts
176+
uses: actions/upload-artifact@v4
177+
with:
178+
name: Build results (NuGet)
179+
path: packages/*.nupkg
180+
- name: Build docs website
181+
run: dotnet build -c Docs
182+
- name: Upload docs website artifact
183+
uses: actions/upload-artifact@v4
184+
with:
185+
name: Docs website
186+
path: docs/**/*
190187

191188
# runBrowserTests:
192189
# TODO: Use build-results artifacts and run tests on matrix of browsers
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Third party support verification
2+
3+
on:
4+
schedule:
5+
- cron: "25 19 * * 0"
6+
7+
jobs:
8+
9+
# Summary:
10+
#
11+
# Runs a subset of the unit tests for Reqnroll, across a matrix
12+
# of versions of this 3rd party library.
13+
# This verifies that I support the version range which I claim to support.
14+
#
15+
# If this begins failing then it likely means that Reqnroll have released
16+
# a version which includes breaking changes, and so the Screenplay support
17+
# policy/version range must be updated accordingly.
18+
19+
test_reqnroll_versions:
20+
name: Verify Reqnroll support across versions
21+
runs-on: ubuntu-slim
22+
23+
strategy:
24+
matrix:
25+
reqnroll_version: ['2.0.0', '2.*', '3.0.0', '3.*', '*']
26+
27+
env:
28+
DotnetVersion: 8.0.x
29+
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
- name: Install .NET
34+
uses: actions/setup-dotnet@v4
35+
with:
36+
dotnet-version: ${{ env.DotnetVersion }}
37+
- name: Test Reqnroll (only)
38+
run: dotnet test Tests/CSF.Screenplay.Reqnroll.Tests -p:ReqnrollVersion=${{ matrix.reqnroll_version }}

0 commit comments

Comments
 (0)