-
Notifications
You must be signed in to change notification settings - Fork 14
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
Davidb/mpm #50
Changes from 38 commits
7a12483
8a8f605
2e54d2d
8091c47
1375ca6
eef5296
50f16ad
25eb6fe
55c576c
40d866d
7f1fdda
46e7daa
2e665de
ad431e0
0a1176c
ddf6c8e
5099d96
f8c7a05
f0e45fe
0b67291
ee31f66
a8893fd
bacc53a
ae2ef07
63123b7
d7d39b6
71fedd9
07d2345
9368315
6c1f874
a71b1b7
703aa79
669ed9a
a8947ae
e5eb26e
f236f47
57833da
2c2b042
164142e
31283dc
65ddcd5
f8a9aa5
dc44c11
3720cf8
f873f22
4baab09
6401472
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,31 +5,31 @@ Before you run MATLAB® code and Simulink® models on a [GitHub®-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™ and MATLAB Compiler™. | ||
|
||
## 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
@@ -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` | ||
davidbuzinski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
## 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 | ||
|
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. |
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.