|
| 1 | +name: "Publish mltbx" |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + release: |
| 5 | + types: published |
| 6 | +jobs: |
| 7 | + build-ubuntu: |
| 8 | + # Running on ubuntu-latest would use a glibc version that is incompatible when using the built mex files on a Debian 11 |
| 9 | + # Instead, run on ubuntu-20.04 |
| 10 | + runs-on: ubuntu-20.04 |
| 11 | + env: |
| 12 | + OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install" |
| 13 | + steps: |
| 14 | + - name: Download OpenTelemetry-Matlab source |
| 15 | + uses: actions/checkout@v3 |
| 16 | + with: |
| 17 | + path: opentelemetry-matlab |
| 18 | + - name: Install MATLAB |
| 19 | + uses: matlab-actions/setup-matlab@v2 |
| 20 | + with: |
| 21 | + products: MATLAB_Compiler |
| 22 | + - name: Build OpenTelemetry-Matlab |
| 23 | + run: | |
| 24 | + cd opentelemetry-matlab |
| 25 | + cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }} |
| 26 | + cmake --build build --config Release --target install |
| 27 | + - name: Compress into single artifact |
| 28 | + working-directory: ${{ github.workspace }} |
| 29 | + run: tar -czf otel-matlab-ubuntu.tar.gz otel_matlab_install |
| 30 | + - name: Upload artifacts |
| 31 | + uses: actions/upload-artifact@v2 |
| 32 | + with: |
| 33 | + name: otel-matlab-ubuntu.tar.gz |
| 34 | + path: ${{ github.workspace }}/otel-matlab-ubuntu.tar.gz |
| 35 | + build-windows: |
| 36 | + runs-on: windows-latest |
| 37 | + env: |
| 38 | + OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install" |
| 39 | + steps: |
| 40 | + - name: Download OpenTelemetry-Matlab source |
| 41 | + uses: actions/checkout@v3 |
| 42 | + with: |
| 43 | + path: opentelemetry-matlab |
| 44 | + - name: Install MATLAB |
| 45 | + uses: matlab-actions/setup-matlab@v2 |
| 46 | + with: |
| 47 | + products: MATLAB_Compiler |
| 48 | + - name: Build OpenTelemetry-Matlab |
| 49 | + run: | |
| 50 | + cd opentelemetry-matlab |
| 51 | + cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }} |
| 52 | + cmake --build build --config Release --target install |
| 53 | + - name: Compress into single artifact |
| 54 | + working-directory: ${{ github.workspace }} |
| 55 | + run: tar -czf otel-matlab-windows.tar.gz otel_matlab_install |
| 56 | + - name: Upload artifacts |
| 57 | + uses: actions/upload-artifact@v2 |
| 58 | + with: |
| 59 | + name: otel-matlab-windows.tar.gz |
| 60 | + path: ${{ github.workspace }}/otel-matlab-windows.tar.gz |
| 61 | + build-macos: |
| 62 | + runs-on: macos-latest |
| 63 | + env: |
| 64 | + OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install" |
| 65 | + steps: |
| 66 | + - name: Download OpenTelemetry-Matlab source |
| 67 | + uses: actions/checkout@v3 |
| 68 | + with: |
| 69 | + path: opentelemetry-matlab |
| 70 | + - name: Install MATLAB |
| 71 | + uses: matlab-actions/setup-matlab@v2 |
| 72 | + with: |
| 73 | + products: MATLAB_Compiler |
| 74 | + - name: Build OpenTelemetry-Matlab |
| 75 | + run: | |
| 76 | + cd opentelemetry-matlab |
| 77 | + cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }} |
| 78 | + cmake --build build --config Release --target install |
| 79 | + - name: Compress into single artifact |
| 80 | + working-directory: ${{ github.workspace }} |
| 81 | + run: tar -czf otel-matlab-macos.tar.gz otel_matlab_install |
| 82 | + - name: Upload artifacts |
| 83 | + uses: actions/upload-artifact@v2 |
| 84 | + with: |
| 85 | + name: otel-matlab-macos.tar.gz |
| 86 | + path: ${{ github.workspace }}/otel-matlab-macos.tar.gz |
| 87 | + package-mltbx: |
| 88 | + name: Package MATLAB Toolbox (MLTBX) Files |
| 89 | + runs-on: ubuntu-20.04 |
| 90 | + needs: |
| 91 | + - build-ubuntu |
| 92 | + - build-windows |
| 93 | + - build-macos |
| 94 | + env: |
| 95 | + OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install" |
| 96 | + steps: |
| 97 | + - name: Checkout OpenTelemetry-Matlab |
| 98 | + uses: actions/checkout@v3 |
| 99 | + with: |
| 100 | + path: OpenTelemetry-Matlab |
| 101 | + - name: Read version |
| 102 | + id: getversion |
| 103 | + working-directory: OpenTelemetry-Matlab |
| 104 | + run: echo "version=$(cat VERSION.txt)" >> $GITHUB_OUTPUT |
| 105 | + - name: Download Artifacts |
| 106 | + uses: actions/download-artifact@v3 |
| 107 | + with: |
| 108 | + path: artifacts-downloaded |
| 109 | + - name: Decompress Artifacts |
| 110 | + run: | |
| 111 | + mv artifacts-downloaded/*/*.tar.gz . |
| 112 | + tar -xzvf otel-matlab-ubuntu.tar.gz |
| 113 | + tar -xzvf otel-matlab-macos.tar.gz |
| 114 | + tar -xzvf otel-matlab-windows.tar.gz |
| 115 | + - name: Install MATLAB |
| 116 | + uses: matlab-actions/setup-matlab@v1 |
| 117 | + - name: Run commands |
| 118 | + env: |
| 119 | + MATLABPATH: OpenTelemetry-Matlab/tools |
| 120 | + OTEL_MATLAB_TOOLBOX_FOLDER: otel_matlab_install |
| 121 | + OTEL_MATLAB_TOOLBOX_OUTPUT_FOLDER: |
| 122 | + OTEL_MATLAB_TOOLBOX_VERSION: ${{ steps.getversion.outputs.version }} |
| 123 | + uses: matlab-actions/run-command@v1 |
| 124 | + with: |
| 125 | + command: packageMatlabInterface |
| 126 | + - name: Compress Asset |
| 127 | + run: zip otel-matlab-${{ github.event.release.tag_name }}.mltbx.zip otel-matlab.mltbx |
| 128 | + - name: Upload Release Asset |
| 129 | + uses: actions/upload-release-asset@v1 |
| 130 | + with: |
| 131 | + upload_url: https://uploads.github.com/repos/mathworks/OpenTelemetry-Matlab/releases/${{ github.event.release.id }}/assets{?name,label}` |
| 132 | + asset_path: ./otel-matlab-${{ github.event.release.tag_name }}.mltbx.zip |
| 133 | + asset_name: otel-matlab-${{ github.event.release.tag_name }}.mltbx.zip |
| 134 | + asset_content_type: application/zip |
0 commit comments