Skip to content

Commit 792cf36

Browse files
committed
Initial commit
0 parents  commit 792cf36

2,306 files changed

Lines changed: 9382 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
*.fig binary
2+
*.mat binary
3+
*.mdl binary diff merge=mlAutoMerge
4+
*.mdlp binary
5+
*.mexa64 binary
6+
*.mexw64 binary
7+
*.mexmaci64 binary
8+
*.mlapp binary linguist-language=MATLAB
9+
*.mldatx binary
10+
*.mlproj binary
11+
*.mlx binary merge=mlAutoMerge linguist-language=MATLAB
12+
*.p binary
13+
*.sfx binary
14+
*.sldd binary
15+
*.slreqx binary merge=mlAutoMerge
16+
*.slmx binary merge=mlAutoMerge
17+
*.sltx binary
18+
*.slxc binary
19+
*.slx binary merge=mlAutoMerge linguist-language=Simulink
20+
*.slxp binary
21+
22+
## Other common binary file types
23+
*.docx binary
24+
*.exe binary
25+
*.jpg binary
26+
*.pdf binary
27+
*.png binary
28+
*.xlsx binary
29+
30+
# Ignore HTML
31+
32+
*.html linguist-detectable=false

.github/workflows/ci.yml

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
name: MATLAB CI and Pages
2+
3+
# WORKFLOW OVERVIEW
4+
# ==================
5+
# This workflow implements a multi-release MATLAB testing and documentation pipeline.
6+
# It tests courseware code across multiple MATLAB releases in parallel, validates results,
7+
# generates a status badge, and deploys documentation to GitHub Pages.
8+
#
9+
# ARCHITECTURE:
10+
# Phase 1 - test-matrix (parallel): Run tests independently for each MATLAB release
11+
# Phase 2 - report-and-deploy (sequential): Merge artifacts, validate, generate badge, deploy
12+
#
13+
# KEY FILES:
14+
# - buildfile.m : Defines build tasks (testing, validation, badge generation)
15+
# - SoftwareTests/CoursewareSmokeTests.m : Tests core courseware scripts
16+
# - SoftwareTests/FunctionTests.m : Placeholder for development function tests
17+
# - SoftwareTests/CrossReleaseTestResults.m : Validates all releases passed (gate for badge)
18+
#
19+
# ARTIFACT FLOW:
20+
# 1. test-matrix job (runs for each MATLAB release R2025a, R2025b):
21+
# $ buildtool test
22+
# -> public/R2025a/CoursewareSmokeTests.mat, FunctionTests.mat, etc.
23+
# -> Upload artifacts: test-results-R2025a, test-results-R2025b
24+
#
25+
# 2. report-and-deploy job (runs once, after test-matrix completes):
26+
# $ Download and merge all test-results-* artifacts into public/
27+
# $ buildtool report (runs report:validate, report:badge, report:link tasks)
28+
# -> SoftwareTests/CrossReleaseTestResults.m validates all releases passed
29+
# -> createBadge() generates public/TestedWith.json (shields.io format)
30+
# -> linkResultArtifactPathsInReportIndex() wraps test result links in HTML
31+
# -> Deploy public/ to GitHub Pages
32+
#
33+
# CUSTOMIZATION:
34+
# To change tested MATLAB releases: Edit matrix.Releases list (line 29)
35+
# To add/remove products: Edit MATLAB_PRODUCTS env variable (line 28)
36+
# To change deploy trigger: Edit 'on' workflow events (lines 3-7)
37+
#
38+
# FOR YOUR OWN COURSEWARE:
39+
# 1. Copy buildfile.m and SoftwareTests/ structure to your repo
40+
# 2. Create SoftwareTests/CoursewareSmokeTests.m with your own test suite
41+
# (reference: https://www.mathworks.com/help/matlab/matlab_prog/write-simple-test-suite.html)
42+
# 3. Update .github/workflows/ci.yml with your product list and release matrix
43+
# 4. Push to your release branch and monitor GitHub Actions
44+
#
45+
# TROUBLESHOOTING:
46+
# If tests fail in CI but pass locally:
47+
# - Check version(-release) output matches your installed MATLAB
48+
# - Verify all dependencies (products) are listed in MATLAB_PRODUCTS
49+
# - Review public/index.html report for detailed test output
50+
# If badge generation fails:
51+
# - Ensure SoftwareTests/CrossReleaseTestResults.m can find all release artifacts
52+
# - Check public/CrossReleaseTestResults.mat for missing or empty result variables
53+
54+
# Controls when the action will run.
55+
on:
56+
push:
57+
branches: [ release ]
58+
pull_request:
59+
branches: [ release ]
60+
workflow_dispatch:
61+
62+
# Add permission to write GitHub pages
63+
permissions:
64+
contents: write
65+
pages: write
66+
id-token: write
67+
68+
# Cancel older in-progress runs on the same ref to save CI time.
69+
concurrency:
70+
group: ${{ github.workflow }}-${{ github.ref }}
71+
cancel-in-progress: true
72+
73+
jobs:
74+
test-matrix:
75+
name: Test on ${{ matrix.Releases }}
76+
strategy:
77+
fail-fast: false
78+
matrix:
79+
Releases: [R2025b, R2026a]
80+
runs-on: ubuntu-latest
81+
env:
82+
MATLAB_PRODUCTS: # Simulink Simscape Symbolic_Math_Toolbox
83+
# List required products above in the format shown (and uncomment them)
84+
# Common products:
85+
# Simulink
86+
# Simscape
87+
# Statistics_and_Machine_Learning_Toolbox
88+
# Symbolic_Math_Toolbox
89+
# Deep_Learning_Toolbox
90+
LD_PRELOAD: /usr/lib/x86_64-linux-gnu/libstdc++.so.6
91+
steps:
92+
# Checks-out your repository
93+
- uses: actions/checkout@v6
94+
95+
# Sets up a display server
96+
- name: Start display server
97+
if: ${{ always() }}
98+
run: |
99+
sudo apt-get update
100+
sudo apt-get install -y xvfb
101+
Xvfb :99 &
102+
echo "DISPLAY=:99" >> $GITHUB_ENV
103+
104+
# Sets up MATLAB
105+
- name: Setup MATLAB ${{ matrix.Releases }}
106+
uses: matlab-actions/setup-matlab@v3
107+
with:
108+
release: ${{ matrix.Releases }}
109+
products: ${{ env.MATLAB_PRODUCTS }}
110+
cache: true
111+
112+
# Run aggregated test task from buildfile.m.
113+
- name: Run buildtool test
114+
uses: matlab-actions/run-build@v3
115+
with:
116+
tasks: test
117+
build-options: -continueOnFailure
118+
119+
# Upload only files required by buildtool report/pages to reduce artifact size.
120+
- name: Upload test results artifact
121+
if: ${{ always() }}
122+
uses: actions/upload-artifact@v6
123+
with:
124+
name: ${{ matrix.Releases }}
125+
path: |
126+
./public/${{ matrix.Releases }}/
127+
overwrite: true
128+
retention-days: 7
129+
130+
report-and-deploy:
131+
name: Build badge and deploy reports
132+
if: ${{ always() }}
133+
needs: [test-matrix]
134+
runs-on: ubuntu-latest
135+
steps:
136+
137+
# Checks-out your repository
138+
- uses: actions/checkout@v6
139+
140+
# GitHub-hosted jobs are isolated; MATLAB install from test-matrix cannot be reused here.
141+
# Keep this setup minimal (no extra products) and use artifacts from matrix jobs.
142+
143+
# Sets latest MATLAB for report task (no toolbox list needed).
144+
- name: Setup MATLAB latest
145+
uses: matlab-actions/setup-matlab@v3
146+
with:
147+
release: latest
148+
cache: true
149+
150+
# Download the test results from artifact
151+
- name: Download All TestResults
152+
uses: actions/download-artifact@v8
153+
with:
154+
path: public
155+
pattern: R20*
156+
merge-multiple: false
157+
158+
# Aggregate test reports and generate badge via buildfile.
159+
- name: Run buildtool report
160+
uses: matlab-actions/run-build@v3
161+
with:
162+
tasks: report
163+
build-options: -continueOnFailure
164+
165+
# Upload the badge as artifact
166+
- name: Upload Badge
167+
if: ${{ always() }}
168+
uses: actions/upload-artifact@v6
169+
with:
170+
name: Badge-Artifact
171+
path: ./public/TestedWith.json
172+
overwrite: true
173+
174+
# Deploy reports to GitHub pages
175+
- name: Setup Pages
176+
if: ${{ always() && github.event_name != 'pull_request' }}
177+
uses: actions/configure-pages@v5
178+
- name: Upload pages artifact
179+
if: ${{ always() && github.event_name != 'pull_request' }}
180+
uses: actions/upload-pages-artifact@v3
181+
with:
182+
path: public
183+
- name: Deploy to GitHub Pages
184+
if: ${{ always() && github.event_name != 'pull_request' }}
185+
id: deployment
186+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# List of untracked files to ignore
2+
3+
# Autosave files
4+
*.asv
5+
*.m~
6+
*.autosave
7+
*.slx.r*
8+
*.mdl.r*
9+
10+
# MATLAB Drive
11+
*.MATLABDriveTag
12+
13+
# Compiled files
14+
*.mex*
15+
*.p
16+
17+
# Compressed files
18+
*.zip
19+
20+
# Packaged app and toolbox files
21+
*.mlappinstall
22+
*.mltbx
23+
24+
# Deployable archives
25+
*.ctf
26+
27+
# Generated helpsearch folders
28+
helpsearch*/
29+
30+
# Defined Simulink cache folder
31+
Utilities/SimulinkCache/*
32+
33+
# Standard code generation folders
34+
slprj/
35+
sccprj/
36+
codegen/
37+
38+
# Code generation file
39+
*.eep
40+
*.elf
41+
*.hex
42+
*.bin
43+
44+
# Cache files
45+
*.slxc
46+
*.obsidian
47+
48+
# Project settings
49+
Utilities/ProjectSettings.mat
50+
51+
# Testing and CI related artifact
52+
public/
53+
.buildtool/
54+
ci_utilities/

.gitlab-ci.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
stages:
2+
# Set up two testing paths
3+
- test
4+
- deploy
5+
- release
6+
7+
test-matrix:
8+
parallel:
9+
matrix:
10+
- VERSION: [R2025b,R2026a]
11+
tags:
12+
- training
13+
- windows
14+
stage: test
15+
script:
16+
- Set-Alias -Name matlab -Value "D:\MATLAB\$VERSION\bin\matlab-batch"
17+
- matlab "openProject(pwd); buildtool -continueOnFailure"
18+
when: always
19+
allow_failure: true
20+
artifacts:
21+
name: "$VERSION"
22+
paths:
23+
- public/$VERSION/*
24+
when: always
25+
26+
pages:
27+
needs:
28+
- test-matrix
29+
variables:
30+
VERSION: "R2026a"
31+
tags:
32+
- training
33+
- windows
34+
stage: deploy
35+
script:
36+
- Set-Alias -Name matlab -Value "D:\MATLAB\$VERSION\bin\matlab-batch"
37+
- matlab "openProject(pwd); buildtool report -continueOnFailure"
38+
when: always
39+
allow_failure: true
40+
artifacts:
41+
paths:
42+
- public
43+
44+
file-test:
45+
variables:
46+
VERSION: "R2026a"
47+
tags:
48+
- training
49+
- windows
50+
stage: release
51+
script:
52+
- Set-Alias -Name matlab -Value "D:\MATLAB\$VERSION\bin\matlab-batch"
53+
- git clone https://insidelabs-git.mathworks.com/modular-curriculum-content/utilities.git ci_utilities
54+
- matlab "openProject(pwd); addpath(genpath(ci_utilities)); buildtool -buildFile ci-utilities\buildfile.m"
55+
rules:
56+
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
57+
when: always
58+
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH
59+
when: manual
60+
allow_failure: true

CONTRIBUTING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Contributing
2+
3+
>_If you believe you have discovered a security vulnerability, please **do not** open an issue or make a pull request. Follow the instructions in the [SECURITY.md](SECURITY.md) file in this repository._
4+
5+
Thank you for your interest in contributing to a MathWorks repository! We encourage contributions large and small to this repository.
6+
7+
**Contributions do not have to be code!** If you see a way to explain things more clearly or a great example of how to use something, please contribute it (or a link to your content). We welcome issues even if you don't code the solution. We also welcome pull requests to resolve issues that we haven't gotten to yet!
8+
9+
## How to give feedback
10+
* **Send us an email:** Contact the [MathWorks teaching resources team.](mailto:onlineteaching@mathworks.com)
11+
* **Open an issue:** Start by [creating an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue) in the repository that you're interested in. That will start a conversation with the maintainer. When you are creating a bug report, please include as many details as possible. Please remember that other people do not have your background or understanding of the issue; make sure you are clear and complete in your description.
12+
13+
## How to contribute to the repository
14+
* **Work in your own public fork:** If you choose to make a contribution, you should [fork the repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo). This creates an editable copy on GitHub where you can write, test, and refine your changes. We suggest that you keep your changes small and focused on the issue you submitted.
15+
* **Sign a Contributor License Agreement (CLA):** We require that all outside contributors sign a [CLA](https://en.wikipedia.org/wiki/Contributor_License_Agreement) before we can accept your contribution. When you create a pull request (see below), we'll reach out to you if you do not already have one on file. Essentially, the CLA gives us permission to publish your contribution as part of the repository.
16+
* **Make a pull request:** "[Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)" is a confusing term, but it means exactly what it says: You're requesting that the maintainers of the repository pull your changes in. If you don't have a CLA on file, we'll reach out to you. Your contribution will be reviewed, and we may ask you to revise your pull request based on our feedback. Once everyone is satisfied, we'll merge your pull request into the repository.
17+
18+
## Guidelines
19+
20+
We don't have best practices for writing MATLAB® code, but we do have some recommendations:
21+
22+
* You should not have any warnings or errors in the [code analyzer report](http://www.mathworks.com/help/matlab/matlab_prog/matlab-code-analyzer-report.html)
23+
* [Loren Shure's blog](https://blogs.mathworks.com/loren) has [great advice on improving your MATLAB code](https://blogs.mathworks.com/loren/category/best-practice/)
24+
* Examples should be written as [live scripts](https://www.mathworks.com/help/matlab/matlab_prog/what-is-a-live-script-or-function.html) or [Simulink® models](https://www.mathworks.com/help/simulink/index.html).
25+
* We adhere to the [CommonMark](https://commonmark.org/) specification where it does not conflict with GitHub rendering. If you edit your Markdown in Visual Studio Code or a similar editor, it uses [markdownlint](https://github.com/DavidAnson/markdownlint) to highlight issues in your Markdown.
26+
27+
**Again, thanks for contributing, and we look forward to your issues and pull requests!**

Derivatives.prj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<MATLABProject xmlns="http://www.mathworks.com/MATLABProjectFile"/>

FunctionLibrary/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)