-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (61 loc) · 2.63 KB
/
Copy pathtesting-and-coverage.yml
File metadata and controls
65 lines (61 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# 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@v7
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 }}