Repository navigation
plotly_version: 3.2.0 #95
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |