Skip to content

Commit b0b650a

Browse files
committed
Build in a container on Linux to preserve compatibility with older Linux distributions when creating a release.
1 parent dfd352e commit b0b650a

File tree

2 files changed

+35
-19
lines changed

2 files changed

+35
-19
lines changed

.github/workflows/create_release.yml

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,27 @@ on:
55
- '[0-9]+.[0-9]+.[0-9]+'
66
jobs:
77
build-ubuntu:
8-
runs-on: ubuntu-22.04
8+
runs-on: ubuntu-latest
9+
container:
10+
image: ubuntu:20.04
911
env:
10-
OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install"
12+
OPENTELEMETRY_MATLAB_INSTALL_FOLDER: "otel_matlab_install" # not including the context github.workspace since it doesn't work inside a container due to a bug
1113
steps:
1214
- name: Download OpenTelemetry-Matlab source
1315
uses: actions/checkout@v3
1416
with:
1517
path: opentelemetry-matlab
16-
- name: Install ninja-build
17-
run: sudo apt-get install ninja-build
18+
- name: Install compiler and other tools
19+
env:
20+
DEBIAN_FRONTEND: "noninteractive"
21+
run: apt update && apt install -y build-essential git curl pkg-config zip python3 ninja-build
22+
- name: Install CMake
23+
env:
24+
MY_CMAKE_VERSION: 4.1.2
25+
run: |
26+
curl -LO https://github.com/Kitware/CMake/releases/download/v$MY_CMAKE_VERSION/cmake-$MY_CMAKE_VERSION-linux-x86_64.tar.gz
27+
tar -xvzf cmake-$MY_CMAKE_VERSION-linux-x86_64.tar.gz
28+
echo "$GITHUB_WORKSPACE/cmake-$MY_CMAKE_VERSION-linux-x86_64/bin" >> "$GITHUB_PATH"
1829
- name: Install MATLAB
1930
uses: matlab-actions/setup-matlab@v2
2031
with:
@@ -23,16 +34,15 @@ jobs:
2334
- name: Build OpenTelemetry-Matlab
2435
working-directory: opentelemetry-matlab
2536
run: |
26-
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_OTLP_GRPC=ON -DWITH_OTLP_FILE=ON -DOTEL_MATLAB_VERSION=${{ github.ref_name }} -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
37+
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_OTLP_GRPC=ON -DWITH_OTLP_FILE=ON -DOTEL_MATLAB_VERSION=${{ github.ref_name }} -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/$OPENTELEMETRY_MATLAB_INSTALL_FOLDER
2738
cmake --build build --config Release --target install
2839
- name: Compress into single artifact
29-
working-directory: ${{ github.workspace }}
3040
run: tar -czf otel-matlab-ubuntu.tar.gz otel_matlab_install
3141
- name: Upload artifacts
3242
uses: actions/upload-artifact@v4
3343
with:
3444
name: otel-matlab-ubuntu.tar.gz
35-
path: ${{ github.workspace }}/otel-matlab-ubuntu.tar.gz
45+
path: ./otel-matlab-ubuntu.tar.gz
3646
build-windows:
3747
runs-on: windows-latest
3848
env:
@@ -99,16 +109,27 @@ jobs:
99109
name: otel-matlab-${{ matrix.os }}.tar.gz
100110
path: ${{ github.workspace }}/otel-matlab-${{ matrix.os }}.tar.gz
101111
nogrpc-ubuntu: # without gRPC exporter
102-
runs-on: ubuntu-22.04
112+
runs-on: ubuntu-latest
113+
container:
114+
image: ubuntu:20.04
103115
env:
104-
OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install"
116+
OPENTELEMETRY_MATLAB_INSTALL_FOLDER: "otel_matlab_install" # not including the context github.workspace since it doesn't work inside a container due to a bug
105117
steps:
106118
- name: Download OpenTelemetry-Matlab source
107119
uses: actions/checkout@v3
108120
with:
109121
path: opentelemetry-matlab
110-
- name: Install ninja-build
111-
run: sudo apt-get install ninja-build
122+
- name: Install compiler and other tools
123+
env:
124+
DEBIAN_FRONTEND: "noninteractive"
125+
run: apt update && apt install -y build-essential git curl pkg-config zip python3 ninja-build
126+
- name: Install CMake
127+
env:
128+
MY_CMAKE_VERSION: 4.1.2
129+
run: |
130+
curl -LO https://github.com/Kitware/CMake/releases/download/v$MY_CMAKE_VERSION/cmake-$MY_CMAKE_VERSION-linux-x86_64.tar.gz
131+
tar -xvzf cmake-$MY_CMAKE_VERSION-linux-x86_64.tar.gz
132+
echo "$GITHUB_WORKSPACE/cmake-$MY_CMAKE_VERSION-linux-x86_64/bin" >> "$GITHUB_PATH"
112133
- name: Install MATLAB
113134
uses: matlab-actions/setup-matlab@v2
114135
with:
@@ -117,16 +138,15 @@ jobs:
117138
- name: Build OpenTelemetry-Matlab
118139
working-directory: opentelemetry-matlab
119140
run: |
120-
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_OTLP_GRPC=OFF -DWITH_OTLP_FILE=ON -DOTEL_MATLAB_VERSION=${{ github.ref_name }} -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
141+
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_OTLP_GRPC=OFF -DWITH_OTLP_FILE=ON -DOTEL_MATLAB_VERSION=${{ github.ref_name }} -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/$OPENTELEMETRY_MATLAB_INSTALL_FOLDER
121142
cmake --build build --config Release --target install
122143
- name: Compress into single artifact
123-
working-directory: ${{ github.workspace }}
124144
run: tar -czf otel-matlab-nogrpc-ubuntu.tar.gz otel_matlab_install
125145
- name: Upload artifacts
126146
uses: actions/upload-artifact@v4
127147
with:
128148
name: otel-matlab-nogrpc-ubuntu.tar.gz
129-
path: ${{ github.workspace }}/otel-matlab-nogrpc-ubuntu.tar.gz
149+
path: ./otel-matlab-nogrpc-ubuntu.tar.gz
130150
nogrpc-windows: # without gRPC exporter
131151
runs-on: windows-latest
132152
env:

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ MATLAB® interface to [OpenTelemetry™](https://opentelemetry.io/), base
66
### Status
77
1. Tracing, metrics, and logs are all fully supported and tested on Windows®, Linux®, and macOS.
88
2. On Linux, when running MATLAB R2025a or newer releases, the gRPC library used in the gRPC exporter in this package may conflict with the same library in MATLAB, causing MATLAB to crash. To avoid this issue, install otel-matlab-nogrpc.mltbx in [version 1.10.2](https://github.com/mathworks/OpenTelemetry-MATLAB/releases/tag/1.10.2), which excludes the gRPC exporter.
9-
3. If you are using [version 1.10.2](https://github.com/mathworks/OpenTelemetry-MATLAB/releases/tag/1.10.2) on Linux with MATLAB R2024a or older, you may run into an "Invalid MEX file" error due to an incompatible libstdc++ library. Define the environment variable LD_PRELOAD to point to the system libstdc++.so. For example, use the following command in a Bash shell on Ubuntu or Debian Linux.
10-
```
11-
export LD_PRELOAD="/lib/x86_64-linux-gnu/libstdc++.so.6"
12-
```
13-
4. OpenTelemetry currently does not support non-ASCII characters. Defining names or attributes with non-ASCII characters will cause the telemetry data to become invalid and fail to export.
9+
3. OpenTelemetry currently does not support non-ASCII characters. Defining names or attributes with non-ASCII characters will cause the telemetry data to become invalid and fail to export.
1410

1511
### MathWorks Products (https://www.mathworks.com)
1612

0 commit comments

Comments
 (0)