.github/workflows/dist.yml
# ---------------------------
#
# Prepare distributions of this project
# and run a basic build-and-test from the
# tarball to make sure that actually works.
#
# Note: we don't test this on Windows because
# ligo-segments doesn't install cleanly
# from the PyPI tarball, we would need
# to use conda.
#
# ---------------------------
name: Distribution
on:
push:
branches:
- main
- master
- release/**
pull_request:
branches:
- main
- master
- release/**
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tarball:
name: Build
runs-on: ubuntu-latest
steps:
- name: Get source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install build requirements
run: python -m pip install build
- name: Create distributions
run: python -m build . --sdist --wheel --outdir .
- uses: actions/upload-artifact@v3
with:
name: tarball
path: gwpy-*.tar.*
- uses: actions/upload-artifact@v3
with:
name: wheel
path: gwpy*.whl
# -- pip install test -----
pip-install:
name: Python ${{ matrix.python-version }} install from ${{ matrix.artifact }} (${{ matrix.os }})
needs:
- tarball
strategy:
fail-fast: false
matrix:
artifact:
- tarball
- wheel
os:
- macOS
- Ubuntu
- Windows
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
runs-on: ${{ matrix.os }}-latest
defaults:
run:
shell: bash -e {0}
steps:
- name: Download ${{ matrix.artifact }}
uses: actions/download-artifact@v3
with:
name: ${{ matrix.artifact }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install GWpy with test extras
run: |
# extras don't work with wildcards
DIST=$(ls gwpy-*.*)
python -m pip install ${DIST}[test]
- name: Package list
run: python -m pip list installed
- name: Run test suite
run: |
python -m pytest \
-ra \
--color yes \
--cov gwpy \
--cov-report=xml \
--disable-socket \
--allow-hosts=127.0.0.1 \
--junitxml=pytest.xml \
--pyargs gwpy \
;
- name: Coverage report
run: python -m coverage report --show-missing
- name: Publish coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: coverage.xml
flags: ${{ runner.os }},python${{ matrix.python-version }}
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: pytest-${{ matrix.artifact }}-${{ matrix.os }}-${{ matrix.python-version }}
path: pytest.xml