Skip to content

Tiled & Databroker v2 support #1101

Tiled & Databroker v2 support

Tiled & Databroker v2 support #1101

Workflow file for this run

name: Tests
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '00 4 * * *' # daily at 4AM
jobs:
run_tests:
# pull requests are a duplicate of a branch push if within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
name: Test sirepo-bluesky with py${{ matrix.python-version }} and databroker ${{ matrix.databroker }} (${{ matrix.docker-binary }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
databroker: ["v1", "v2"]
docker-binary: ["docker"]
include:
- python-version: "3.10"
docker-binary: "podman"
databroker: "v1"
fail-fast: false
defaults:
run:
shell: bash -l {0}
steps:
- name: Set env vars
run: |
export REPOSITORY_NAME=${GITHUB_REPOSITORY#*/} # just the repo, as opposed to org/repo
echo "REPOSITORY_NAME=${REPOSITORY_NAME}" >> $GITHUB_ENV
export DOCKER_BINARY=${{ matrix.docker-binary }}
echo "DOCKER_BINARY=${DOCKER_BINARY}" >> $GITHUB_ENV
if [ "${{ matrix.databroker }}" == "v1" ]; then
EXTRA_INSTALL="databroker==1.2.5"
elif [ "${{ matrix.databroker }}" == "v2" ]; then
EXTRA_INSTALL="databroker[all]>=2.0.0b tiled[all]"
fi
export EXTRA_INSTALL
echo "EXTRA_INSTALL=${EXTRA_INSTALL}" >> $GITHUB_ENV
- name: Checkout the code
uses: actions/checkout@v4
- name: Start MongoDB
uses: supercharge/[email protected]
- name: Start Sirepo Docker container
uses: NSLS-II/start-sirepo-action@v2
with:
docker-binary: ${{ env.DOCKER_BINARY }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# - name: Set up Python ${{ matrix.python-version }} with conda
# uses: conda-incubator/setup-miniconda@v2
# with:
# activate-environment: ${{ env.REPOSITORY_NAME }}-py${{ matrix.python-version }}
# auto-update-conda: true
# miniconda-version: "latest"
# python-version: ${{ matrix.python-version }}
# mamba-version: "*"
# channels: conda-forge
- name: Install the package and its dependencies
run: |
set -vxeo pipefail
python -m pip install --upgrade pip wheel
python -m pip install -v . ${EXTRA_INSTALL}
python -m pip install -r requirements-dev.txt
python -m pip list
- name: Copy databroker config file
run: |
set -vxeuo pipefail
if [ "${{ matrix.databroker }}" == "v1" ]; then
mkdir -v -p ~/.config/databroker/
cp -v examples/local.yml ~/.config/databroker/
elif [ "${{ matrix.databroker }}" == "v2" ]; then
mkdir -v -p ~/.config/tiled/profiles/
cp -v examples/local-tiled.yml ~/.config/tiled/profiles/local.yml
fi
- name: Test with pytest
run: |
set -vxuo pipefail
pytest -s -vv
status=$?
${DOCKER_BINARY} ps -a
echo "::group::docker logs"
echo "Sirepo ${DOCKER_BINARY} container id: ${SIREPO_DOCKER_CONTAINER_ID}"
${DOCKER_BINARY} logs ${SIREPO_DOCKER_CONTAINER_ID}
echo "::endgroup::"
if [ $status -gt 0 ]; then
exit $status
fi