Skip to content

Commit

Permalink
moved test reports and updated GitHub workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ebenetce committed Jun 18, 2024
1 parent fdca408 commit 38df95e
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 11 deletions.
60 changes: 51 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,59 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Sets up MATLAB on the GitHub Actions runner
- name: Setup MATLAB
uses: matlab-actions/setup-matlab@v1
uses: matlab-actions/setup-matlab@v2

# Runs a set of commands using the runners shell
- name: Run tests and generate artifacts
uses: matlab-actions/run-tests@v1
# Runs buildtool, code issues + tests + toolboxPackaging
- name: Run build
uses: matlab-actions/run-build@v2

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
source-folder: tbx
select-by-tag: Unit
test-results-junit: test-results/results.xml
code-coverage-cobertura: test-results/coverage.xml
name: IAMDataExplorer
path: IAMDataExplorer.mltbx
if-no-files-found: ignore

# Set up pages to show reports. This needs to run independent of the previous results.
# Previous here is buildtool, since upload is canceled on failure
- name: Setup Pages
if: success() || failure()
uses: actions/configure-pages@v3

# Upload test reports
- name: Upload Artifact
if: success() || failure()
uses: actions/upload-pages-artifact@v2
with:
# upload entire directory
path: tests/reports

deploy-results:
runs-on: ubuntu-latest
needs: build
if: ${{ always() }}

permissions:
pages: write
id-token: write

environment:
# environment created automatically by GitHub
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
# Deploy reports to GitHub Pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

# Publish the report address to GitHub Pages
- name: Create Annotation with links
run: |
echo '<a href="${{ steps.deployment.outputs.page_url }}/test-results/" target="_blank">Test results report</a>' >> $GITHUB_STEP_SUMMARY
echo '<a href="${{ steps.deployment.outputs.page_url }}/code-coverage/" target="_blank">Code coverage report</a>' >> $GITHUB_STEP_SUMMARY
4 changes: 2 additions & 2 deletions buildfile.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
% Add the "test" task to run tests
plan("test") = TestTask('tests', Tag = ["GUI", "UNIT"], ...
SourceFiles="tbx", OutputDetail = 2, ...
TestResults = "tests/test-results/report.html", ...
CodeCoverageResults="tests/code-coverage/report.html");
TestResults = "tests/reports/test-results/report.html", ...
CodeCoverageResults="tests/reports/code-coverage/report.html");

% Make the "archive" task the default task in the plan
plan.DefaultTasks = "archive";
Expand Down

0 comments on commit 38df95e

Please sign in to comment.