Skip to content

Commit dea36be

Browse files
committed
ci template
1 parent c629c37 commit dea36be

File tree

6 files changed

+26
-33
lines changed

6 files changed

+26
-33
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
- "**.m"
77
- ".github/workflows/ci.yml"
88

9+
# avoid wasted runs
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
913

1014
jobs:
1115

@@ -15,7 +19,7 @@ jobs:
1519

1620
strategy:
1721
matrix:
18-
release: [R2020b, latest]
22+
release: [R2020b, R2025a]
1923

2024
steps:
2125
- uses: actions/checkout@v4

.github/workflows/composite-buildtool/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ runs:
77
steps:
88

99
- name: Run Matlab buildtool
10-
if: ${{ matrix.release >= 'R2022b' || startsWith(matrix.release, 'latest') }}
10+
if: ${{ matrix.release >= 'R2022b' }}
1111
uses: matlab-actions/run-build@v2
1212
with:
1313
startup-options: ${{ matrix.startup-options }}
1414
tasks: check test
1515

1616

1717
- name: Run tests (manual)
18-
if: ${{ matrix.release < 'R2022b' && !startsWith(matrix.release, 'latest') }}
18+
if: ${{ matrix.release < 'R2022b' }}
1919
uses: matlab-actions/run-tests@v2
2020
with:
2121
select-by-folder: test

.github/workflows/publish.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ concurrency:
2121
group: "pages"
2222
cancel-in-progress: false
2323

24+
2425
jobs:
2526

2627
deploy:
@@ -46,7 +47,10 @@ jobs:
4647
- name: Run Matlab buildtool
4748
uses: matlab-actions/run-build@v2
4849
with:
49-
tasks: test publish
50+
tasks: publish
51+
# don't run "test" task as then even "clean" will leave Matlab in cached state where
52+
# it won't publish due to thinking a function is a Mex file. Error is
53+
# "Error using publish Only MATLAB code can be published"
5054

5155
- name: Upload artifact
5256
uses: actions/upload-pages-artifact@v3

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ which means `import matmap3d` statements allow scoped use of this code.
2424
Optionally, run self-tests:
2525

2626
```matlab
27-
buildtool
27+
buildtool check test
2828
```
2929

3030
### Functions

buildfile.m

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,27 @@
11
function plan = buildfile
22

3-
plan = buildplan();
3+
plan = buildplan(localfunctions);
44

55
plan.DefaultTasks = "test";
66

77
pkg_name = "+matmap3d";
88

9-
if isMATLABReleaseOlderThan("R2023b")
10-
plan("test") = matlab.buildtool.Task(Actions=@legacy_test);
11-
else
12-
plan("check") = matlab.buildtool.tasks.CodeIssuesTask(pkg_name, IncludeSubfolders=true, ...
13-
WarningThreshold=0);
14-
plan("test") = matlab.buildtool.tasks.TestTask("test", Strict=false);
15-
end
9+
plan("check") = matlab.buildtool.tasks.CodeIssuesTask(pkg_name, Results="CodeIssues.sarif", ...
10+
IncludeSubfolders=true, WarningThreshold=0);
11+
plan("test") = matlab.buildtool.tasks.TestTask("test", TestResults="TestResults.xml", Strict=false);
1612

1713
if ~isMATLABReleaseOlderThan("R2024a")
1814
plan("coverage") = matlab.buildtool.tasks.TestTask(Description="code coverage", SourceFiles="test", Strict=false, CodeCoverageResults="code-coverage.xml");
1915
end
2016

21-
plan("publish") = matlab.buildtool.Task(Description="HTML inline doc generate", Actions=@publish_html);
22-
23-
24-
end
25-
26-
27-
function legacy_test(context)
28-
r = runtests(fullfile(context.Plan.RootFolder, "test"), Strict=false);
29-
% Parallel Computing Toolbox takes more time to startup than is worth it for this task
30-
31-
assert(~isempty(r), "No tests were run")
32-
assertSuccess(r)
3317
end
3418

3519

36-
function publish_html(context)
37-
outdir = fullfile(context.Plan.RootFolder, "docs");
20+
function publishTask(context)
21+
% publish HTML inline documentation strings to individual HTML files
22+
outdir = fullfile(context.Plan.RootFolder, 'docs');
3823

39-
publish_gen_index_html("matmap3d", ...
24+
publish_gen_index_html("matmap3d", ...
4025
"Geographic coordinate tranformation functions for Matlab.", ...
4126
"https://github.com/geospace-code/matmap3d", ...
4227
outdir)

private/publish_gen_index_html.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212

1313
function publish_gen_index_html(pkg_name, tagline, project_url, outdir)
1414
arguments
15-
pkg_name (1,1) string
16-
tagline (1,1) string
17-
project_url (1,1) string
18-
outdir (1,1) string
15+
pkg_name {mustBeTextScalar}
16+
tagline {mustBeTextScalar}
17+
project_url {mustBeTextScalar}
18+
outdir {mustBeTextScalar}
1919
end
2020

2121
pkg = what("+" + pkg_name);
@@ -24,7 +24,7 @@ function publish_gen_index_html(pkg_name, tagline, project_url, outdir)
2424

2525
%% Git info
2626
repo = gitrepo(pkg.path);
27-
git_txt = "Git branch / commit: " + repo.CurrentBranch.Name + " " + extractBefore(repo.LastCommit.ID, 8);
27+
git_txt = "Git branch / commit: " + repo.CurrentBranch.Name + " " + repo.LastCommit.ID{1}(1:8);
2828

2929
%% generate docs
3030
readme = fullfile(outdir, "index.html");

0 commit comments

Comments
 (0)