Skip to content

Davidb/mpm #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 47 commits into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
7a12483
Only run deps install script on Linux
mcafaro Jan 4, 2022
8a8f605
Add macOS and Windows to integ test matrix
mcafaro Jan 4, 2022
2e54d2d
Add MATLAB bin folder to runner path after installation
mcafaro Jan 4, 2022
8091c47
Merge pull request #23 from matlab-actions/windows-and-macos
mcafaro Jan 5, 2022
1375ca6
Update vulnerable dependencies
mcafaro Jan 5, 2022
eef5296
Merge pull request #24 from matlab-actions/deps
mcafaro Jan 6, 2022
50f16ad
1.1.0
Jan 6, 2022
25eb6fe
Bump minimist from 1.2.5 to 1.2.6
dependabot[bot] Mar 28, 2022
55c576c
Use BSD license
mcafaro Apr 11, 2022
40d866d
Merge pull request #36 from matlab-actions/bsd
mcafaro Apr 11, 2022
7f1fdda
Merge pull request #34 from matlab-actions/dependabot/npm_and_yarn/mi…
davidbuzinski May 3, 2022
46e7daa
1.1.1
May 3, 2022
2e665de
initial commit mpm
davidbuzinski Aug 10, 2022
ad431e0
fixing async issues
davidbuzinski Aug 10, 2022
0a1176c
figuring out how actions cache paths works
davidbuzinski Aug 10, 2022
ddf6c8e
moving cache find inside mpm call
davidbuzinski Aug 10, 2022
5099d96
trying once more with cache path
davidbuzinski Aug 10, 2022
f8c7a05
Add matlab-batch and --skip-activation (#40)
davidbuzinski Aug 11, 2022
f0e45fe
Update release process to automate semantic versioning (#41)
davidbuzinski Aug 12, 2022
0b67291
[skip ci] Bump v1.2.0
Aug 12, 2022
ee31f66
linking to the run-build documentation (#43)
mw-hrastega Sep 30, 2022
a8893fd
Davidb/mpm (#45)
davidbuzinski Oct 11, 2022
bacc53a
fixing merge conflicts with main
davidbuzinski Oct 11, 2022
ae2ef07
Bump @actions/core from 1.4.0 to 1.9.1 (#42)
dependabot[bot] Oct 11, 2022
63123b7
[skip ci] Bump v1.2.1
Oct 11, 2022
d7d39b6
Bump node version (#47)
davidbuzinski Oct 19, 2022
71fedd9
[skip ci] Bump v1.2.2
Oct 19, 2022
07d2345
Update matlab.ts
davidbuzinski Nov 3, 2022
9368315
bumping vulnerable dependencies (#49)
davidbuzinski Nov 3, 2022
6c1f874
[skip ci] Bump v1.2.3
Nov 3, 2022
a71b1b7
cleaning up some syntax
davidbuzinski Nov 8, 2022
703aa79
added new parameter to README
davidbuzinski Nov 8, 2022
669ed9a
fixing broken build
davidbuzinski Nov 8, 2022
a8947ae
re-syncing recent dependency changes from main
davidbuzinski Nov 8, 2022
e5eb26e
oops forgot a git add
davidbuzinski Nov 8, 2022
f236f47
install MATLAB + PCT by default
davidbuzinski Nov 8, 2022
57833da
fixing build
davidbuzinski Nov 8, 2022
2c2b042
fixing assert in CI
davidbuzinski Nov 8, 2022
164142e
address initial feedback
davidbuzinski Nov 8, 2022
31283dc
fixing build
davidbuzinski Nov 8, 2022
65ddcd5
Apply suggestions from code review
davidbuzinski Nov 9, 2022
f8a9aa5
changing version info to release info for consistency
davidbuzinski Nov 9, 2022
dc44c11
updating errors and README
davidbuzinski Nov 10, 2022
3720cf8
Updating error text
davidbuzinski Nov 10, 2022
f873f22
Incorporating doc feedback
davidbuzinski Nov 11, 2022
4baab09
updating README intro
davidbuzinski Nov 11, 2022
6401472
updating examples
davidbuzinski Nov 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions .github/workflows/bat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: Build and Test
on: [push]

env:
MATHWORKS_SKIP_ACTIVATION: true
MATHWORKS_ACCOUNT: ${{ secrets.MATHWORKS_ACCOUNT }}
MATHWORKS_TOKEN: ${{ secrets.MATHWORKS_TOKEN }}

Expand All @@ -11,13 +10,13 @@ jobs:
name: Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "12"
node-version: 16
- name: Perform npm tasks
run: npm run ci
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: built-action
path: |
Expand All @@ -28,28 +27,33 @@ jobs:
needs: bat
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
fail-fast: true
matrix:
include:
- os: ubuntu-latest
release: R2021b
command: assert(~isempty(regexp(version('-release'), '\d{4}.')))
# Excluding the R2020a job as the pilot currently only supports R2020b
# - os: ubuntu-18.04
# release: R2020a
# command: assert(strcmp(version('-release'),'2020a'))
release: latest
check-matlab: matlabVer = ver('matlab'); assert(~isempty(matlabVer));
check-simulink: simulinkVer = ver('simulink'); assert(~isempty(simulinkVer));
- os: ubuntu-20.04
release: R2022a
check-matlab: matlabVer = ver('matlab'); assert(matlabVer.Release == string('(R2022a)'));
check-simulink: simulinkVer = ver('simulink'); assert(simulinkVer.Release == string('(R2022a)'));
- os: windows-latest
release: latest
check-matlab: matlabVer = ver('matlab'); assert(~isempty(matlabVer));
check-simulink: simulinkVer = ver('simulink'); assert(~isempty(simulinkVer));
steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: built-action
- name: Perform 'setup-matlab'
- name: Install MATLAB & Simulink (and PCT)
uses: ./
with:
release: ${{ matrix.release }}
products:
release: ${{ matrix.release}}
products: |
MATLAB
Parallel_Computing_Toolbox
MATLAB_Compiler
MATLAB_Compiler_SDK
- name: Run Sample MATLAB Command
run: matlab-batch "${{ matrix.command }}"
Simulink
- name: Check MATLAB version
run: matlab-batch "${{ matrix.check-matlab }}"
- name: Check Simulink version
run: matlab-batch "${{ matrix.check-simulink }}"
80 changes: 80 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Publish

on:
release:
types: [published, edited]

jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.update-package-version.outputs.version }}
steps:
# Configure runner with the right stuff
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure git
run: |
git config user.name 'Release Action'
git config user.email '<>'
- uses: actions/setup-node@v3
with:
node-version: 16

# Call `npm version`. It increments the version and commits the changes.
# We'll save the output (new version string) for use in the following
# steps
- name: Update package version
id: update-package-version
run: |
git tag -d "${{ github.event.release.tag_name }}"
VERSION=$(npm version "${{ github.event.release.tag_name }}" --no-git-tag-version)
echo "::set-output name=version::$VERSION"
git add package.json package-lock.json
git commit -m "[skip ci] Bump $VERSION"
git push origin HEAD:main

# Now carry on, business as usual
- name: Perform npm tasks
run: npm run ci

# Finally, create a detached commit containing the built artifacts and tag
# it with the release. Note: the fact that the branch is locally updated
# will not be relayed (pushed) to origin
- name: Commit to release branch
id: release_info
run: |
# Check for semantic versioning
echo "Preparing release for version $longVersion"
longVersion="${{github.event.release.tag_name}}"
[[ $longVersion == v[0-9]*.[0-9]*.[0-9]* ]] || (echo "must follow semantic versioning" && exit 1)
majorVersion=$(echo ${longVersion%.*.*})
minorVersion=$(echo ${longVersion%.*})

# Add the built artifacts. Using --force because dist/lib should be in
# .gitignore
git add --force dist lib

# Make the commit
MESSAGE="Build for $(git rev-parse --short HEAD)"
git commit --allow-empty -m "$MESSAGE"
git tag -f -a -m "Release $longVersion" $longVersion

# Get the commit of the tag you just released
commitHash=$(git rev-list -n 1 $longVersion)

# Delete the old major and minor version tags locally
git tag -d $majorVersion || true
git tag -d $minorVersion || true

# Make new major and minor version tags locally that point to the commit you got from the "git rev-list" above
git tag -f $majorVersion $commitHash
git tag -f $minorVersion $commitHash

# Force push the new minor version tag to overwrite the old tag remotely
echo "Pushing new tags"
git push -f origin $longVersion
git push -f origin $majorVersion
git push -f origin $minorVersion
82 changes: 0 additions & 82 deletions .github/workflows/release.yml

This file was deleted.

54 changes: 38 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ Before you run MATLAB&reg; code and Simulink&reg; models on a [GitHub&reg;-hoste
The **Setup MATLAB** action is not supported on [self-hosted](https://docs.github.com/en/free-pro-team@latest/actions/hosting-your-own-runners/about-self-hosted-runners) runners. Currently, it is available only for public projects. It does not set up transformation products, such as MATLAB Coder&trade; and MATLAB Compiler&trade;.

## Usage Examples
Once you set up MATLAB, you can use the runner to execute MATLAB scripts, functions, or statements. You also can use the runner to execute MATLAB and Simulink tests and generate artifacts. To execute code on the runner, include the [Run MATLAB Command](https://github.com/matlab-actions/run-command/) or [Run MATLAB Tests](https://github.com/matlab-actions/run-tests/) actions in your workflow.
Once you set up MATLAB, you can build and test your MATLAB project as part of your workflow. To execute code on the runner, include the [Run MATLAB Build](https://github.com/matlab-actions/run-build/), [Run MATLAB Tests](https://github.com/matlab-actions/run-tests/), or [Run MATLAB Command](https://github.com/matlab-actions/run-command/) actions in your workflow.

### Run MATLAB Script on GitHub-Hosted Runner
Set up a GitHub-hosted runner to run the commands in a file named `myscript.m` in the root of your repository. To run the script, include the [Run MATLAB Command](https://github.com/matlab-actions/run-command/) action in your workflow.
### Run MATLAB Build on GitHub-Hosted Runner
Set up a GitHub-hosted runner to run a specific task and its depended-on tasks that are specified in a file named `buildfile.m` in the root of your repository. To run tasks using the MATLAB build tool, include the [Run MATLAB Build](https://github.com/matlab-actions/run-build/) action in your workflow. This action is supported in MATLAB R2022b and later.

```yaml
name: Run MATLAB Script on GitHub-Hosted Runner
name: Run MATLAB Build on GitHub-Hosted Runner
on: [push]
jobs:
my-job:
name: Run MATLAB Script
name: Run MATLAB Build
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v1
- name: Run script
uses: matlab-actions/run-command@v1
uses: matlab-actions/setup-matlab@v2-beta
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this going to stay on the mpm branch until out of beta?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my initial thinking. I'm open to merging and using tags, but it seems like we might want to have easy access to make changes on v1 as needed for now too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I like keeping this on a branch until release. A lot of folks will look at the main branch README for doc, so we should probably keep any changes related to this beta out of the main branch README until release.

- name: Run build
uses: matlab-actions/run-build@v1
with:
command: myscript
tasks: test
```

### Run MATLAB Tests on GitHub-Hosted Runner
Set up a GitHub-hosted runner to automatically run the tests in your [MATLAB project](https://www.mathworks.com/help/matlab/projects.html) and generate a JUnit test results report and a Cobertura code coverage report. To run the tests and generate the artifacts, include the [Run MATLAB Tests](https://github.com/matlab-actions/run-tests/) action in your workflow.
Set up a GitHub-hosted runner to run the tests in your [MATLAB project](https://www.mathworks.com/help/matlab/projects.html) and generate a JUnit test results report and a Cobertura code coverage report. To run the tests and generate the artifacts, include the [Run MATLAB Tests](https://github.com/matlab-actions/run-tests/) action in your workflow.

```yaml
name: Run MATLAB Tests on GitHub-Hosted Runner
Expand All @@ -40,29 +40,51 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v1
uses: matlab-actions/setup-matlab@v2-beta
- name: Run tests and generate artifacts
uses: matlab-actions/run-tests@v1
with:
test-results-junit: test-results/results.xml
code-coverage-cobertura: code-coverage/coverage.xml
```

### Run MATLAB Script on GitHub-Hosted Runner
Set up a GitHub-hosted runner to run the commands in a file named `myscript.m` in the root of your repository. To run the script, include the [Run MATLAB Command](https://github.com/matlab-actions/run-command/) action in your workflow.

```yaml
name: Run MATLAB Script on GitHub-Hosted Runner
on: [push]
jobs:
my-job:
name: Run MATLAB Script
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v2-beta
- name: Run script
uses: matlab-actions/run-command@v1
with:
command: myscript
```

## Set Up MATLAB
When you define your workflow in the `.github/workflows` directory of your repository, specify the **Setup MATLAB** action as `matlab-actions/setup-matlab@v1`. The action accepts an optional input.

| Input | Description |
|-----------|-------------|
| `release` | (Optional) MATLAB release to set up. You can specify R2020a or a later release. If you do not specify `release`, the action sets up the latest release of MATLAB.<br/>**Example**: `R2021a`

| `release` | (Optional) MATLAB release to set up. You can specify R2020a or a later release. If you do not specify `release`, the action sets up the latest release of MATLAB.<br/>**Example**: `R2022a`
| `products` | (Optional) List of products to install. <br/> **Example**: `Simulink Simulink_Test`
## Notes
When you use the **Setup MATLAB** action, you execute third-party code that is licensed under separate terms.

## See Also
- [Action for Running MATLAB Commands](https://github.com/matlab-actions/run-command/)
- [Action for Running MATLAB Builds](https://github.com/matlab-actions/run-build/)
- [Action for Running MATLAB Tests](https://github.com/matlab-actions/run-tests/)
- [Action for Running MATLAB Commands](https://github.com/matlab-actions/run-command/)
- [Continuous Integration with MATLAB and Simulink](https://www.mathworks.com/solutions/continuous-integration.html)

## Contact Us
Expand Down
12 changes: 10 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ inputs:
description: >-
Array of products to install
required: false
default: MATLAB
default: |
MATLAB
Parallel_Computing_Toolbox
location:
description: >-
Destination location for MATLAB install
required: false
default: /opt/matlab

runs:
using: node12
using: node16
main: dist/index.js
15 changes: 15 additions & 0 deletions devel/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Contributing

Verify changes by running tests and building locally with the following command:

```
npm run ci
```

## Creating a New Release

Familiarize yourself with the best practices for [releasing and maintaining GitHub actions](https://docs.github.com/en/actions/creating-actions/releasing-and-maintaining-actions).

Changes should be made on a new branch. The new branch should be merged to the main branch via a pull request. Ensure that all of the CI pipeline checks and tests have passed for your changes.

After the pull request has been approved and merged to main, follow the Github process for [creating a new release](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository). The release must follow semantic versioning (ex: vX.Y.Z). This will kick off a new pipeline execution, and the action will automatically be published to the GitHub Actions Marketplace if the pipeline finishes successfully. Check the [GitHub Marketplace](https://github.com/marketplace/actions/setup-matlab) and check the major version in the repository (ex: v1 for v1.0.0) to ensure that the new semantically versioned tag is available.
254 changes: 0 additions & 254 deletions dist/index.js

This file was deleted.

4 changes: 0 additions & 4 deletions lib/index.d.ts

This file was deleted.

Loading