Skip to content
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

Add checkcode GitHub Action #55

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 14 additions & 4 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
# matlab-project-template
This is a template repository you can use for your MATLAB software project. It pre-populates essential files and directory structure when you use this template to create the repository for your project.

This is a template repository you can use for your MATLAB software project. It
pre-populates essential files and directory structure when you use this template
to create the repository for your project.

## Getting started
Click **Use this template**, then select **Create a new repository** and then fill in the essential information for your repository. Then a repository that utilises this template will be created for you.
More detailed instructions can be found [here]('https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template').

Click **Use this template**, then select **Create a new repository** and then
fill in the essential information for your repository. Then a repository that
utilises this template will be created for you. More detailed instructions can
be found
[here]('https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template').

## After the repository has been created
You will need to make changes to some of the placeholder content in the files in your new repository. See more instructions in the README file in the new repository.

You will need to make changes to some of the placeholder content in the files in
your new repository. See more instructions in the README file in the new
repository.

[![Test](https://github.com/reproducibleMATLAB/matlab-project-template/actions/workflows/test.yaml/badge.svg)](https://github.com/reproducibleMATLAB/matlab-project-template/actions/workflows/test.yaml)

Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/checkcode.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
name: Checkcode

on:
push:
branches:
- main
pull_request:

concurrency:
cancel-in-progress: true
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

jobs:
directories:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Get directories
id: directories
run: >-
echo directories=$(find . -type d -mindepth 1 -not -path '*/\.*' | sed
's/^..//' | jq -R -s -c 'split("\n")[:-1]') >> $GITHUB_OUTPUT
outputs:
directories: ${{ steps.directories.outputs.directories }}

checkcode:
needs: directories
runs-on: ubuntu-latest
strategy:
matrix:
directory: ${{ fromJson(needs.directories.outputs.directories) }}
steps:
- name: Checkout source
uses: actions/checkout@v4

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

- name: Move into ${{ matrix.directory }} directory
run: cd ${{ github.workspace }}/${{ matrix.directory }}

- name: Run MATLAB Command
uses: matlab-actions/run-command@v2
with:
command: mlintrpt
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PROJECT-NAME
(Add one line summary of what it does)

(Add one line summary of what it does)

## TODO Upon Project Creation

Expand All @@ -20,21 +20,24 @@

First, clone this repository:

```
# Clone this repository
```sh
git clone https://github.com/<username>/<PROJECT-NAME>.git
cd <PROJECT-NAME>
```
Alternatively, download the code as a .zip folder by clicking the "Code" button on GitHub.

Alternatively, download the code as a .zip folder by clicking the "Code" button
on GitHub.

## Contributing

<PROJECT-NAME> is an open-source project and we welcome contributions from the community.
<PROJECT-NAME> is an open-source <!-- markdownlint-disable-line MD033 -->
project, and we welcome contributions from the community.

If you'd like to contribute, please fork the repository and make changes as you'd like. Pull requests are warmly welcome.
If you'd like to contribute, please fork the repository and make changes as
you'd like. Pull requests are warmly welcome.

### Our Contributors

<a href="https://github.com/reproducibleMATLAB/matlab-project-template/graphs/contributors">
<img src="https://contrib.rocks/image?repo=reproducibleMATLAB/matlab-project-template" />
</a>
2 changes: 1 addition & 1 deletion tests/source/scripts/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

function out = main(variable)
% your code here %
end
end
2 changes: 1 addition & 1 deletion tests/source/scripts/mainRun.m
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
% Execute the runtests function to run the four tests in main.m
results = runtests('main');
results = runtests('main');
1 change: 0 additions & 1 deletion tests/source/scripts/mainTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@

% This unit test can use assert to check different outputs of main
% function

Loading