Skip to content

Commit 7d731d6

Browse files
committed
Maintenance for R2024b
1) Update .gitattributes and .gitignore 2) Update workflow files for GitHub including posting test results on Pages 3) Update code by moving functions into the optimal location in the script, per 24a 4) Add solutions to InstructorResources 5) Make sure Scripts and Solutions match 6) Update the startup app and the project to start the app 7) Update the SoftwareTests to a new structure and write necessary pre/post files 8) Think about how to handle colors in dark theme for CaesarCipher example 9) Remove OldVersions 10) Reset scripts to all open as Output Inline
1 parent b0a9e97 commit 7d731d6

File tree

82 files changed

+928
-256
lines changed

Some content is hidden

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

82 files changed

+928
-256
lines changed

.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*.slmx binary merge=mlAutoMerge
1717
*.sltx binary
1818
*.slxc binary
19-
*.slx binary merge=mlAutoMerge
19+
*.slx binary merge=mlAutoMerge linguist-language=Simulink
2020
*.slxp binary
2121

2222
## Other common binary file types

.github/workflows/ci.yml

+37-18
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,22 @@ on:
88
branches: [ release ]
99
workflow_dispatch:
1010

11+
# Add permission to write GitHub pages
12+
permissions:
13+
contents: write
14+
pages: write
15+
id-token: write
16+
1117
jobs:
1218
test:
1319
strategy:
1420
fail-fast: false
1521
matrix:
16-
MATLABVersion: [R2022b,R2023a,R2023b,R2024a]
22+
MATLABVersion: [R2024a,R2024b]
1723
runs-on: ubuntu-latest
1824
steps:
1925
# Checks-out your repository
20-
- uses: actions/checkout@v3
26+
- uses: actions/checkout@v4
2127

2228
# Sets up a display server
2329
- name: Start display server
@@ -32,8 +38,7 @@ jobs:
3238
uses: matlab-actions/setup-matlab@v2
3339
with:
3440
release: ${{ matrix.MATLABVersion }}
35-
products: Image_Processing_Toolbox
36-
# Simulink Statistics_and_Machine_Learning_Toolbox
41+
products: # Simulink Statistics_and_Machine_Learning_Toolbox
3742
# List required products above in the format shown (and uncomment them)
3843
# List of product strings:
3944
# Simulink
@@ -51,10 +56,12 @@ jobs:
5156

5257
# Upload the test results as artifact
5358
- name: Upload TestResults
54-
uses: actions/[email protected]
59+
if: ${{ always() }}
60+
uses: actions/upload-artifact@v4
5561
with:
56-
name: TestResults
57-
path: ./SoftwareTests/TestResults_${{ matrix.MATLABVersion }}.txt
62+
name: TestResults_${{ matrix.MATLABVersion }}
63+
path: ./public/*
64+
overwrite: true
5865

5966
badge:
6067
if: ${{ always() }}
@@ -65,26 +72,38 @@ jobs:
6572
steps:
6673

6774
# Checks-out your repository
68-
- uses: actions/checkout@v3
75+
- uses: actions/checkout@v4
6976

7077
# Sets up R2023b
7178
- name: Setup MATLAB
72-
uses: matlab-actions/setup-matlab@v1
79+
uses: matlab-actions/setup-matlab@v2
7380
with:
74-
release: R2023b
81+
release: R2024b
7582

7683
# Download the test results from artifact
77-
- name: Download TestResults
78-
uses: actions/download-artifact@v2.1.1
84+
- name: Download All TestResults
85+
uses: actions/download-artifact@v4
7986
with:
80-
name: TestResults
81-
path: ./SoftwareTests/
82-
87+
path: public
88+
pattern: TestResults_*
89+
merge-multiple: true
90+
8391
# Create the test results badge
84-
- name: Run CreateBadge
85-
uses: matlab-actions/run-command@v1
92+
- name: Run PostSmokeTest
93+
uses: matlab-actions/run-command@v2
94+
with:
95+
command: openProject(pwd); PostSmokeTest;
96+
97+
# Deploy reports to GitHub pages
98+
- name: Setup Pages
99+
uses: actions/configure-pages@v5
100+
- name: Upload pages artifact
101+
uses: actions/upload-pages-artifact@v3
86102
with:
87-
command: openProject(pwd); CreateBadge;
103+
path: public
104+
- name: Deploy to GitHub Pages
105+
id: deployment
106+
uses: actions/deploy-pages@v4
88107

89108
# Commit the JSON for the MATLAB releases badge
90109
- name: Commit changed files

.github/workflows/release.yml

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Release Fundamentals of Programming across all supported releases of MATLAB
2+
3+
name: MATLAB Release
4+
5+
# Run workflow when a tag is created
6+
on:
7+
push:
8+
tags:
9+
- 'v*'
10+
11+
jobs:
12+
# This workflow contains:
13+
# 1. a matrixed test job run across a bunch of releases of MATLAB
14+
# 2. a reporting job that summarizes the tests, and updates release badge
15+
test:
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
MATLABVersion: [R2020a, R2020b, R2021a, R2021b, R2022a, R2022b]
20+
# The type of runner that the job will run on
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
25+
- uses: actions/checkout@v3
26+
27+
- name: Set up MATLAB
28+
uses: matlab-actions/setup-matlab@v1
29+
with:
30+
release: ${{ matrix.MATLABVersion }}
31+
32+
# Runs all tests in the project. Put results in a version specific subdirectory
33+
- name: Run tests
34+
uses: matlab-actions/run-command@v1
35+
with:
36+
command: addpath("buildutil"),testToolbox('ReportSubdirectory',"${{ matrix.MATLABVersion }}")
37+
38+
# Save the contents of the report directory from each release into a single artifact. Since each release makes their own directory, they all update the same artifact.
39+
- name: Save Report Directory
40+
uses: actions/upload-artifact@v3
41+
if: always()
42+
with:
43+
name: report
44+
path: report
45+
46+
# Report on what releases tested successfully.
47+
# Generate a draft release based on the tag
48+
# Recreate the tag with the final version of JSON files
49+
release:
50+
needs: test
51+
if: always()
52+
runs-on: ubuntu-latest
53+
54+
steps:
55+
- uses: actions/checkout@v3
56+
with:
57+
ref: refs/heads/main
58+
59+
- name: Set up MATLAB
60+
uses: matlab-actions/setup-matlab@v1
61+
62+
# Copy all the reports down into the container
63+
- uses: actions/download-artifact@v3
64+
with:
65+
name: report
66+
path: report
67+
68+
# Generate the JSON for the releases tested badge
69+
- name: Generate tested with badge
70+
uses: matlab-actions/run-command@v1
71+
with:
72+
command: addpath("buildutil"),badgesforToolbox()
73+
74+
# Publish test results from all the releases
75+
- name: Publish Test Results
76+
uses: EnricoMi/publish-unit-test-result-action@v2
77+
if: always()
78+
with:
79+
junit_files: "report/*/test-results.xml"
80+
81+
# Commit the JSON for the MATLAB releases badge
82+
- name: commit changed files
83+
continue-on-error: true
84+
run: |
85+
git config user.name "${{ github.workflow }} by ${{ github.actor }}"
86+
git config user.email "<>"
87+
git commit report/badge/tested_with.json -m "Final checkins for release ${{ github.ref_name }}"
88+
git fetch
89+
git push
90+
91+
# Retag the repo so that the updated files are included in the release tag
92+
- name: update tag
93+
if: always()
94+
continue-on-error: true
95+
run: |
96+
git config user.name "${{ github.workflow }} by ${{ github.actor }}"
97+
git config user.email "<>"
98+
git tag -d "${{ github.ref_name }}"
99+
git push --delete origin ${{ github.ref_name }}
100+
git tag -m "Release ${{ github.ref_name }}" ${{ github.ref_name }}
101+
git push --tag
102+
103+
# Create the release
104+
- name: Create GitHub Release
105+
uses: ncipollo/release-action@v1
106+
with:
107+
draft: true
108+
generateReleaseNotes: true

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ codegen/
4747
# Project settings
4848
Utilities/ProjectSettings.mat
4949

