Skip to content

fixed CLI duplicate bug (#449) #952

fixed CLI duplicate bug (#449)

fixed CLI duplicate bug (#449) #952

# This workflow will install Python dependencies, run tests and report code coverage with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Unit test and code coverage
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
strategy:
max-parallel: 4
matrix:
os: ['macos-latest','ubuntu-latest']
python-version: ['3.13', '3.14']
runs-on: ${{ matrix.os }}
# Fail a wedged leg fast instead of running to the 6-hour default. The unit
# suite is ~5-6 min warm (~12 min on a cold cache); a leg far exceeding this
# is the recurring flaky-download hang (issue #388), which escapes
# pytest-timeout when it happens in a spawned worker. Capping keeps reruns
# cheap instead of burning ~2 hours per hang.
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
- name: Set up - ${{ matrix.os }} - Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
# `layup bootstrap` and the observatory tests download the SPICE kernels
# and the MPC obscodes into pooch's os_cache ("layup"). Without a cache
# every leg of every run re-fetches these from naif.jpl.nasa.gov and
# minorplanetcenter.net, so a transient outage of either server fails the
# run (this has repeatedly taken down the ubuntu legs). Cache that data so
# it is fetched once per key and restored on subsequent runs. The data is
# Python-version independent, so the key is per-OS only -- the 3.13 and
# 3.14 legs share one cache. Bump the version suffix to force a refresh.
- name: Cache layup ephemeris + obscodes data
uses: actions/cache@v6
with:
path: |
~/.cache/layup
~/Library/Caches/layup
key: layup-data-${{ runner.os }}-v1
- name: Install dependencies
run: |
python -m pip install --upgrade pip
git submodule update --init
pip install -e .
pip install -e .[dev]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
layup bootstrap
- name: Run unit tests with pytest
run: |
# -rs prints a summary of skipped tests and their reasons, so silently
# skipped suites (e.g. ephem-gated fit/validation tests) are visible in
# the CI log (issue #359).
python -m pytest -n auto -rs --cov=layup --cov-report=xml
- name: Upload coverage report to codecov
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}