Skip to content

Unit Tests

Unit Tests #186

Workflow file for this run

name: Unit Tests
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
group: [1, 2, 3]
fail-fast: false
env:
codecov_dry_run: true
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt install redis
# These packages are installed in the base environment but may be older
# versions. Explicitly upgrade them because they often create
# installation problems if out of date.
python -m pip install --upgrade pip setuptools numpy
mkdir ~/repos
pushd ~/repos
echo $PWD
git clone https://github.com/bluesky/bluesky-queueserver.git
pushd bluesky-queueserver
pip install .
popd
echo $PWD
git clone https://github.com/bluesky/bluesky-httpserver.git
pushd bluesky-httpserver
pip install .
popd
echo $PWD
popd
echo $PWD
pip install .
pip install -r requirements-dev.txt
pip install bluesky==1.11.0
pip list
- name: Test with pytest
run: |
pytest --cov=./ --cov-report=xml --cov-report=term-missing -vv --splits 3 --group ${{ matrix.group }}
- name: Check if coverage data needs to be uploaded to Codecov
# if: github.repository_owner == 'bluesky' && github.ref == 'refs/heads/main' && matrix.python-version == 3.9
# Upload only for 'main' branch and given version of Python of the repository
if: github.ref == 'refs/heads/main' && matrix.python-version == 3.9
run: |
echo "codecov_dry_run=false" >> $GITHUB_ENV
echo "Enabling upload to Codecov ..."
- name: Print parameters
run: |
echo "github.repository_owner = ${{ github.repository_owner }}"
echo "github.ref = ${{ github.ref }}"
echo "matrix.python-version = ${{ matrix.python-version }}"
echo "env.codecov_dry_run = ${{ env.codecov_dry_run }}"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
fail_ci_if_error: true
# flags: unittests
verbose: true
dry_run: ${{ env.codecov_dry_run }}