GHA: test GIITHUB_ENV #17
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: Python package | |
on: [push] | |
defaults: | |
run: | |
shell: bash -l {0} | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
python: ["3.6", "3.12"] | |
# On windows, epics-base conda package only exports | |
# EPICS_BASE and EPICS_HOST_ARCH for cmd shell. | |
include: | |
- epics-host-arch: "windows-x64" | |
os: "windows-latest" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Conda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
python-version: ${{ matrix.python }} | |
activate-environment: test | |
- name: Install Conda packages | |
run: | | |
conda info | |
conda env list | |
conda install numpy pytest cffi | |
conda install -c paulscherrerinstitute epics-base | |
- name: Dump EPICS base env | |
if: runner.os == 'Windows' | |
shell: cmd | |
run: | | |
echo "EPICS_BASE=%EPICS_BASE%" >> "%GITHUB_ENV%" | |
echo "EPICS_HOST_ARCH=%EPICS_HOST_ARCH%" >> "%GITHUB_ENV%" | |
- name: Install pip packages | |
run: | | |
conda activate test | |
pip install -e . | |
pip install git+https://github.com/CaChannel/CaChannel.git | |
- name: Start EPICS IOC | |
run: | | |
if [[ -z "$EPICS_BASE" ]]; then | |
EPICS_BASE=$CONDA_PREFIX/epics | |
echo "set EPICS_BASE=$CONDA_PREFIX/epics" | |
fi | |
if [[ -z "$EPICS_HOST_ARCH" ]]; then | |
EPICS_HOST_ARCH=${{ matrix.epics-host-arch }} | |
echo "set EPICS_HOST_ARCH=${{ matrix.epics-host-arch }}" | |
fi | |
$EPICS_BASE/bin/$EPICS_HOST_ARCH/softIoc -S -D $EPICS_BASE/dbd/softIoc.dbd -d tests/test.db & | |
- name: Run tests | |
run: | | |
py.test tests/test_context.py | |
py.test tests/test_preemptive.py | |
py.test tests/test_thread.py | |
py.test tests/test_callbacks.py | |
py.test tests/test_put_types.py | |
py.test tests/test_get_dbrtypes.py | |
py.test tests/test_sg.py | |
python -m CaChannel.CaChannel | |
env: | |
CACHANNEL_BACKEND: caffi | |
- name: Stop EPICS IOC | |
run: killall softIoc |