Skip to content

Commit

Permalink
Maintenance for R2024b
Browse files Browse the repository at this point in the history
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
  • Loading branch information
eszmw committed Oct 17, 2024
1 parent b0a9e97 commit 7d731d6
Show file tree
Hide file tree
Showing 82 changed files with 928 additions and 256 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*.slmx binary merge=mlAutoMerge
*.sltx binary
*.slxc binary
*.slx binary merge=mlAutoMerge
*.slx binary merge=mlAutoMerge linguist-language=Simulink
*.slxp binary

## Other common binary file types
Expand Down
55 changes: 37 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@ on:
branches: [ release ]
workflow_dispatch:

# Add permission to write GitHub pages
permissions:
contents: write
pages: write
id-token: write

jobs:
test:
strategy:
fail-fast: false
matrix:
MATLABVersion: [R2022b,R2023a,R2023b,R2024a]
MATLABVersion: [R2024a,R2024b]
runs-on: ubuntu-latest
steps:
# Checks-out your repository
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# Sets up a display server
- name: Start display server
Expand All @@ -32,8 +38,7 @@ jobs:
uses: matlab-actions/setup-matlab@v2
with:
release: ${{ matrix.MATLABVersion }}
products: Image_Processing_Toolbox
# Simulink Statistics_and_Machine_Learning_Toolbox
products: # Simulink Statistics_and_Machine_Learning_Toolbox
# List required products above in the format shown (and uncomment them)
# List of product strings:
# Simulink
Expand All @@ -51,10 +56,12 @@ jobs:

# Upload the test results as artifact
- name: Upload TestResults
uses: actions/[email protected]
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: TestResults
path: ./SoftwareTests/TestResults_${{ matrix.MATLABVersion }}.txt
name: TestResults_${{ matrix.MATLABVersion }}
path: ./public/*
overwrite: true

badge:
if: ${{ always() }}
Expand All @@ -65,26 +72,38 @@ jobs:
steps:

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

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

# Download the test results from artifact
- name: Download TestResults
uses: actions/download-artifact@v2.1.1
- name: Download All TestResults
uses: actions/download-artifact@v4
with:
name: TestResults
path: ./SoftwareTests/

path: public
pattern: TestResults_*
merge-multiple: true

# Create the test results badge
- name: Run CreateBadge
uses: matlab-actions/run-command@v1
- name: Run PostSmokeTest
uses: matlab-actions/run-command@v2
with:
command: openProject(pwd); PostSmokeTest;

# Deploy reports to GitHub pages
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v3
with:
command: openProject(pwd); CreateBadge;
path: public
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

# Commit the JSON for the MATLAB releases badge
- name: Commit changed files
Expand Down
108 changes: 108 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Release Fundamentals of Programming across all supported releases of MATLAB

name: MATLAB Release

# Run workflow when a tag is created
on:
push:
tags:
- 'v*'

jobs:
# This workflow contains:
# 1. a matrixed test job run across a bunch of releases of MATLAB
# 2. a reporting job that summarizes the tests, and updates release badge
test:
strategy:
fail-fast: false
matrix:
MATLABVersion: [R2020a, R2020b, R2021a, R2021b, R2022a, R2022b]
# The type of runner that the job will run on
runs-on: ubuntu-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v1
with:
release: ${{ matrix.MATLABVersion }}

# Runs all tests in the project. Put results in a version specific subdirectory
- name: Run tests
uses: matlab-actions/run-command@v1
with:
command: addpath("buildutil"),testToolbox('ReportSubdirectory',"${{ matrix.MATLABVersion }}")

# 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.
- name: Save Report Directory
uses: actions/upload-artifact@v3
if: always()
with:
name: report
path: report

# Report on what releases tested successfully.
# Generate a draft release based on the tag
# Recreate the tag with the final version of JSON files
release:
needs: test
if: always()
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
ref: refs/heads/main

- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v1

# Copy all the reports down into the container
- uses: actions/download-artifact@v3
with:
name: report
path: report

# Generate the JSON for the releases tested badge
- name: Generate tested with badge
uses: matlab-actions/run-command@v1
with:
command: addpath("buildutil"),badgesforToolbox()

# Publish test results from all the releases
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
junit_files: "report/*/test-results.xml"

# 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 commit report/badge/tested_with.json -m "Final checkins for release ${{ github.ref_name }}"
git fetch
git push
# Retag the repo so that the updated files are included in the release tag
- name: update tag
if: always()
continue-on-error: true
run: |
git config user.name "${{ github.workflow }} by ${{ github.actor }}"
git config user.email "<>"
git tag -d "${{ github.ref_name }}"
git push --delete origin ${{ github.ref_name }}
git tag -m "Release ${{ github.ref_name }}" ${{ github.ref_name }}
git push --tag
# Create the release
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
draft: true
generateReleaseNotes: true
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ codegen/
# Project settings
Utilities/ProjectSettings.mat

# Test results
SoftwareTests/TestResults_*
# GitLab page folder
public/

# Auto-generated from Scripts
*/*/MyFavoriteChaosGameImage.png
Expand Down
87 changes: 87 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
stages:
# Set up two testing paths
- setup
- test
- deploy
- release

setup-job:
tags:
- matlab
stage: setup
script:
- cd ..
- if (test-path utilities) { rm -r -force utilities }
- git clone [email protected]:modular-curriculum-content/utilities.git
- cd $CI_PROJECT_NAME
allow_failure: false


smoke-test:
# Smoke tests should run all the time
tags:
# Add additional tags like (e.g. - arduino) as required
# Make sure that the runner you plan to use matches the tags
- matlab
stage: test
parallel:
matrix:
- VERSION: [R2024a,R2024b]
script:
- Set-Alias -Name matlab -Value "C:\Program Files\MATLAB\$VERSION\bin\matlab.exe"
- matlab -batch "openProject(pwd);RunAllTests"
when: always
allow_failure: true
artifacts:
name: "$VERSION"
paths:
- public/*
when: always


pages:
tags:
- matlab
stage: deploy
script:
- matlab -batch "openProject(pwd);PostSmokeTest;"
artifacts:
paths:
- public

file-test:
tags:
- matlab
stage: release
script:
- matlab -batch "proj = openProject(pwd);
addpath(proj.RootFolder+'/InternalFiles/Tests/CI');
results = runtests('OpenCloseFileTest.m');
disp(table(results)); assertSuccess(results);"
rules:
# This test should always run when merging to main
# And be available for manual running on any push
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
when: always
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH
when: manual
allow_failure: true

release-testing:
tags:
- matlab
stage: release
script:
- matlab -batch "proj = openProject(pwd);
cd ..;
addpath(genpath(fullfile('utilities','TestingResources')));
addpath(genpath(fullfile('utilities','Tools')));
runCMTests"
rules:
# This test should always run when merging to main
# And be available for manual running on any push
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
when: always
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH
when: manual
allow_failure: true
Binary file added InstructorResources/Solutions/AlgorithmsSoln.mlx
Binary file not shown.
Binary file added InstructorResources/Solutions/ArraysSoln.mlx
Binary file not shown.
Binary file added InstructorResources/Solutions/BranchesSoln.mlx
Binary file not shown.
Loading

0 comments on commit 7d731d6

Please sign in to comment.