50-
# Test results
51-
SoftwareTests/TestResults_*
50+
# GitLab page folder
51+
public/
5252

5353
# Auto-generated from Scripts
5454
*/*/MyFavoriteChaosGameImage.png

.gitlab-ci.yml

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
stages:
2+
# Set up two testing paths
3+
- setup
4+
- test
5+
- deploy
6+
- release
7+
8+
setup-job:
9+
tags:
10+
- matlab
11+
stage: setup
12+
script:
13+
- cd ..
14+
- if (test-path utilities) { rm -r -force utilities }
15+
- git clone [email protected]:modular-curriculum-content/utilities.git
16+
- cd $CI_PROJECT_NAME
17+
allow_failure: false
18+
19+
20+
smoke-test:
21+
# Smoke tests should run all the time
22+
tags:
23+
# Add additional tags like (e.g. - arduino) as required
24+
# Make sure that the runner you plan to use matches the tags
25+
- matlab
26+
stage: test
27+
parallel:
28+
matrix:
29+
- VERSION: [R2024a,R2024b]
30+
script:
31+
- Set-Alias -Name matlab -Value "C:\Program Files\MATLAB\$VERSION\bin\matlab.exe"
32+
- matlab -batch "openProject(pwd);RunAllTests"
33+
when: always
34+
allow_failure: true
35+
artifacts:
36+
name: "$VERSION"
37+
paths:
38+
- public/*
39+
when: always
40+
41+
42+
pages:
43+
tags:
44+
- matlab
45+
stage: deploy
46+
script:
47+
- matlab -batch "openProject(pwd);PostSmokeTest;"
48+
artifacts:
49+
paths:
50+
- public
51+
52+
file-test:
53+
tags:
54+
- matlab
55+
stage: release
56+
script:
57+
- matlab -batch "proj = openProject(pwd);
58+
addpath(proj.RootFolder+'/InternalFiles/Tests/CI');
59+
results = runtests('OpenCloseFileTest.m');
60+
disp(table(results)); assertSuccess(results);"
61+
rules:
62+
# This test should always run when merging to main
63+
# And be available for manual running on any push
64+
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
65+
when: always
66+
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH
67+
when: manual
68+
allow_failure: true
69+
70+
release-testing:
71+
tags:
72+
- matlab
73+
stage: release
74+
script:
75+
- matlab -batch "proj = openProject(pwd);
76+
cd ..;
77+
addpath(genpath(fullfile('utilities','TestingResources')));
78+
addpath(genpath(fullfile('utilities','Tools')));
79+
runCMTests"
80+
rules:
81+
# This test should always run when merging to main
82+
# And be available for manual running on any push
83+
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
84+
when: always
85+
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH
86+
when: manual
87+
allow_failure: true
61.1 KB
Binary file not shown.
224 KB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)