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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
name: ci-cover
on: # yamllint disable-line rule:truthy
workflow_call:
inputs:
py:
description: 'Python version'
required: false
default: 3
type: string
workflow_dispatch:
inputs:
py:
description: 'Python version'
required: true
default: 3
type: string
permissions:
contents: read
env:
MPI4PY_COVERAGE_PLUGIN: cycoverage
PYTHONPATH: ${{ github.workspace }}/conf
jobs:
cover:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
mpi:
- mpich
- openmpi
py:
- ${{ github.event.inputs.py || 3 }}
defaults:
run:
shell: bash -el {0}
steps:
- uses: step-security/harden-runner@v2
with:
egress-policy: audit
- uses: actions/checkout@v5
- uses: mamba-org/setup-micromamba@v2
with:
init-shell: bash
post-cleanup: none
environment-name: cover
create-args: >-
${{ matrix.mpi }}
${{ matrix.mpi }}-mpicc
python=${{ matrix.py }}
pip
setuptools
cython=3.0.12
coverage
numpy
condarc: |
show_channel_urls: true
channel_priority: strict
channels:
- conda-forge
- nodefaults
- run: python -m pip install .
env:
CFLAGS: -O0
CPPFLAGS: -O0 -Wp,-U_FORTIFY_SOURCE
PIP_VERBOSE: 3
PIP_NO_CACHE_DIR: true
PIP_NO_BUILD_ISOLATION: false # pypa/pip#5735
PIP_DISABLE_PIP_VERSION_CHECK: true
- name: Tweak MPI
run: |
openmpi_mca_params=$HOME/.openmpi/mca-params.conf
mkdir -p $(dirname $openmpi_mca_params)
echo plm_ssh_agent=false >> $openmpi_mca_params
echo pml=ob1 >> $openmpi_mca_params
echo btl=tcp,self >> $openmpi_mca_params
echo mpi_yield_when_idle=true >> $openmpi_mca_params
echo btl_base_warn_component_unused=false >> $openmpi_mca_params
prte_mca_params=$HOME/.prte/mca-params.conf
mkdir -p $(dirname $prte_mca_params)
echo rmaps_default_mapping_policy=:oversubscribe >> $prte_mca_params
- name: Run coverage
run: test/coverage.sh
- name: Prepare coverage data
run: mv .coverage .coverage.${TAG}
env:
TAG: ${{ runner.os }}.${{ matrix.mpi }}.py${{ matrix.py }}
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-data-${{ runner.os }}-${{ matrix.mpi }}-${{ matrix.py }}
path: ".coverage.*"
if-no-files-found: ignore
include-hidden-files: true
report:
runs-on: ubuntu-latest
needs: cover
if: always()
steps:
- uses: step-security/harden-runner@v2
with:
egress-policy: audit
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: ${{ github.event.inputs.py || 3 }}
cache: pip
cache-dependency-path: |
conf/requirements-build-cython.txt
- run: echo "cython == 3.0.12" > conf/requirements-build-cython.txt
- run: python -m pip install -U pip setuptools
- run: python -m pip install -U -r conf/requirements-build-cython.txt
- run: python -m pip install -U coverage
- run: python setup.py build_src
- name: Download coverage data
uses: actions/download-artifact@v5
with:
pattern: coverage-data-*
merge-multiple: true
- name: Report coverage
run: |
python -m coverage combine
python -m coverage html
python -m coverage xml
python -m coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
python -m coverage report --fail-under=100
- name: Upload HTML report
uses: actions/upload-artifact@v4
with:
name: coverage-html
path: htmlcov
if: failure()
|