Skip to content

Commit db4be46

Browse files
merge changes for v2-beta (#50)
1 parent 0ef2d59 commit db4be46

30 files changed

+6336
-3591
lines changed

.github/workflows/bat.yml

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Build and Test
22
on: [push]
33

44
env:
5-
MATHWORKS_SKIP_ACTIVATION: true
65
MATHWORKS_ACCOUNT: ${{ secrets.MATHWORKS_ACCOUNT }}
76
MATHWORKS_TOKEN: ${{ secrets.MATHWORKS_TOKEN }}
87

@@ -11,13 +10,13 @@ jobs:
1110
name: Build and Test
1211
runs-on: ubuntu-latest
1312
steps:
14-
- uses: actions/checkout@v2
15-
- uses: actions/setup-node@v1
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v3
1615
with:
17-
node-version: "12"
16+
node-version: 16
1817
- name: Perform npm tasks
1918
run: npm run ci
20-
- uses: actions/upload-artifact@v2
19+
- uses: actions/upload-artifact@v3
2120
with:
2221
name: built-action
2322
path: |
@@ -28,28 +27,33 @@ jobs:
2827
needs: bat
2928
runs-on: ${{ matrix.os }}
3029
strategy:
31-
fail-fast: false
30+
fail-fast: true
3231
matrix:
3332
include:
3433
- os: ubuntu-latest
35-
release: R2021b
36-
command: assert(~isempty(regexp(version('-release'), '\d{4}.')))
37-
# Excluding the R2020a job as the pilot currently only supports R2020b
38-
# - os: ubuntu-18.04
39-
# release: R2020a
40-
# command: assert(strcmp(version('-release'),'2020a'))
34+
release: latest
35+
check-matlab: matlabVer = ver('matlab'); assert(~isempty(matlabVer));
36+
check-simulink: simulinkVer = ver('simulink'); assert(~isempty(simulinkVer));
37+
- os: ubuntu-20.04
38+
release: R2022a
39+
check-matlab: matlabVer = ver('matlab'); assert(strcmp(matlabVer.Release,'(R2022a)'));
40+
check-simulink: simulinkVer = ver('simulink'); assert(strcmp(simulinkVer.Release,'(R2022a)'));
41+
- os: windows-latest
42+
release: latest
43+
check-matlab: matlabVer = ver('matlab'); assert(~isempty(matlabVer));
44+
check-simulink: simulinkVer = ver('simulink'); assert(~isempty(simulinkVer));
4145
steps:
42-
- uses: actions/download-artifact@v2
46+
- uses: actions/download-artifact@v3
4347
with:
4448
name: built-action
45-
- name: Perform 'setup-matlab'
49+
- name: Install MATLAB & Simulink (and PCT)
4650
uses: ./
4751
with:
48-
release: ${{ matrix.release }}
49-
products:
52+
release: ${{ matrix.release}}
53+
products: |
5054
MATLAB
51-
Parallel_Computing_Toolbox
52-
MATLAB_Compiler
53-
MATLAB_Compiler_SDK
54-
- name: Run Sample MATLAB Command
55-
run: matlab-batch "${{ matrix.command }}"
55+
Simulink
56+
- name: Check MATLAB version
57+
run: matlab-batch "${{ matrix.check-matlab }}"
58+
- name: Check Simulink version
59+
run: matlab-batch "${{ matrix.check-simulink }}"

.github/workflows/publish.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published, edited]
6+
7+
jobs:
8+
build:
9+
name: Build
10+
runs-on: ubuntu-latest
11+
outputs:
12+
tag: ${{ steps.update-package-version.outputs.version }}
13+
steps:
14+
# Configure runner with the right stuff
15+
- uses: actions/checkout@v3
16+
with:
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
- name: Configure git
19+
run: |
20+
git config user.name 'Release Action'
21+
git config user.email '<>'
22+
- uses: actions/setup-node@v3
23+
with:
24+
node-version: 16
25+
26+
# Call `npm version`. It increments the version and commits the changes.
27+
# We'll save the output (new version string) for use in the following
28+
# steps
29+
- name: Update package version
30+
id: update-package-version
31+
run: |
32+
git tag -d "${{ github.event.release.tag_name }}"
33+
VERSION=$(npm version "${{ github.event.release.tag_name }}" --no-git-tag-version)
34+
echo "::set-output name=version::$VERSION"
35+
git add package.json package-lock.json
36+
git commit -m "[skip ci] Bump $VERSION"
37+
git push origin HEAD:main
38+
39+
# Now carry on, business as usual
40+
- name: Perform npm tasks
41+
run: npm run ci
42+
43+
# Finally, create a detached commit containing the built artifacts and tag
44+
# it with the release. Note: the fact that the branch is locally updated
45+
# will not be relayed (pushed) to origin
46+
- name: Commit to release branch
47+
id: release_info
48+
run: |
49+
# Check for semantic versioning
50+
echo "Preparing release for version $longVersion"
51+
longVersion="${{github.event.release.tag_name}}"
52+
[[ $longVersion == v[0-9]*.[0-9]*.[0-9]* ]] || (echo "must follow semantic versioning" && exit 1)
53+
majorVersion=$(echo ${longVersion%.*.*})
54+
minorVersion=$(echo ${longVersion%.*})
55+
56+
# Add the built artifacts. Using --force because dist/lib should be in
57+
# .gitignore
58+
git add --force dist lib
59+
60+
# Make the commit
61+
MESSAGE="Build for $(git rev-parse --short HEAD)"
62+
git commit --allow-empty -m "$MESSAGE"
63+
git tag -f -a -m "Release $longVersion" $longVersion
64+
65+
# Get the commit of the tag you just released
66+
commitHash=$(git rev-list -n 1 $longVersion)
67+
68+
# Delete the old major and minor version tags locally
69+
git tag -d $majorVersion || true
70+
git tag -d $minorVersion || true
71+
72+
# Make new major and minor version tags locally that point to the commit you got from the "git rev-list" above
73+
git tag -f $majorVersion $commitHash
74+
git tag -f $minorVersion $commitHash
75+
76+
# Force push the new minor version tag to overwrite the old tag remotely
77+
echo "Pushing new tags"
78+
git push -f origin $longVersion
79+
git push -f origin $majorVersion
80+
git push -f origin $minorVersion

