|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +--- |
| 4 | +name: Build oneagent-sdk wheels (riscv64) |
| 5 | + |
| 6 | +on: |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + version: |
| 10 | + description: 'Version glob to (re)build; empty builds every version of docs/packages/oneagent-sdk.yaml not released yet' |
| 11 | + required: false |
| 12 | + default: '' |
| 13 | + pull_request: |
| 14 | + branches: [main] |
| 15 | + paths: |
| 16 | + - '.github/workflows/build-oneagent-sdk.yml' |
| 17 | + - 'docs/packages/oneagent-sdk.yaml' |
| 18 | + push: |
| 19 | + branches: [main] |
| 20 | + paths: |
| 21 | + - '.github/workflows/build-oneagent-sdk.yml' |
| 22 | + - 'docs/packages/oneagent-sdk.yaml' |
| 23 | + |
| 24 | +concurrency: |
| 25 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 26 | + cancel-in-progress: true |
| 27 | + |
| 28 | +permissions: |
| 29 | + contents: read # to fetch code (actions/checkout) |
| 30 | + |
| 31 | +env: |
| 32 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 33 | + |
| 34 | +jobs: |
| 35 | + setup: |
| 36 | + uses: $/.github/workflows/_setup.yml |
| 37 | + with: |
| 38 | + package: oneagent-sdk |
| 39 | + version: ${{ inputs.version }} |
| 40 | + |
| 41 | + build_wheels: |
| 42 | + needs: [setup] |
| 43 | + if: needs.setup.outputs.versions != '[]' |
| 44 | + strategy: |
| 45 | + fail-fast: false |
| 46 | + matrix: |
| 47 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 48 | + name: Build oneagent-sdk ${{ matrix.version }} py2.py3-none-linux_riscv64 |
| 49 | + runs-on: ubuntu-24.04-riscv |
| 50 | + |
| 51 | + env: |
| 52 | + ONEAGENT_SDK_VERSION: ${{ matrix.version }} |
| 53 | + |
| 54 | + steps: |
| 55 | + # The wheel version carries Dynatrace's internal BUILD_TIMESTAMP suffix |
| 56 | + # (setup.py's get_version_from_version_py()); the git tag is just the |
| 57 | + # base version, so both are derived from matrix.version here. |
| 58 | + - id: ver |
| 59 | + run: | |
| 60 | + base="${ONEAGENT_SDK_VERSION%.*.*}" |
| 61 | + timestamp="${ONEAGENT_SDK_VERSION#"$base".}" |
| 62 | + echo "ref=v$base" >> "$GITHUB_OUTPUT" |
| 63 | + echo "timestamp=${timestamp/./-}" >> "$GITHUB_OUTPUT" |
| 64 | +
|
| 65 | + - name: Checkout OneAgent-SDK-for-Python ${{ steps.ver.outputs.ref }} |
| 66 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 67 | + with: |
| 68 | + repository: Dynatrace/OneAgent-SDK-for-Python |
| 69 | + ref: ${{ steps.ver.outputs.ref }} |
| 70 | + persist-credentials: false |
| 71 | + |
| 72 | + - name: Build wheel |
| 73 | + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 74 | + with: |
| 75 | + output-dir: wheelhouse/ |
| 76 | + # setup.py forces a universal (py2.py3) tag, so one build serves |
| 77 | + # every interpreter. |
| 78 | + only: cp312-manylinux_riscv64 |
| 79 | + env: |
| 80 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 81 | + # DT_PYSDK_CSDK_PATH is intentionally left unset: it would point at |
| 82 | + # Dynatrace's closed-source OneAgent SDK for C/C++, which has no |
| 83 | + # riscv64 build. setup.py degrades gracefully without it, shipping |
| 84 | + # a wheel with no native library; oneagent.initialize() then |
| 85 | + # returns STATUS_STUB_LOAD_ERROR instead of crashing (its own |
| 86 | + # documented no-op mode). |
| 87 | + CIBW_ENVIRONMENT: BUILD_TIMESTAMP=${{ steps.ver.outputs.timestamp }} |
| 88 | + # There is no compiled extension to repair (no .so is bundled); |
| 89 | + # auditwheel refuses a wheel with no ELF content at all. |
| 90 | + CIBW_REPAIR_WHEEL_COMMAND: "" |
| 91 | + CIBW_TEST_REQUIRES: pytest mock |
| 92 | + CIBW_TEST_COMMAND: >- |
| 93 | + python -c "import oneagent; r = oneagent.initialize(); assert r.status |
| 94 | + == r.STATUS_STUB_LOAD_ERROR, r.status; oneagent.shutdown()" && |
| 95 | + PYTHONPATH={project}/test-util-src:{project}/samples/basic-sdk-sample |
| 96 | + python -m pytest {project}/test -p testconfig -m "not dependsnative" |
| 97 | +
|
| 98 | + - name: Check wheel contents |
| 99 | + run: | |
| 100 | + python3 - wheelhouse/*.whl <<'EOF' |
| 101 | + import sys, zipfile |
| 102 | + path = sys.argv[1] |
| 103 | + names = zipfile.ZipFile(path).namelist() |
| 104 | + assert not any(n.endswith(".so") for n in names), names |
| 105 | + assert "oneagent/_impl/native/sdknulliface.py" in names, names |
| 106 | + EOF |
| 107 | +
|
| 108 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 109 | + with: |
| 110 | + name: oneagent-sdk-${{ env.ONEAGENT_SDK_VERSION }}-py2.py3-none-linux_riscv64 |
| 111 | + path: wheelhouse/*.whl |
| 112 | + if-no-files-found: error |
| 113 | + |
| 114 | + publish: |
| 115 | + name: Publish oneagent-sdk ${{ matrix.version }} |
| 116 | + needs: [setup, build_wheels] |
| 117 | + if: needs.setup.outputs.versions != '[]' |
| 118 | + strategy: |
| 119 | + fail-fast: false |
| 120 | + matrix: |
| 121 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 122 | + permissions: |
| 123 | + contents: write |
| 124 | + pull-requests: write |
| 125 | + uses: $/.github/workflows/_publish-wheel.yml |
| 126 | + secrets: |
| 127 | + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} |
| 128 | + with: |
| 129 | + artifact-pattern: oneagent-sdk-${{ matrix.version }}-*-linux_riscv64 |
0 commit comments