Skip to content

Commit 7f5181e

Browse files
committed
Initial commit
0 parents  commit 7f5181e

512 files changed

Lines changed: 2628 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: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
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: >
83+
Simulink
84+
Image_Processing_Toolbox
85+
Computer_Vision_Toolbox
86+
Stateflow
87+
Simulink_Real-Time
88+
LD_PRELOAD: /usr/lib/x86_64-linux-gnu/libstdc++.so.6
89+
steps:
90+
# Checks-out your repository
91+
- uses: actions/checkout@v6
92+
93+
# Sets up a display server
94+
- name: Start display server
95+
if: ${{ always() }}
96+
run: |
97+
sudo apt-get update
98+
sudo apt-get install -y xvfb
99+
Xvfb :99 &
100+
echo "DISPLAY=:99" >> $GITHUB_ENV
101+
102+
# Sets up MATLAB
103+
- name: Setup MATLAB ${{ matrix.Releases }}
104+
uses: matlab-actions/setup-matlab@v3
105+
with:
106+
release: ${{ matrix.Releases }}
107+
products: ${{ env.MATLAB_PRODUCTS }}
108+
cache: true
109+
110+
# Run aggregated test task from buildfile.m.
111+
- name: Run buildtool test
112+
uses: matlab-actions/run-build@v3
113+
with:
114+
tasks: test
115+
build-options: -continueOnFailure
116+
117+
# Upload only files required by buildtool report/pages to reduce artifact size.
118+
- name: Upload test results artifact
119+
if: ${{ always() }}
120+
uses: actions/upload-artifact@v6
121+
with:
122+
name: ${{ matrix.Releases }}
123+
path: |
124+
./public/${{ matrix.Releases }}/
125+
overwrite: true
126+
retention-days: 7
127+
128+
report-and-deploy:
129+
name: Build badge and deploy reports
130+
if: ${{ always() }}
131+
needs: [test-matrix]
132+
runs-on: ubuntu-latest
133+
steps:
134+
135+
# Checks-out your repository
136+
- uses: actions/checkout@v6
137+
138+
# GitHub-hosted jobs are isolated; MATLAB install from test-matrix cannot be reused here.
139+
# Keep this setup minimal (no extra products) and use artifacts from matrix jobs.
140+
141+
# Sets latest MATLAB for report task (no toolbox list needed).
142+
- name: Setup MATLAB latest
143+
uses: matlab-actions/setup-matlab@v3
144+
with:
145+
release: latest
146+
cache: true
147+
148+
# Download the test results from artifact
149+
- name: Download All TestResults
150+
uses: actions/download-artifact@v8
151+
with:
152+
path: public
153+
pattern: R20*
154+
merge-multiple: false
155+
156+
# Aggregate test reports and generate badge via buildfile.
157+
- name: Run buildtool report
158+
uses: matlab-actions/run-build@v3
159+
with:
160+
tasks: report
161+
build-options: -continueOnFailure
162+
163+
# Upload the badge as artifact
164+
- name: Upload Badge
165+
if: ${{ always() }}
166+
uses: actions/upload-artifact@v6
167+
with:
168+
name: Badge-Artifact
169+
path: ./public/TestedWith.json
170+
overwrite: true
171+
172+
# Deploy reports to GitHub pages
173+
- name: Setup Pages
174+
if: ${{ always() && github.event_name != 'pull_request' }}
175+
uses: actions/configure-pages@v5
176+
- name: Upload pages artifact
177+
if: ${{ always() && github.event_name != 'pull_request' }}
178+
uses: actions/upload-pages-artifact@v3
179+
with:
180+
path: public
181+
- name: Deploy to GitHub Pages
182+
if: ${{ always() && github.event_name != 'pull_request' }}
183+
id: deployment
184+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
47+
# Project settings
48+
Utilities/ProjectSettings.mat
49+
50+
# Testing and CI related artifact
51+
public/
52+
.buildtool/
53+
ci_utilities/
54+
55+
# Additional files downloaded by the module
56+
QuadcopterDrone/
57+
Kalman-Filter-Virtual-Lab/

.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

Data/plus_quad_params.mat

1.57 KB
Binary file not shown.

Data/x_quad_params.mat

1.57 KB
Binary file not shown.

FunctionLibrary/.gitkeep

Whitespace-only changes.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
function DownloadExampleFromFileExchange(ChooseDirName,URL,ProjName)
2+
curloc = matlab.desktop.editor.getActiveFilename;
3+
if contains(curloc,"Scripts")
4+
rootdir = extractBefore(curloc,filesep+"Scripts");
5+
elseif contains(curloc,"InstructorResources")
6+
rootdir = extractBefore(curloc,filesep+"InstructorResources");
7+
else
8+
error("Unexpected location: " + curloc)
9+
end
10+
rootdir = string(rootdir);
11+
if ~exist(rootdir+filesep+ChooseDirName,"dir")
12+
mkdir(rootdir,ChooseDirName)
13+
end
14+
newloc = rootdir+filesep+ChooseDirName+filesep;
15+
if ~exist(newloc+filesep+ProjName)
16+
gitclone(URL,newloc);
17+
end
18+
openProject(newloc+ProjName);
19+
end
20+
21+
%[appendix]{"version":"1.0"}
22+
%---

Images/AddOnsIcon.png

1.1 KB

0 commit comments

Comments
 (0)