.github/workflows/release.yml

Lines changed: 0 additions & 82 deletions
This file was deleted.

README.md

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
11
# Action for Setting Up MATLAB on GitHub-Hosted Runner
22

3-
Before you run MATLAB&reg; code and Simulink&reg; models on a [GitHub&reg;-hosted](https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners) runner, first use the [Setup MATLAB](#set-up-matlab) action. The action sets up the specified MATLAB release on a Linux&reg; virtual machine. If you do not specify a release, the action sets up the latest release of MATLAB.
3+
Before you run MATLAB&reg; code and Simulink&reg; models on a [GitHub&reg;-hosted](https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners) runner, first use the [Setup MATLAB](#set-up-matlab) action. The action sets up the specified MATLAB release on a Linux&reg; or Windows&reg; virtual machine. If you do not specify a release, the action sets up the latest release of MATLAB.
44

5-
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;.
5+
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. Public licensing is not available for transformation products, such as MATLAB Coder&trade; and MATLAB Compiler&trade;.
66

77
## Usage Examples
8-
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.
8+
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.
99

10-
### Run MATLAB Script on GitHub-Hosted Runner
11-
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.
10+
### Run MATLAB Build on GitHub-Hosted Runner
11+
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.
1212

1313
```yaml
14-
name: Run MATLAB Script on GitHub-Hosted Runner
14+
name: Run MATLAB Build on GitHub-Hosted Runner
1515
on: [push]
1616
jobs:
1717
my-job:
18-
name: Run MATLAB Script
18+
name: Run MATLAB Build
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Check out repository
22-
uses: actions/checkout@v2
22+
uses: actions/checkout@v3
2323
- name: Set up MATLAB
24-
uses: matlab-actions/setup-matlab@v1
25-
- name: Run script
26-
uses: matlab-actions/run-command@v1
24+
uses: matlab-actions/setup-matlab@v2-beta
25+
with:
26+
products: Simulink Simulink_Test
27+
- name: Run build
28+
uses: matlab-actions/run-build@v1
2729
with:
28-
command: myscript
30+
tasks: test
2931
```
3032
3133
### Run MATLAB Tests on GitHub-Hosted Runner
32-
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.
34+
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.
3335
3436
```yaml
3537
name: Run MATLAB Tests on GitHub-Hosted Runner
@@ -40,29 +42,51 @@ jobs:
4042
runs-on: ubuntu-latest
4143
steps:
4244
- name: Check out repository
43-
uses: actions/checkout@v2
45+
uses: actions/checkout@v3
4446
- name: Set up MATLAB
45-
uses: matlab-actions/setup-matlab@v1
47+
uses: matlab-actions/setup-matlab@v2-beta
4648
- name: Run tests and generate artifacts
4749
uses: matlab-actions/run-tests@v1
4850
with:
4951
test-results-junit: test-results/results.xml
5052
code-coverage-cobertura: code-coverage/coverage.xml
5153
```
5254
55+
### Run MATLAB Script on GitHub-Hosted Runner
56+
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.
57+
58+
```yaml
59+
name: Run MATLAB Script on GitHub-Hosted Runner
60+
on: [push]
61+
jobs:
62+
my-job:
63+
name: Run MATLAB Script
64+
runs-on: ubuntu-latest
65+
steps:
66+
- name: Check out repository
67+
uses: actions/checkout@v3
68+
- name: Set up MATLAB
69+
uses: matlab-actions/setup-matlab@v2-beta
70+
- name: Run script
71+
uses: matlab-actions/run-command@v1
72+
with:
73+
command: myscript
74+
```
75+
5376
## Set Up MATLAB
5477
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.
5578

5679
| Input | Description |
5780
|-----------|-------------|
58-
| `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`
59-
81+
| `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`
82+
| `products` | (Optional) Space-separated list of products to install. If a product name contains white-space characters, replace them with underscores. For the full list of available products and their names, see [Products and Services](https://www.mathworks.com/products.html). By default, the task installs MATLAB and Parallel Computing Toolbox.<br/> **Example**: `Simulink`</br>**Example:** `Simulink Deep_Learning_Toolbox`
6083
## Notes
6184
When you use the **Setup MATLAB** action, you execute third-party code that is licensed under separate terms.
6285

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

6892
## Contact Us

action.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ inputs:
88
description: >-
99
MATLAB release to set up (R2020a or later)
1010
required: false
11-
default: R2021b
11+
default: latest
1212
products:
1313
description: >-
1414
Array of products to install
1515
required: false
16-
default: MATLAB
16+
default: |
17+
MATLAB
18+
Parallel_Computing_Toolbox
1719
runs:
18-
using: node12
20+
using: node16
1921
main: dist/index.js

devel/contributing.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## Contributing
2+
3+
Verify changes by running tests and building locally with the following command:
4+
5+
```
6+
npm run ci
7+
```
8+
9+
## Creating a New Release
10+
11+
Familiarize yourself with the best practices for [releasing and maintaining GitHub actions](https://docs.github.com/en/actions/creating-actions/releasing-and-maintaining-actions).
12+
13+
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.
14+
15+
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.

dist/index.js

Lines changed: 0 additions & 254 deletions
This file was deleted.

lib/index.d.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)