2323 BranchName : ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }}
2424 BranchParam : ${{ github.event_name == 'pull_request' && 'sonar.pullrequest.branch' || 'sonar.branch.name' }}
2525 PullRequestParam : ${{ github.event_name == 'pull_request' && format('/d:sonar.pullrequest.key={0}', github.event.number) || '' }}
26+ DISPLAY : :99
2627
2728 steps :
2829 - name : Checkout
5556 mkdir ~/.cache/selenium
5657 cp Tools/se-config.toml ~/.cache/selenium
5758 - name : Start an Xvfb display so Chrome may run
58- run : |
59- Xvfb -ac :99 -screen 0 1280x1024x16 &
60- export DISPLAY=:99
59+ run : Xvfb -ac $DISPLAY -screen 0 1280x1024x16 &
6160 - name : Restore .NET packages
6261 run : dotnet restore
6362 - name : Restore Node modules
8281 - name : Build the solution
8382 run : dotnet build -c ${{ env.Configuration }} --no-incremental
8483 - name : Run .NET tests with coverage
84+ id : dotnet_tests
85+ continue-on-error : true
8586 run : |
8687 AnyFailures=0
8788 for proj in Tests/*.Tests
@@ -95,14 +96,18 @@ jobs:
9596 AnyFailures=1
9697 fi
9798 done
98- export AnyFailures
99+ echo "failures=$ AnyFailures" >> $GITHUB_OUTPUT
99100 - name : Run JavaScript tests with coverage
101+ id : js_tests
102+ continue-on-error : true
100103 run : |
101104 cd CSF.Screenplay.JsonToHtmlReport.Template/src
102105 npm test
103106 if [ $? -ne 0 ]
104107 then
105- export AnyFailures=1
108+ echo "failures=1" >> $GITHUB_OUTPUT
109+ else
110+ echo "failures=0" >> $GITHUB_OUTPUT
106111 fi
107112 cd ../..
108113 - name : Stop SonarScanner
@@ -119,12 +124,10 @@ jobs:
119124 name : Screenplay JSON reports
120125 path : Tests/**/ScreenplayReport_*.json
121126 - name : Fail the build if any test failures
127+ if : ${{ steps.dotnet_tests.outputs.failures == 1 || steps.js_tests.outputs.failures == 1 }}
122128 run : |
123- if [ $AnyFailures -ne 0 ]
124- then
125- echo "Failing the build due to test failures"
126- exit 1
127- fi
129+ echo "Failing the build due to test failures"
130+ exit 1
128131
129132 # TODO: Convert Screenplay reports to HTML and upload as an artifact
130133
0 commit comments