chore(ci): ship PGO wheels #1380
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Test code base and upload coverage | |
name: Test code | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
env: | |
QT_QPA_PLATFORM: offscreen | |
DISPLAY: :99 | |
MPLBACKEND: agg | |
jobs: | |
download-scenes: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
- name: Generate cache key | |
id: cache-key | |
run: | | |
echo "result=$(curl -s -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -H 'Accept: application/vnd.github.VERSION.sha' 'https://api.github.com/repos/NVlabs/sionna/commits/main')" >> $GITHUB_OUTPUT | |
- name: Cache scenes | |
id: cache-scenes | |
uses: actions/cache@v4 | |
with: | |
path: differt/src/differt/scene/scenes | |
key: ${{ steps.cache-key.outputs.result }}-scenes | |
- name: Download Sionna scenes | |
if: steps.cache-scenes.outputs.cache-hit != 'true' | |
run: uv run differt/src/differt/scene/_sionna.py | |
- name: List scenes | |
run: tree -L 2 differt/src/differt/scene/scenes | |
- name: Upload scenes | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sionna-scenes | |
path: differt/src/differt/scene/scenes | |
pytest: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
pyversion: ['3.10', '3.11', '3.12', '3.13'] | |
resolution: [highest, lowest-direct] | |
exclude: | |
- os: windows-latest | |
pyversion: '3.13' | |
runs-on: ${{ matrix.os }} | |
needs: [download-scenes] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
- name: Install Linux dependencies | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install freeglut3-dev xvfb | |
sudo apt-get install x11-utils | |
nohup Xvfb $DISPLAY -screen 0 1400x900x24 -dpi 96 +extension RANDR +render & | |
- name: Install Mesa (OpenGL on Windows) | |
if: matrix.os == 'windows-latest' | |
uses: ssciwr/setup-mesa-dist-win@v2 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Download scenes | |
uses: actions/download-artifact@v4 | |
with: | |
name: sionna-scenes | |
path: differt/src/differt/scene/scenes | |
- name: Run tests | |
run: uv run --python ${{ matrix.pyversion }} --resolution ${{ matrix.resolution }} --frozen --no-dev --group tests-extended pytest | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.DIFFERT_CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
cargo-test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
pyversion: ['3.10', '3.11', '3.12'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.pyversion }} | |
- name: Install NumPy | |
run: pip install numpy | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Run Cargo test | |
run: cargo test | |
cargo-tarpaulin: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
- name: Install NumPy | |
run: pip install numpy | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-tarpaulin@0.31.2 | |
- name: Generate code coverage | |
run: cargo tarpaulin --verbose --timeout 120 --out xml | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.DIFFERT_CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
python-benchmark: | |
runs-on: ubuntu-latest | |
needs: [download-scenes] | |
env: | |
PY_VERSION: 3.11 | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download scenes | |
uses: actions/download-artifact@v4 | |
with: | |
name: sionna-scenes | |
path: differt/src/differt/scene/scenes | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PY_VERSION }} | |
- name: Setup uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
id: rust-toolchain | |
with: | |
components: llvm-tools | |
- name: Cache Rust | |
uses: Swatinem/rust-cache@v2 | |
- name: Install dependencies for profiling | |
run: uv sync --group tests | |
- name: Build PGO wheel | |
id: pgo-wheel | |
uses: ./.github/actions/build-pgo-wheel | |
with: | |
interpreter: ${{ env.PY_VERSION }} | |
rust-toolchain: ${{ steps.rust-toolchain.outputs.name }} | |
- name: Install PGO wheel | |
run: uv pip install ${{ steps.pgo-wheel.outputs.wheel }} --force-reinstall | |
- name: Run CodSpeed benchmarks | |
uses: CodSpeedHQ/action@v3 | |
with: | |
run: uv run --group=codspeed pytest differt/tests/benchmarks --jaxtyping-packages="" --codspeed | |
rust-benchmark: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
- name: Install NumPy | |
run: pip install numpy | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Cache Rust | |
uses: Swatinem/rust-cache@v2 | |
- name: Run Benchmarks | |
run: cargo bench | |
linkcheck-docs: | |
runs-on: ubuntu-latest | |
needs: [download-scenes] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download scenes | |
uses: actions/download-artifact@v4 | |
with: | |
name: sionna-scenes | |
path: differt/src/differt/scene/scenes | |
- name: Setup uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
- name: Install Just | |
uses: taiki-e/install-action@just | |
- name: Install dependencies | |
run: just install --locked --no-dev --group docs | |
- name: Check links in documentation | |
run: just docs/linkcheck |