Files
bec_widgets/.github/workflows/pytest.yml
T

77 lines
2.1 KiB
YAML

name: Run Pytest with Coverage
on:
workflow_call:
inputs:
pr_number:
description: "Pull request number"
required: false
type: number
BEC_CORE_BRANCH:
description: "Branch of BEC Core to install"
required: false
default: "main"
type: string
OPHYD_DEVICES_BRANCH:
description: "Branch of Ophyd Devices to install"
required: false
default: "main"
type: string
BEC_WIDGETS_BRANCH:
description: "Branch of BEC Widgets to install"
required: false
default: "main"
type: string
secrets:
CODECOV_TOKEN:
required: true
permissions:
pull-requests: write
jobs:
pytest:
runs-on: ubuntu-latest
env:
QTWEBENGINE_DISABLE_SANDBOX: 1
QT_QPA_PLATFORM: "offscreen"
QTWEBENGINE_CHROMIUM_FLAGS: "--disable-gpu"
steps:
- name: Checkout BEC Widgets
uses: actions/checkout@v4
with:
repository: bec-project/bec_widgets
ref: ${{ inputs.BEC_WIDGETS_BRANCH }}
- name: Install BEC Widgets and dependencies
uses: ./.github/actions/bw_install
with:
BEC_WIDGETS_BRANCH: ${{ inputs.BEC_WIDGETS_BRANCH }}
BEC_CORE_BRANCH: ${{ inputs.BEC_CORE_BRANCH }}
OPHYD_DEVICES_BRANCH: ${{ inputs.OPHYD_DEVICES_BRANCH }}
PYTHON_VERSION: 3.11
- name: Run Pytest with Coverage
id: coverage
run: |
cd ./bec_widgets
coverage run --branch --source=./bec_widgets -m pytest --random-order --ignore=tests/unit_tests/benchmarks tests/unit_tests/
coverage report
coverage xml -o coverage-unit.xml
- name: Upload test artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: image-references
path: bec_widgets/tests/reference_failures/
if-no-files-found: ignore
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: bec-project/bec_widgets
files: ./bec_widgets/coverage-unit.xml