v1.1.1 #1225
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit Tests | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: # allow manual triggering | |
defaults: | |
run: | |
shell: bash -l {0} | |
jobs: | |
testing: | |
runs-on: ubuntu-latest | |
# needs: lint | |
strategy: | |
max-parallel: 5 | |
matrix: | |
python-version: | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create Python ${{ matrix.python-version }} environment | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
cache-environment: true | |
cache-environment-key: env-key-${{ matrix.python-version }} | |
condarc: | | |
channel-priority: flexible | |
environment-file: environment.yml | |
environment-name: hklpy-test-py-${{ matrix.python-version }} | |
create-args: >- | |
coveralls | |
pytest | |
pytest-cov | |
python=${{ matrix.python-version }} | |
- name: conda environments | |
shell: bash -l {0} | |
run: | | |
conda env list | |
micromamba env list | |
python --version | |
- name: Directories before Docker | |
run: ls -lAFghrt ~/ | |
- name: Start EPICS IOCs in Docker | |
run: | | |
set -vxeuo pipefail | |
bash ./.github/scripts/iocmgr.sh start ADSIM ad | |
bash ./.github/scripts/iocmgr.sh start GP gp | |
docker ps -a | |
ls -lAFgh /tmp/docker_ioc/iocad/ | |
ls -lAFgh /tmp/docker_ioc/iocgp/ | |
- name: Directories after Docker | |
run: ls -lAFghrt ~/ | |
- name: Confirm EPICS IOC is available via caget | |
shell: bash -l {0} | |
run: | | |
set -vxeuo pipefail | |
docker exec iocad /opt/base/bin/linux-x86_64/caget ad:cam1:Acquire_RBV | |
docker exec iocgp grep float1 /home/iocgp/dbl-all.txt | |
docker exec iocgp /opt/base/bin/linux-x86_64/caget gp:UPTIME gp:gp:float1 | |
which caget | |
caget ad:cam1:Acquire_RBV | |
caget gp:UPTIME | |
caget gp:gp:float1 | |
- name: Confirm EPICS IOC is available via PyEpics | |
shell: bash -l {0} | |
run: | | |
python -c "import epics; print(epics.caget('gp:UPTIME'))" | |
- name: Confirm EPICS IOC is available via ophyd | |
shell: bash -l {0} | |
run: | | |
CMD="import ophyd" | |
CMD+="; up = ophyd.EpicsSignalRO('gp:UPTIME', name='up')" | |
CMD+="; pv = ophyd.EpicsSignalRO('gp:gp:float1', name='pv')" | |
CMD+="; up.wait_for_connection()" | |
CMD+="; print(up.get(), pv.get())" | |
python -c "${CMD}" | |
- name: Install the hklpy package | |
shell: bash -l {0} | |
run: | | |
pip install -e . | |
- name: Diagnostics | |
shell: bash -l {0} | |
run: | | |
pwd | |
ls -lAFgh | |
conda list -r | |
conda list | |
micromamba list | |
- name: Test with coverage and pytest | |
shell: bash -l {0} | |
run: | | |
set -vxeuo pipefail | |
coverage run --concurrency=thread --parallel-mode -m pytest -vvv | |
coverage combine | |
coverage report |