Skip to content

Background spectral model #394

Background spectral model

Background spectral model #394

name: Unit tests
on:
push:
branches:
- main
paths:
- 'src/**'
- 'pyproject.toml'
pull_request:
paths:
- 'src/**'
- 'pyproject.toml'
permissions:
contents: read
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Build docker images
run: docker build . -t xspec-tests
- name: Test with pytest
if: "!contains(github.event.pull_request.changed_files, 'pyproject.toml') && !contains(github.event.push.changed_files, 'pyproject.toml')"
run: docker run -t -v ./:/shared xspec-tests pytest --cov jaxspec --cov-report xml:/shared/coverage.xml
- name: Test with pytest (no coverage)
if: contains(github.event.pull_request.changed_files, 'pyproject.toml') || contains(github.event.push.changed_files, 'pyproject.toml')
run: docker run -t -v ./:/shared xspec-tests pytest
upload-coverage:
runs-on: ubuntu-latest
needs: tests
if: github.event_name == 'push' && contains(github.event.head_commit.message, 'src/') || github.event_name == 'pull_request' && contains(github.event.pull_request.changed_files, 'src/')
steps:
- uses: actions/checkout@v4
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true