Files
2026-07-13 13:05:14 +08:00

197 lines
6.7 KiB
YAML

name: Reusable Test Wheels
on:
workflow_call:
inputs:
CONCURRENCY:
required: true
type: string
PLATFORM:
required: true
type: string
WHEEL_ARTIFACT_NAME:
required: false
type: string
default: ""
RELEASE_COMMIT:
required: false
type: string
default: ""
FAST:
required: false
type: boolean
default: false
concurrency:
group: ${{ inputs.CONCURRENCY }}-test-wheels
cancel-in-progress: true
env:
PYTHON_VERSION: "3.10"
RUSTFLAGS: --deny warnings
RUSTDOCFLAGS: --deny warnings
RUST_BACKTRACE: "1"
defaults:
run:
shell: bash --noprofile --norc -euo pipefail {0}
permissions:
contents: "read"
packages: "read"
id-token: "write"
jobs:
# ---------------------------------------------------------------------------
set-config:
name: Set Config (${{ inputs.PLATFORM }})
runs-on: ubuntu-latest-16-cores
outputs:
RUNNER: ${{ steps.set-config.outputs.runner }}
TARGET: ${{ steps.set-config.outputs.target }}
CONTAINER: ${{ steps.set-config.outputs.container }}
steps:
- name: Login to GHCR (with retries)
uses: nick-fields/retry@v3
with:
timeout_seconds: 10
max_attempts: 12
retry_on: timeout
warning_on_retry: true
command: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Set runner and target based on platform
id: set-config
# TODO(#5525): at least this target is broken, maybe others — we currently only use linux-x64 and windows-x64
run: |
case "${{ inputs.PLATFORM }}" in
linux-arm64)
runner="ubuntu-arm-16-core"
target="aarch64-unknown-linux-gnu"
container="'ghcr.io/rerun-io/ci_docker:0.18.0'"
;;
linux-x64)
runner="ubuntu-latest-16-cores"
target="x86_64-unknown-linux-gnu"
container="'ghcr.io/rerun-io/ci_docker:0.18.0'"
;;
windows-x64)
runner="windows-latest-16-cores"
target="x86_64-pc-windows-msvc"
container="null"
;;
macos-arm64)
runner="macos-26-xlarge" # This is an Arm vm, https://docs.github.com/en/actions/using-github-hosted-runners/about-larger-runners/about-larger-runners#about-macos-larger-runners
target="aarch64-apple-darwin"
container="null"
;;
*) echo "Invalid platform" && exit 1 ;;
esac
echo "runner=$runner" >> "$GITHUB_OUTPUT"
echo "target=$target" >> "$GITHUB_OUTPUT"
echo "container=$container" >> "$GITHUB_OUTPUT"
# ---------------------------------------------------------------------------
test-wheels:
name: Test Wheels (${{ needs.set-config.outputs.RUNNER }})
timeout-minutes: 120
needs: [set-config]
runs-on: ${{ needs.set-config.outputs.RUNNER }}
container:
image: ${{ fromJson(needs.set-config.outputs.CONTAINER) }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Show context
run: |
echo "GITHUB_CONTEXT": $GITHUB_CONTEXT
echo "JOB_CONTEXT": $JOB_CONTEXT
echo "INPUTS_CONTEXT": $INPUTS_CONTEXT
echo "ENV_CONTEXT": $ENV_CONTEXT
env:
ENV_CONTEXT: ${{ toJson(env) }}
GITHUB_CONTEXT: ${{ toJson(github) }}
JOB_CONTEXT: ${{ toJson(job) }}
INPUTS_CONTEXT: ${{ toJson(inputs) }}
- uses: actions/checkout@v4
with:
ref: ${{ inputs.RELEASE_COMMIT || ((github.event_name == 'pull_request' && github.event.pull_request.head.ref) || '') }}
lfs: true
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache_key: "build-${{ inputs.PLATFORM }}"
# Cache will be produced by `reusable_checks/rs-lints`
save_cache: false
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
- uses: prefix-dev/setup-pixi@v0.10.0
with:
pixi-version: v0.71.3
- name: Download Wheel
uses: actions/download-artifact@v4
with:
name: ${{ inputs.WHEEL_ARTIFACT_NAME }}
path: wheel
- name: Get version
id: get-version
run: pixi run 'echo "wheel_version=$(python scripts/ci/crates.py get-version)"' >> "$GITHUB_OUTPUT"
- name: Install built wheel
run: |
pixi run python scripts/ci/uv_install_wheel.py --package rerun-sdk --dir wheel
- name: Print wheel version
run: |
pixi run uv pip show rerun-sdk
pixi run uvpy -m rerun --version
- name: Run unit tests (with linux arm64 opencv workaround)
if: ${{ inputs.PLATFORM == 'linux-arm64' }}
# Workaround for OpenCV TLS issue, see https://github.com/opencv/opencv/issues/14884#issuecomment-815632861
run: LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1 pixi run py-test-no-build
- name: Run unit tests
if: ${{ inputs.PLATFORM != 'linux-arm64' }}
run: pixi run py-test-no-build
- name: Run e2e test
run: RUST_LOG=debug pixi run uvpy scripts/run_python_e2e_test.py --no-build # rerun-sdk is already built and installed
- name: Check for release checklist
if: ${{ inputs.FAST }}
# Only check that the release checklist executes successfully
run: RUST_LOG=warn RERUN_STRICT=1 PYTHONWARNINGS=error pixi run uvpy tests/python/release_checklist/main.py --stdout > /dev/null
- name: Build C++ snippets
if: ${{ !inputs.FAST }}
# Separated out of compare_snippet_output.py run so we control the pixi environment.
# This used to cause issues on Windows during the setup of the pixi environment when running from inside `compare_snippet_output.py`.
run: pixi run cpp-build-snippets
- name: Run docs/snippets/compare_snippet_output.py
if: ${{ !inputs.FAST }}
# explicit target because otherwise cargo loses the target cache… even though this is the target anyhow…
# --no-py-build because rerun-sdk is already built and installed
run: RUST_LOG=debug pixi run uvpy docs/snippets/compare_snippet_output.py --target ${{ needs.set-config.outputs.TARGET }} --no-py-build --no-cpp-build
- name: Check the python library signatures
run: pixi run py-check-signatures
- name: Report disk usage
if: always() # Run this even if a previous step fails.
run: df -h