Skip to content

Phase1 testing infrastructure #177

Phase1 testing infrastructure

Phase1 testing infrastructure #177

Workflow file for this run

name: tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
tests:
name: 'py${{ matrix.python-version }} on ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04, macos-15-intel, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
exclude:
# macOS latest doesn't support Python 3.9 well on ARM
- os: macos-latest
python-version: "3.9"
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install VPLanet
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: |
python -m pip install --upgrade pip
python -m pip install git+https://$ACCESS_TOKEN@github.com/VirtualPlanetaryLaboratory/vplanet.git@main#egg=vplanet
- name: Install bigplanet
run: |
python -m pip install -e .
- name: Install test dependencies
run: |
python -m pip install pytest pytest-cov pytest-timeout
- name: Run diagnostic test
timeout-minutes: 3
run: |
# First run a simple unit test to verify pytest works
echo "Running single unit test as diagnostic..."
python -m pytest tests/unit/test_extract.py::TestBPLFile::test_bpl_file_archive -v -s
- name: Run tests
timeout-minutes: 20
run: |
# Run all tests with verbose output, capture disabled to see subprocess output, and per-test timeout
python -m pytest tests/ -v -s --timeout=300 --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml --cov=bigplanet --cov-report=xml --cov-report=term
- name: Upload coverage to Codecov
# Only upload from one runner to avoid redundant API calls
if: matrix.os == 'ubuntu-22.04' && matrix.python-version == '3.9'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: ${{ matrix.os }}-py${{ matrix.python-version }}
name: ${{ matrix.os }}-py${{ matrix.python-version }}
fail_ci_if_error: false
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always() && runner.os == 'Linux'
with:
files: junit/test-*.xml
check_name: Test Results (py${{ matrix.python-version }} on ${{ matrix.os }})
- name: Publish test results (macOS)
uses: EnricoMi/publish-unit-test-result-action/composite@v2
if: always() && runner.os == 'macOS'
with:
files: junit/test-*.xml
check_name: Test Results (py${{ matrix.python-version }} on ${{ matrix.os }})