Skip to content

MNT: declare dependency floors the package can actually run on #3459

MNT: declare dependency floors the package can actually run on

MNT: declare dependency floors the package can actually run on #3459

Workflow file for this run

name: Tests
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "**.py"
- ".github/**"
- "pyproject.toml"
- "requirements*"
defaults:
run:
shell: bash
jobs:
Pytest:
runs-on: ${{ matrix.os }}
strategy:
# One platform's result should not decide the other five. Added in #1084;
# kept explicit here so it does not get tidied away later.
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.14"]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
MPLBACKEND: Agg
steps:
- uses: actions/checkout@main
- name: Set up headless display
uses: pyvista/setup-headless-display-action@v4
- name: Configure Mesa software rendering on Linux
if: runner.os == 'Linux'
run: |
echo "LIBGL_ALWAYS_SOFTWARE=1" >> "$GITHUB_ENV"
echo "GALLIUM_DRIVER=llvmpipe" >> "$GITHUB_ENV"
- name: Set up Python
uses: actions/setup-python@main
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
requirements.txt
requirements-tests.txt
requirements-optional.txt
- name: Install rocketpy
run: pip install .
- name: Test importing rocketpy
run: python -c "import sys, rocketpy; print(f'{rocketpy.__name__} running on Python {sys.version}')"
- name: Install test dependencies
run: |
pip install -r requirements-tests.txt
pip install .[all]
- name: Run Unit Tests
run: pytest tests/unit --cov=rocketpy
- name: Run Documentation Tests
run: |
pip install numpy --upgrade
pytest rocketpy --doctest-modules --cov=rocketpy --cov-append
- name: Run Integration Tests
run: |
pytest tests/integration \
--deselect tests/integration/test_plots.py::test_flight_animations_run_off_screen \
--deselect tests/integration/test_plots.py::test_flight_animations_render_all_scene_options \
--deselect tests/integration/test_plots.py::test_flight_animation_export_gif \
--cov=rocketpy --cov-append
- name: Run VTK animation tests
run: |
tests=(
tests/integration/test_plots.py::test_flight_animations_run_off_screen
tests/integration/test_plots.py::test_flight_animations_render_all_scene_options
tests/integration/test_plots.py::test_flight_animation_export_gif
)
attempts=3
for attempt in $(seq 1 "$attempts"); do
if pytest "${tests[@]}" --cov=rocketpy --cov-append; then
exit 0
else
status=$?
fi
# 138 is SIGBUS on macOS, 135 is SIGBUS on Linux, 139 is SIGSEGV on
# both. The measured split on this test was eight SIGSEGV to two
# SIGBUS, so keying on 138 alone let the common case through.
if [[ ! "$status" =~ ^(135|138|139)$ || "$attempt" == "$attempts" ]]; then
exit "$status"
fi
done
- name: Run Acceptance Tests
run: pytest tests/acceptance --cov=rocketpy --cov-append --cov-report=xml
- name: Upload coverage to artifacts
uses: actions/upload-artifact@main
with:
name: coverage
path: coverage.xml
overwrite: true
if-no-files-found: error
CodecovUpload:
needs: Pytest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Download latest coverage report
uses: actions/download-artifact@main
- name: Upload to Codecov
uses: codecov/codecov-action@main
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: |
coverage.xml