Skip to content

Commit

Permalink
Add expected error if no doc loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
eszmw committed Nov 28, 2023
1 parent e88463c commit 48fff3d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
22 changes: 19 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,23 @@ jobs:
name: TestResults
path: ./SoftwareTests/TestResults_${{ matrix.MATLABVersion }}.txt

badge:
if: ${{ always() }}
needs: [test]
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:

# Checks-out your repository
- uses: actions/checkout@v3

# Sets up R2023b
- name: Setup MATLAB
uses: matlab-actions/setup-matlab@v1
with:
release: R2023b

# Download the test results from artifact
- name: Download TestResults
uses: actions/[email protected]
Expand All @@ -55,15 +72,14 @@ jobs:
- name: Run CreateBadge
uses: matlab-actions/run-command@v1
with:
command: openProject(pwd); results = runtests(fullfile("SoftwareTests","CreateBadge.m"));
command: openProject(pwd); CreateTestBadge;

# Commit the JSON for the MATLAB releases badge
- name: Commit changed files
continue-on-error: true
run: |
git config user.name "${{ github.workflow }} by ${{ github.actor }}"
git config user.email "<>"
git add Images/TestedWith.json
git commit Images/TestedWith.json -m "Update CI badges ${{ github.ref_name }}"
git fetch
git push
git push
11 changes: 8 additions & 3 deletions SoftwareTests/SmokeTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,15 @@ function smokeTest(testCase)
fprintf(fid,"%s,%s,%s,%s\n",release_version,myFiles(kTest),"passed",testCase.results.Time(kTest));
catch ME
testCase.results.Time(kTest) = toc;
disp("Failed " + myFiles(kTest) + " because " + ...
if ME.message == "Unknown service"
disp("Expected error: no doc availabile.")
testCase.results.Passed(kTest) = true;
else
disp("Failed " + myFiles(kTest) + " because " + ...
newline + ME.message)
testCase.results.Message(kTest) = ME.message;
fprintf(fid,"%s,%s,%s,%s\n",release_version,myFiles(kTest),"failed",testCase.results.Time(kTest));
testCase.results.Message(kTest) = ME.message;
fprintf(fid,"%s,%s,%s,%s\n",release_version,myFiles(kTest),"failed",testCase.results.Time(kTest));
end
end
clearvars -except kTest testCase myFiles fid
end
Expand Down
5 changes: 5 additions & 0 deletions SoftwareTests/TestResults_R2023b.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Version,File,Status,ElapsedTime
R2023b,CommentingCode.mlx,passed,1.875415e+00
R2023b,Debugging.mlx,passed,5.075684e-01
R2023b,Functions.mlx,passed,2.872010e+01
R2023b,SharingCode.mlx,passed,3.768991e-01

0 comments on commit 48fff3d

Please sign in to comment.