Repository navigation
176 lines (157 loc) · 5.67 KB
/
Copy pathci.yml
File metadata and controls
176 lines (157 loc) · 5.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: CI
on:
push:
branches: [master, develop]
tags: ['[0-9]+.[0-9]+.[0-9]+']
pull_request:
jobs:
octave-tests:
runs-on: ubuntu-26.04
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install Octave, Xvfb and packages
run: |
sudo apt-get update
sudo apt-get install -y octave octave-dev build-essential xvfb
octave --no-gui --eval "pkg install -forge datatypes; pkg install -forge statistics"
- name: Run plotly tests
working-directory: ${{ github.workspace }}/plotly/testing
env:
PLOTLY_ROOT: ${{ github.workspace }}/plotly
CI: true
run: |
xvfb-run -a octave --no-gui runplotlytests.m
matlab-tests:
name: matlab-tests (${{ matrix.release }})
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
release: [R2021a, R2022a, R2023a, R2024a, R2025a, R2026a, R2026b]
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v3
with:
release: ${{ matrix.release }}
cache: true
products: Statistics_and_Machine_Learning_Toolbox Symbolic_Math_Toolbox
- name: Run plotly tests
uses: matlab-actions/run-command@v3
env:
PLOTLY_ROOT: ${{ github.workspace }}/plotly
CI: true
with:
command: cd plotly/testing; runplotlytests
- name: Build gallery
if: ${{ !cancelled() }}
uses: matlab-actions/run-command@v3
with:
command: addpath(genpath('plotly')); mkdir('gallery'); makegallery('OutputFolder', 'gallery', 'Open', false);
- name: Upload gallery
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: gallery-${{ matrix.release }}
path: gallery/
package-toolbox:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v7
# the toolbox version comes from plotly_version.m, and File Exchange
# expects it to equal the release version
- name: Check the tag matches plotly_version.m
if: startsWith(github.ref, 'refs/tags/')
run: |
version=$(grep -oE '"[0-9]+\.[0-9]+\.[0-9]+"' plotly/plotly_aux/plotly_version.m | tr -d '"')
if [ "$version" != "$GITHUB_REF_NAME" ]; then
echo "::error::tag $GITHUB_REF_NAME does not match plotly_version.m ($version)"
exit 1
fi
# R2023a is the oldest release with matlab.addons.toolbox.ToolboxOptions
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v3
with:
release: R2023a
cache: true
- name: Package toolbox
uses: matlab-actions/run-command@v3
with:
command: buildtool package
- name: Upload toolbox
uses: actions/upload-artifact@v7
with:
name: toolbox
path: release/*.mltbx
install-toolbox:
name: install-toolbox (${{ matrix.os }}, ${{ matrix.release }})
needs: package-toolbox
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04]
release: [R2021a, R2026a, R2026b]
include:
- os: windows-latest
release: R2026b
- os: macos-latest
release: R2026b
steps:
# no checkout: fig2plotly must come from the installed toolbox
- name: Download toolbox
uses: actions/download-artifact@v8
with:
name: toolbox
path: release
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v3
with:
release: ${{ matrix.release }}
cache: true
- name: Install, use and uninstall the toolbox
uses: matlab-actions/run-command@v3
with:
command: |
mltbx = dir(fullfile("release", "*.mltbx"));
assert(isscalar(mltbx), "expected one .mltbx in release/");
installed = matlab.addons.toolbox.installToolbox(fullfile(mltbx.folder, mltbx.name));
disp(installed);
location = which("fig2plotly");
assert(~isempty(location), "fig2plotly is not on the path after installing");
disp(location);
assert(isfile(fullfile(fileparts(location), "LICENSE")), "the toolbox has no LICENSE");
fig = figure("Visible", "off");
plot(1:3);
p = plotlyfig(fig, "visible", "off");
assert(numel(p.data) == 1, "plotlyfig converted %d traces, expected 1", numel(p.data));
addtheme(struct("layout", struct()), "ggplot2");
clear p; % plotlyfig's destructor must run while the toolbox is still installed
close(fig);
matlab.addons.toolbox.uninstallToolbox(installed);
assert(isempty(which("fig2plotly")), "fig2plotly is still on the path after uninstalling");
# Creates a draft with the .mltbx attached; a maintainer publishes it, so
# services that react to published releases see it complete.
release:
if: startsWith(github.ref, 'refs/tags/')
needs: [octave-tests, matlab-tests, install-toolbox]
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
# the exact .mltbx the install jobs tested
- name: Download toolbox
uses: actions/download-artifact@v8
with:
name: toolbox
path: release
- name: Create draft release
env:
GH_TOKEN: ${{ github.token }}
run: >-
gh release create "$GITHUB_REF_NAME" release/*.mltbx
--repo "$GITHUB_REPOSITORY" --verify-tag --draft
--title "$GITHUB_REF_NAME" --generate-notes