Skip to content

Commit af3cee2

Browse files
committed
Create two .mltbx files
1 parent d643d7d commit af3cee2

File tree

2 files changed

+270
-1
lines changed

2 files changed

+270
-1
lines changed
Lines changed: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
name: "Create Multiple .mltbx Files"
2+
on:
3+
workflow_dispatch:
4+
jobs:
5+
http-grpc-ubuntu:
6+
runs-on: ubuntu-22.04
7+
env:
8+
OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install"
9+
steps:
10+
- name: Download OpenTelemetry-Matlab source
11+
uses: actions/checkout@v3
12+
with:
13+
path: opentelemetry-matlab
14+
- name: Install ninja-build
15+
run: sudo apt-get install ninja-build
16+
- name: Install MATLAB
17+
uses: matlab-actions/setup-matlab@v2
18+
with:
19+
release: R2025a
20+
products: MATLAB_Compiler
21+
- name: Build OpenTelemetry-Matlab
22+
working-directory: opentelemetry-matlab
23+
run: |
24+
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_OTLP_GRPC=ON -DWITH_OTLP_FILE=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
25+
cmake --build build --config Release --target install
26+
- name: Compress into single artifact
27+
working-directory: ${{ github.workspace }}
28+
run: tar -czf otel-matlab-httpgrpc-ubuntu.tar.gz otel_matlab_install
29+
- name: Upload artifacts
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: otel-matlab-httpgrpc-ubuntu.tar.gz
33+
path: ${{ github.workspace }}/otel-matlab-httpgrpc-ubuntu.tar.gz
34+
http-ubuntu:
35+
runs-on: ubuntu-22.04
36+
env:
37+
OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install"
38+
steps:
39+
- name: Download OpenTelemetry-Matlab source
40+
uses: actions/checkout@v3
41+
with:
42+
path: opentelemetry-matlab
43+
- name: Install ninja-build
44+
run: sudo apt-get install ninja-build
45+
- name: Install MATLAB
46+
uses: matlab-actions/setup-matlab@v2
47+
with:
48+
release: R2025a
49+
products: MATLAB_Compiler
50+
- name: Build OpenTelemetry-Matlab
51+
working-directory: opentelemetry-matlab
52+
run: |
53+
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_OTLP_FILE=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
54+
cmake --build build --config Release --target install
55+
- name: Compress into single artifact
56+
working-directory: ${{ github.workspace }}
57+
run: tar -czf otel-matlab-httponly-ubuntu.tar.gz otel_matlab_install
58+
- name: Upload artifacts
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: otel-matlab-httponly-ubuntu.tar.gz
62+
path: ${{ github.workspace }}/otel-matlab-httponly-ubuntu.tar.gz
63+
http-grpc-windows:
64+
runs-on: windows-latest
65+
env:
66+
OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install"
67+
steps:
68+
- name: Download OpenTelemetry-Matlab source
69+
uses: actions/checkout@v3
70+
with:
71+
path: opentelemetry-matlab
72+
- name: Install ninja-build
73+
run: choco install ninja
74+
- name: Install MATLAB
75+
uses: matlab-actions/setup-matlab@v2
76+
with:
77+
release: R2025a
78+
products: MATLAB_Compiler
79+
- name: Build OpenTelemetry-Matlab
80+
working-directory: opentelemetry-matlab
81+
shell: cmd
82+
run: |
83+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
84+
cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE=Release -DWITH_OTLP_GRPC=ON -DWITH_OTLP_FILE=ON -DFETCH_VCPKG=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
85+
cmake --build build --config Release --target install
86+
- name: Compress into single artifact
87+
working-directory: ${{ github.workspace }}
88+
run: tar -czf otel-matlab-httpgrpc-windows.tar.gz otel_matlab_install
89+
- name: Upload artifacts
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: otel-matlab-httpgrpc-windows.tar.gz
93+
path: ${{ github.workspace }}/otel-matlab-httpgrpc-windows.tar.gz
94+
http-windows:
95+
runs-on: windows-latest
96+
env:
97+
OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install"
98+
steps:
99+
- name: Download OpenTelemetry-Matlab source
100+
uses: actions/checkout@v3
101+
with:
102+
path: opentelemetry-matlab
103+
- name: Install ninja-build
104+
run: choco install ninja
105+
- name: Install MATLAB
106+
uses: matlab-actions/setup-matlab@v2
107+
with:
108+
release: R2025a
109+
products: MATLAB_Compiler
110+
- name: Build OpenTelemetry-Matlab
111+
working-directory: opentelemetry-matlab
112+
shell: cmd
113+
run: |
114+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
115+
cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE=Release -DWITH_OTLP_FILE=ON -DFETCH_VCPKG=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
116+
cmake --build build --config Release --target install
117+
- name: Compress into single artifact
118+
working-directory: ${{ github.workspace }}
119+
run: tar -czf otel-matlab-httponly-windows.tar.gz otel_matlab_install
120+
- name: Upload artifacts
121+
uses: actions/upload-artifact@v4
122+
with:
123+
name: otel-matlab-httponly-windows.tar.gz
124+
path: ${{ github.workspace }}/otel-matlab-httponly-windows.tar.gz
125+
http-grpc-macos:
126+
runs-on: ${{ matrix.os }}
127+
strategy:
128+
matrix:
129+
os: [macos-13, macos-14] # runs on Mac with both Intel (macos-13) and Apple Silicon (macos-14) processors
130+
env:
131+
OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install"
132+
steps:
133+
- name: Download OpenTelemetry-Matlab source
134+
uses: actions/checkout@v3
135+
with:
136+
path: opentelemetry-matlab
137+
- name: Install ninja-build
138+
run: brew install ninja
139+
- name: Install MATLAB
140+
uses: matlab-actions/setup-matlab@v2
141+
with:
142+
release: R2025a
143+
products: MATLAB_Compiler
144+
- name: Build OpenTelemetry-Matlab
145+
working-directory: opentelemetry-matlab
146+
run: |
147+
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_OTLP_GRPC=ON -DWITH_OTLP_FILE=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
148+
cmake --build build --config Release --target install
149+
- name: Compress into single artifact
150+
working-directory: ${{ github.workspace }}
151+
run: tar -czf otel-matlab-httpgrpc-${{ matrix.os }}.tar.gz otel_matlab_install
152+
- name: Upload artifacts
153+
uses: actions/upload-artifact@v4
154+
with:
155+
name: otel-matlab-httpgrpc-${{ matrix.os }}.tar.gz
156+
path: ${{ github.workspace }}/otel-matlab-httpgrpc-${{ matrix.os }}.tar.gz
157+
http-macos:
158+
runs-on: ${{ matrix.os }}
159+
strategy:
160+
matrix:
161+
os: [macos-13, macos-14] # runs on Mac with both Intel (macos-13) and Apple Silicon (macos-14) processors
162+
env:
163+
OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install"
164+
steps:
165+
- name: Download OpenTelemetry-Matlab source
166+
uses: actions/checkout@v3
167+
with:
168+
path: opentelemetry-matlab
169+
- name: Install ninja-build
170+
run: brew install ninja
171+
- name: Install MATLAB
172+
uses: matlab-actions/setup-matlab@v2
173+
with:
174+
release: R2025a
175+
products: MATLAB_Compiler
176+
- name: Build OpenTelemetry-Matlab
177+
working-directory: opentelemetry-matlab
178+
run: |
179+
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_OTLP_FILE=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
180+
cmake --build build --config Release --target install
181+
- name: Compress into single artifact
182+
working-directory: ${{ github.workspace }}
183+
run: tar -czf otel-matlab-httponly-${{ matrix.os }}.tar.gz otel_matlab_install
184+
- name: Upload artifacts
185+
uses: actions/upload-artifact@v4
186+
with:
187+
name: otel-matlab-httponly-${{ matrix.os }}.tar.gz
188+
path: ${{ github.workspace }}/otel-matlab-httponly-${{ matrix.os }}.tar.gz
189+
package-mltbx:
190+
name: Package MATLAB Toolbox (MLTBX) Files
191+
runs-on: ubuntu-22.04
192+
permissions:
193+
contents: write
194+
needs:
195+
- http-grpc-ubuntu
196+
- http-grpc-windows
197+
- http-grpc-macos
198+
- http-ubuntu
199+
- http-windows
200+
- http-macos
201+
env:
202+
OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install"
203+
steps:
204+
- name: Checkout OpenTelemetry-Matlab
205+
uses: actions/checkout@v3
206+
with:
207+
path: OpenTelemetry-Matlab
208+
- name: Download Artifacts
209+
uses: actions/download-artifact@v4
210+
with:
211+
path: artifacts-downloaded
212+
- name: Install MATLAB
213+
uses: matlab-actions/setup-matlab@v2
214+
with:
215+
release: R2025a
216+
- name: Decompress Artifacts with full dependencies
217+
working-directory: http_grpc
218+
run: |
219+
mv artifacts-downloaded/*/*httpgrpc*.tar.gz .
220+
tar -xzvf otel-matlab-httpgrpc-ubuntu.tar.gz
221+
tar -xzvf otel-matlab-httpgrpc-macos-13.tar.gz
222+
tar -xzvf otel-matlab-httpgrpc-macos-14.tar.gz
223+
tar -xzvf otel-matlab-httpgrpc-windows.tar.gz
224+
- name: Run commands full dependencies
225+
env:
226+
MATLABPATH: OpenTelemetry-Matlab/tools
227+
WORKING_FOLDER: http_grpc
228+
OTEL_MATLAB_TOOLBOX_FOLDER: otel_matlab_install
229+
OTEL_MATLAB_TOOLBOX_OUTPUT_FOLDER: ..
230+
OTEL_MATLAB_TOOLBOX_VERSION:
231+
OTEL_MATLAB_TOOLBOX_NAME: otel-matlab
232+
uses: matlab-actions/run-command@v1
233+
with:
234+
command: packageMatlabInterface
235+
- name: Decompress Artifacts with minimal dependencies
236+
working-directory: http_only
237+
run: |
238+
mv artifacts-downloaded/*/*httponly*.tar.gz .
239+
tar -xzvf otel-matlab-httponly-ubuntu.tar.gz
240+
tar -xzvf otel-matlab-httponly-macos-13.tar.gz
241+
tar -xzvf otel-matlab-httponly-macos-14.tar.gz
242+
tar -xzvf otel-matlab-httponly-windows.tar.gz
243+
- name: Run commands minimal dependencies
244+
env:
245+
MATLABPATH: OpenTelemetry-Matlab/tools
246+
WORKING_FOLDER: http_only
247+
OTEL_MATLAB_TOOLBOX_FOLDER: otel_matlab_install
248+
OTEL_MATLAB_TOOLBOX_OUTPUT_FOLDER: ..
249+
OTEL_MATLAB_TOOLBOX_VERSION:
250+
OTEL_MATLAB_TOOLBOX_NAME: otel-matlab-http-only
251+
uses: matlab-actions/run-command@v1
252+
with:
253+
command: packageMatlabInterface
254+
- name: Upload artifacts full dependencies
255+
uses: actions/upload-artifact@v4
256+
with:
257+
name: otel-matlab.mltbx
258+
path: otel-matlab.mltbx
259+
- name: Upload artifacts minimal dependencies
260+
uses: actions/upload-artifact@v4
261+
with:
262+
name: otel-matlab-http-only.mltbx
263+
path: otel-matlab-http-only.mltbx

