Skip to content

Name change

Name change #64

Workflow file for this run

name: Build and Test
on: [push]
jobs:
bat:
name: Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "16"
- name: Perform npm tasks
run: npm run ci
- name: Perform 'setup-matlab'
uses: matlab-actions/setup-matlab@v1
- name: Create buildfile.m in project root for tests
run: |
cat <<'_EOF' >> "buildfile.m"
function plan = buildfile
plan = buildplan(localfunctions);
plan("test").Dependencies = "build";
plan("deploy").Dependencies = "test";
plan.DefaultTasks = "test";
function buildTask(~)
f = fopen('buildlog.txt', 'a+'); fprintf(f, 'building\n'); fclose(f);
function testTask(~)
f = fopen('buildlog.txt', 'a+'); fprintf(f, 'testing\n'); fclose(f);
function deployTask(~)
f = fopen('buildlog.txt', 'a+'); fprintf(f, 'deploying\n'); fclose(f);
function checkTask(~)
f = fopen('buildlog.txt', 'a+'); fprintf(f, 'checking\n'); fclose(f);
_EOF
- name: Run build with default tasks
uses: ./
- name: Verify correct tasks appear in buildlog.txt
run: |
set -e
grep "building" buildlog.txt
grep "testing" buildlog.txt
! grep "deploying" buildlog.txt
! grep "checking" buildlog.txt
rm buildlog.txt
- name: Run build with specified task
uses: ./
with:
tasks: deploy
- name: Verify correct tasks appear in buildlog.txt
run: |
set -e
grep "building" buildlog.txt
grep "testing" buildlog.txt
grep "deploying" buildlog.txt
! grep "checking" buildlog.txt
rm buildlog.txt
- name: Run build with multiple specified tasks
uses: ./
with:
tasks: deploy check
- name: Verify correct tasks appear in buildlog.txt
run: |
set -e
grep "building" buildlog.txt
grep "testing" buildlog.txt
grep "deploying" buildlog.txt
grep "checking" buildlog.txt
rm buildlog.txt
- name: Run build with startup options
uses: ./
with:
startup-options: -logfile buildlog2.txt
- name: Verify tasks appear in buildlog2.txt
run: |
set -e
grep "build" buildlog2.txt
grep "test" buildlog2.txt
! grep "deploy" buildlog2.txt
! grep "check" buildlog2.txt
rm buildlog.txt
rm buildlog2.txt
- name: Create second build file
run: |
mkdir new
cd new
cat <<'_EOF' >> "buildfile.m"
function plan = buildfile
plan = buildplan(localfunctions);
plan.DefaultTasks = "hello";
function helloTask(~)
disp("Hello world!");
_EOF
cd ..
- name: Run Build in subfolder
uses: ./
with:
startup-options: -logfile buildlog.txt
working-directory: new
- name: Verify correct build file ran
run: |
set -e
grep "Hello world!" buildlog.txt
rm buildlog.txt
rm -rf new