Skip to content

Publish mltbx

Publish mltbx #5

Workflow file for this run

name: "Publish mltbx"
on:
workflow_dispatch:
release:
types: published
jobs:
build-ubuntu:
# Running on ubuntu-latest would use a glibc version that is incompatible when using the built mex files on a Debian 11
# Instead, run on ubuntu-20.04
runs-on: ubuntu-20.04
permissions:
contents: write
env:
OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install"
steps:
- name: Download OpenTelemetry-Matlab source
uses: actions/checkout@v3
with:
path: opentelemetry-matlab
- name: Install MATLAB
uses: matlab-actions/setup-matlab@v2
with:
products: MATLAB_Compiler
- name: Build OpenTelemetry-Matlab
run: |
cd opentelemetry-matlab
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
cmake --build build --config Release --target install
- name: Compress into single artifact
working-directory: ${{ github.workspace }}
run: tar -czf otel-matlab-ubuntu.tar.gz otel_matlab_install
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: otel-matlab-ubuntu.tar.gz
path: ${{ github.workspace }}/otel-matlab-ubuntu.tar.gz
build-windows:
runs-on: windows-latest
env:
OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install"
steps:
- name: Download OpenTelemetry-Matlab source
uses: actions/checkout@v3
with:
path: opentelemetry-matlab
- name: Install MATLAB
uses: matlab-actions/setup-matlab@v2
with:
products: MATLAB_Compiler
- name: Build OpenTelemetry-Matlab
run: |
cd opentelemetry-matlab
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
cmake --build build --config Release --target install
- name: Compress into single artifact
working-directory: ${{ github.workspace }}
run: tar -czf otel-matlab-windows.tar.gz otel_matlab_install
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: otel-matlab-windows.tar.gz
path: ${{ github.workspace }}/otel-matlab-windows.tar.gz
build-macos:
runs-on: macos-latest
env:
OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install"
steps:
- name: Download OpenTelemetry-Matlab source
uses: actions/checkout@v3
with:
path: opentelemetry-matlab
- name: Install MATLAB
uses: matlab-actions/setup-matlab@v2
with:
products: MATLAB_Compiler
- name: Build OpenTelemetry-Matlab
run: |
cd opentelemetry-matlab
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
cmake --build build --config Release --target install
- name: Compress into single artifact
working-directory: ${{ github.workspace }}
run: tar -czf otel-matlab-macos.tar.gz otel_matlab_install
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: otel-matlab-macos.tar.gz
path: ${{ github.workspace }}/otel-matlab-macos.tar.gz
package-mltbx:
name: Package MATLAB Toolbox (MLTBX) Files
runs-on: ubuntu-20.04
needs:
- build-ubuntu
- build-windows
- build-macos
env:
OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install"
steps:
- name: Checkout OpenTelemetry-Matlab
uses: actions/checkout@v3
with:
path: OpenTelemetry-Matlab
- name: Read version
id: getversion
working-directory: OpenTelemetry-Matlab
run: echo "version=$(cat VERSION.txt)" >> $GITHUB_OUTPUT
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: artifacts-downloaded
- name: Decompress Artifacts
run: |
mv artifacts-downloaded/*/*.tar.gz .
tar -xzvf otel-matlab-ubuntu.tar.gz
tar -xzvf otel-matlab-macos.tar.gz
tar -xzvf otel-matlab-windows.tar.gz
- name: Install MATLAB
uses: matlab-actions/setup-matlab@v1
- name: Run commands
env:
MATLABPATH: OpenTelemetry-Matlab/tools
OTEL_MATLAB_TOOLBOX_FOLDER: otel_matlab_install
OTEL_MATLAB_TOOLBOX_OUTPUT_FOLDER:
OTEL_MATLAB_TOOLBOX_VERSION: ${{ steps.getversion.outputs.version }}
uses: matlab-actions/run-command@v1
with:
command: packageMatlabInterface
- name: Compress Asset
run: zip otel-matlab-${{ github.event.release.tag_name }}.mltbx.zip otel-matlab.mltbx
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./otel-matlab-${{ github.event.release.tag_name }}.mltbx.zip
asset_name: otel-matlab-${{ github.event.release.tag_name }}.mltbx.zip
asset_content_type: application/zip