-
Notifications
You must be signed in to change notification settings - Fork 0
Add a format gate in CI #21
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
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
15b69b4
Add format gate in CI
davidbuzinski 15a3c6f
fix formatter findings
davidbuzinski 728f753
add contribuing and run npm audit fix
davidbuzinski e144a21
sanitize
davidbuzinski cf180e9
Address doc feedback
davidbuzinski 96f92c8
Bump handlebars from 4.7.8 to 4.7.9
dependabot[bot] 2717d7d
rebase
davidbuzinski e21a435
npm audit fix
davidbuzinski dab53ea
run format
davidbuzinski d6dbbb0
fix contributing
davidbuzinski 61803c6
remove end of line whitespace
davidbuzinski be37af7
merge conflicts
davidbuzinski 9587e12
update workflow
davidbuzinski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,35 +1,34 @@ | ||
| name: Build and Test | ||
| on: [push] | ||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| plugin-tests: | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-latest | ||
| - os: windows-latest | ||
| - os: macos-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: matlab-actions/setup-matlab@v2 | ||
| with: | ||
| release: latest-including-prerelease | ||
| - uses: matlab-actions/run-tests@v2 | ||
| with: | ||
| source-folder: plugins | ||
|
|
||
| bat: | ||
| name: Build and Test | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 24 | ||
| - name: Perform npm tasks | ||
| run: npm run ci | ||
|
|
||
| name: Build and Test | ||
| on: [push] | ||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| plugin-tests: | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-latest | ||
| - os: windows-latest | ||
| - os: macos-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: matlab-actions/setup-matlab@v3 | ||
| with: | ||
| release: latest-including-prerelease | ||
| - uses: matlab-actions/run-tests@v3 | ||
| with: | ||
| source-folder: plugins | ||
|
|
||
| bat: | ||
| name: Build and Test | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 24 | ||
| - name: Perform npm tasks | ||
| run: npm run ci |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,77 +1,77 @@ | ||
| name: Publish | ||
| on: | ||
| release: | ||
| types: published | ||
| permissions: | ||
| contents: write | ||
| jobs: | ||
| build: | ||
| name: Build | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| tag: ${{ steps.update-package-version.outputs.version }} | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Configure git | ||
| run: | | ||
| git config user.name 'Release Action' | ||
| git config user.email '<>' | ||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 24 | ||
| # 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) | ||
| 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 | ||
| longVersion="${{github.event.release.tag_name}}" | ||
| echo "Preparing release for version $longVersion" | ||
| [[ $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 | ||
| name: Publish | ||
| on: | ||
| release: | ||
| types: published | ||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| tag: ${{ steps.update-package-version.outputs.version }} | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Configure git | ||
| run: | | ||
| git config user.name 'Release Action' | ||
| git config user.email '<>' | ||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 24 | ||
|
|
||
| # 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) | ||
| 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 | ||
| longVersion="${{github.event.release.tag_name}}" | ||
| echo "Preparing release for version $longVersion" | ||
| [[ $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 contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| ## 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. | ||
|
|
||
| ## Adding a Pre-Commit Hook | ||
|
|
||
| You can run all CI checks before each commit by adding a pre-commit hook. To do so, navigate to the repository root folder and run the following commands: | ||
|
|
||
| _bash (Linux/macOS)_ | ||
|
|
||
| ```sh | ||
| echo '#!/bin/sh' > .git/hooks/pre-commit | ||
| echo 'npm run ci' >> .git/hooks/pre-commit | ||
| chmod +x .git/hooks/pre-commit | ||
| ``` | ||
|
|
||
| _Command Prompt (Windows)_ | ||
|
|
||
| ```cmd | ||
| echo #!/bin/sh > .git\hooks\pre-commit | ||
| echo npm run ci >> .git\hooks\pre-commit | ||
| ``` | ||
|
|
||
| _PowerShell (Windows)_ | ||
|
|
||
| ```pwsh | ||
| Set-Content .git\hooks\pre-commit '#!/bin/sh' | ||
| Add-Content .git\hooks\pre-commit 'npm run ci' | ||
| ``` | ||
|
|
||
| > **Note:** | ||
| > Git hooks are not version-controlled, so you need to set up this hook for each fresh clone of the repository. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only "manual" change in this PR. All the other changes come from the formatter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can see I let the format-check fail in CI the first build before applying a commit with the fixes to verify the behavior.