Skip to content
Merged
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
41 changes: 21 additions & 20 deletions .github/workflows/bat.yml
Original file line number Diff line number Diff line change
@@ -1,85 +1,89 @@
name: Build and Test
on: [push]
permissions:
contents: read

jobs:
bat:
name: Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 20
- name: Perform npm tasks
run: npm run ci

- uses: actions/upload-artifact@v4
with:
name: built-action
path: |
**/*
!node_modules/
integ:
needs: bat
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-14]
steps:
- uses: actions/download-artifact@v5
with:
name: built-action
- name: Perform 'setup-matlab'
uses: matlab-actions/setup-matlab@v2

- name: Greet the world in style
uses: ./
with:
command: "disp('hello world');"

- name: Run MATLAB statement
uses: ./
with:
command: f = fopen('myscript.m', 'w'); fwrite(f, 'assert(true)'); fclose(f);

- name: Run MATLAB script
uses: ./
with:
command: myscript

- name: Run MATLAB statement with quotes 1
uses: ./
with:
command: "eval(\"a = 1+2\"), assert(a == 3); eval('b = 3+4'), assert(b == 7);"

- name: Run MATLAB statement with quotes 2
uses: ./
with:
command: 'eval("a = 1+2"), assert(a == 3); eval(''b = 3+4''), assert(b == 7);'

- name: Run MATLAB statement with quotes 3
uses: ./
with:
command: a = """hello world""", b = '"hello world"', assert(strcmp(a,b));

- name: Run MATLAB statement with symbols
uses: ./
with:
command: a = " !""#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~", b = char([32:126]), assert(strcmp(a, b), a+b);

- name: Run MATLAB statement in working directory
uses: ./
with:
command: exp = getenv('GITHUB_WORKSPACE'), act = pwd, assert(strcmp(act, exp), strjoin({act exp}, '\n'));

- name: Run MATLAB statement with arguments
uses: ./
with:
command: disp("Hello world!!")
startup-options: -nojvm -nodesktop -logfile mylog.log

- name: Validate that previous command ran with arguments
uses: ./
with:
command: assert(isfile("mylog.log"));

- run: echo 'onetyone = 11' > startup.m
shell: bash

- name: MATLAB runs startup.m automatically
uses: ./
with:
command: assert(onetyone==11, 'the variable `onetyone` was not set as expected by startup.m')

- run: |
mkdir subdir
echo 'onetyonetyone = 111' > subdir/startup.m
shell: bash

- name: MATLAB sd startup option is not overwritten
uses: ./
with:
Expand All @@ -88,17 +92,14 @@ jobs:
[~, f] = fileparts(pwd);
assert(strcmp(f, 'subdir'));
startup-options: -sd subdir

- name: Verify environment variables make it to MATLAB
uses: ./
with:
command: exp = 'my_value', act = getenv('MY_VAR'), assert(strcmp(act, exp), strjoin({act exp}, '\n'));
env:
MY_VAR: my_value

# Remove when online batch licensing is the default
- name: Verify MW_BATCH_LICENSING_ONLINE variable set
uses: ./
with:
command: exp = 'true', act = getenv('MW_BATCH_LICENSING_ONLINE'), assert(strcmp(act, exp), strjoin({act exp}, '\n'));

13 changes: 5 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Publish

on:
release:
types: published
permissions:
contents: write

jobs:
build:
Expand All @@ -11,15 +12,12 @@ jobs:
outputs:
tag: ${{ steps.update-package-version.outputs.version }}
steps:
# Configure runner with the right stuff
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v5
- name: Configure git
run: |
git config user.name 'Release Action'
git config user.email '<>'
- uses: actions/setup-node@v4
- uses: actions/setup-node@v5
with:
node-version: 20

Expand All @@ -31,7 +29,6 @@ jobs:
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
Expand All @@ -47,8 +44,8 @@ jobs:
id: release_info
run: |
# Check for semantic versioning
echo "Preparing release for version $longVersion"
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%.*})
Expand Down
Loading