tools/packageMatlabInterface.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,19 @@
1010
toolboxFolder = string(getenv("OTEL_MATLAB_TOOLBOX_FOLDER"));
1111
outputFolder = string(getenv("OTEL_MATLAB_TOOLBOX_OUTPUT_FOLDER"));
1212
toolboxVersion = string(getenv("OTEL_MATLAB_TOOLBOX_VERSION"));
13+
workingFolder = string(getenv("WORKING_FOLDER"));
14+
toolboxName = string(getenv("OTEL_MATLAB_TOOLBOX_NAME"));
15+
16+
% cd to working folder
17+
cd(workingFolder);
1318

1419
% Output folder must exist.
1520
mkdir(outputFolder);
1621

1722
disp("Toolbox Folder: " + toolboxFolder);
1823
disp("Output Folder: " + outputFolder);
1924
disp("Toolbox Version:" + toolboxVersion);
25+
disp("Toolbox Name:" + toolboxName);
2026

2127
identifier = "dc2cae2f-4f43-4d2c-b6ed-f1a59f0dfcdf";
2228
opts = matlab.addons.toolbox.ToolboxOptions(toolboxFolder, identifier);
@@ -33,6 +39,6 @@
3339

3440
opts.MinimumMatlabRelease = "R2022a";
3541

36-
opts.OutputFile = fullfile(outputFolder, "otel-matlab.mltbx");
42+
opts.OutputFile = fullfile(outputFolder, toolboxName + ".mltbx");
3743
disp("Output File: " + opts.OutputFile);
3844
matlab.addons.toolbox.packageToolbox(opts);

0 commit comments

Comments
 (0)