Skip to content

debug workflow at beamline for two topics #122

debug workflow at beamline for two topics

debug workflow at beamline for two topics #122

Workflow file for this run

name: Tests
on:
push:
pull_request:
workflow_dispatch:
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 IPython startup files
runs-on: ubuntu-latest
strategy:
matrix:
env-name: ["2023-2.1-py310", "2023-2.1-py310-tiled"]
fail-fast: false
env:
TZ: America/New_York
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 CONDA_PACKED_ENV="${{ matrix.env-name }}.tar.gz"
echo "CONDA_PACKED_ENV=${CONDA_PACKED_ENV}" >> $GITHUB_ENV
- name: Checkout the code
uses: actions/checkout@v3
- name: Config files
run: |
set -vxeuo pipefail
# Databroker v0/v1 config:
mkdir -v -p $HOME/.config/databroker/
cp -v configs/databroker/local.yml $HOME/.config/databroker/xpd-ldrd20-31.yml
# Tiled profile config:
tiled_profiles_dir="$HOME/.config/tiled/profiles"
mkdir -v -p ${tiled_profiles_dir}
cp -v configs/tiled/profiles.yml ${tiled_profiles_dir}/profiles.yml
# Bluesky-kafka config:
sudo mkdir -v -p /etc/bluesky/
sudo cp -v configs/kafka.yml /etc/bluesky/kafka.yml
- name: Start MongoDB
uses: supercharge/[email protected]
- name: Set up Python ${{ matrix.python-version }} with conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: ${{ env.REPOSITORY_NAME }}-${{ matrix.env-name }}
auto-update-conda: true
miniconda-version: "latest"
python-version: "3.10"
mamba-version: "*"
channels: conda-forge
- name: Cache conda pack file
uses: actions/cache@v3
with:
path: |
~/env/${{ env.CONDA_PACKED_ENV }}
key: ${{ env.CONDA_PACKED_ENV }}
- name: Conda env
run: |
set -vxeo pipefail
conda env list
mkdir -p ~/env/
cd ~/env/
if [ ! -f "${CONDA_PACKED_ENV}" ]; then
wget --progress=dot:giga "https://zenodo.org/record/8098505/files/${CONDA_PACKED_ENV}?download=1" -O "${CONDA_PACKED_ENV}"
fi
tar -xvf "${CONDA_PACKED_ENV}"
conda activate $PWD
conda-unpack
# pip install ...
pip list
conda list
- name: Test the code
run: |
set -vxeuo pipefail
conda activate ~/env
# This is what IPython does internally to load the startup files:
command="
import os
import glob
ip = get_ipython()
startup_files = sorted(glob.glob(os.path.join(os.getcwd(), 'startup/*.py')))
if os.path.isfile('.ci/drop-in.py'):
startup_files.append('.ci/drop-in.py')
if not startup_files:
raise SystemExit(f'Cannot find any startup files in {os.getcwd()}')
for f in startup_files:
if not os.path.isfile(f):
raise FileNotFoundError(f'File {f} cannot be found.')
print(f'Executing {f} in CI')
ip.parent._exec_file(f)"
ipython --profile=test -c "$command"