Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 129 additions & 0 deletions .github/workflows/build-oneagent-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
name: Build oneagent-sdk wheels (riscv64)

on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/oneagent-sdk.yaml not released yet'
required: false
default: ''
pull_request:
branches: [main]
paths:
- '.github/workflows/build-oneagent-sdk.yml'
- 'docs/packages/oneagent-sdk.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-oneagent-sdk.yml'
- 'docs/packages/oneagent-sdk.yaml'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read # to fetch code (actions/checkout)

env:
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64

jobs:
setup:
uses: $/.github/workflows/_setup.yml
with:
package: oneagent-sdk
version: ${{ inputs.version }}

build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
name: Build oneagent-sdk ${{ matrix.version }} py2.py3-none-linux_riscv64
runs-on: ubuntu-24.04-riscv

env:
ONEAGENT_SDK_VERSION: ${{ matrix.version }}

steps:
# The wheel version carries Dynatrace's internal BUILD_TIMESTAMP suffix
# (setup.py's get_version_from_version_py()); the git tag is just the
# base version, so both are derived from matrix.version here.
- id: ver
run: |
base="${ONEAGENT_SDK_VERSION%.*.*}"
timestamp="${ONEAGENT_SDK_VERSION#"$base".}"
echo "ref=v$base" >> "$GITHUB_OUTPUT"
echo "timestamp=${timestamp/./-}" >> "$GITHUB_OUTPUT"

- name: Checkout OneAgent-SDK-for-Python ${{ steps.ver.outputs.ref }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: Dynatrace/OneAgent-SDK-for-Python
ref: ${{ steps.ver.outputs.ref }}
persist-credentials: false

- name: Build wheel
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
with:
output-dir: wheelhouse/
# setup.py forces a universal (py2.py3) tag, so one build serves
# every interpreter.
only: cp312-manylinux_riscv64
env:
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
# DT_PYSDK_CSDK_PATH is intentionally left unset: it would point at
# Dynatrace's closed-source OneAgent SDK for C/C++, which has no
# riscv64 build. setup.py degrades gracefully without it, shipping
# a wheel with no native library; oneagent.initialize() then
# returns STATUS_STUB_LOAD_ERROR instead of crashing (its own
# documented no-op mode).
CIBW_ENVIRONMENT: BUILD_TIMESTAMP=${{ steps.ver.outputs.timestamp }}
# There is no compiled extension to repair (no .so is bundled);
# auditwheel refuses a wheel with no ELF content at all.
CIBW_REPAIR_WHEEL_COMMAND: ""
CIBW_TEST_REQUIRES: pytest mock
CIBW_TEST_COMMAND: >-
python -c "import oneagent; r = oneagent.initialize(); assert r.status
== r.STATUS_STUB_LOAD_ERROR, r.status; oneagent.shutdown()" &&
PYTHONPATH={project}/test-util-src:{project}/samples/basic-sdk-sample
python -m pytest {project}/test -p testconfig -m "not dependsnative"

- name: Check wheel contents
run: |
python3 - wheelhouse/*.whl <<'EOF'
import sys, zipfile
path = sys.argv[1]
names = zipfile.ZipFile(path).namelist()
assert not any(n.endswith(".so") for n in names), names
assert "oneagent/_impl/native/sdknulliface.py" in names, names
EOF

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: oneagent-sdk-${{ env.ONEAGENT_SDK_VERSION }}-py2.py3-none-linux_riscv64
path: wheelhouse/*.whl
if-no-files-found: error

publish:
name: Publish oneagent-sdk ${{ matrix.version }}
needs: [setup, build_wheels]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
permissions:
contents: write
pull-requests: write
uses: $/.github/workflows/_publish-wheel.yml
secrets:
app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }}
with:
artifact-pattern: oneagent-sdk-${{ matrix.version }}-*-linux_riscv64
5 changes: 5 additions & 0 deletions docs/packages/oneagent-sdk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package-name: oneagent-sdk
source-code: https://github.com/Dynatrace/OneAgent-SDK-for-Python
license: Apache License 2.0
versions:
- version: 1.5.2.20260107.153442
Loading