Capturing ALS work #142
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: Tests | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
lint: | |
# 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: Check code style | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
- name: Install dev dependencies | |
run: | | |
set -vxeuo pipefail | |
python -m pip install -r requirements-dev.txt | |
python -m pip list | |
- name: Run pre-commit | |
run: pre-commit run --all-files | |
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 pylon camera | |
needs: lint | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10"] | |
pylon-tarball-file: ["pylon_7_4_0_14900_linux_x86_64_debs.tar.gz"] | |
pylon-deb-file: ["pylon_7.4.0.14900-deb0_amd64.deb"] | |
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 PYLON_CAMEMU=2 | |
echo "PYLON_CAMEMU=${PYLON_CAMEMU}" >> $GITHUB_ENV | |
export PYLON_ROOT="/opt/pylon" | |
echo "PYLON_ROOT=${PYLON_ROOT}" >> $GITHUB_ENV | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
- name: Install Pylon .deb package | |
run: | | |
# For reference: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html. | |
set -vxeuo pipefail | |
wget --progress=dot:mega ${{ secrets.PYLON_DOWNLOAD_URL_BASE }}/${{ matrix.pylon-deb-file }} -O pylon.tar.gz | |
tar -xvf pylon.tar.gz | |
sudo dpkg -i ${{ matrix.pylon-tarball-file }} | |
- 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 -vxeuo pipefail | |
# Do not check for unbound variables (the '-u' flag) as it fails on | |
# conda deactivate command: | |
# /usr/share/miniconda3/envs/sirepo-bluesky-py3.9/etc/conda/deactivate.d/glib_deactivate.sh: | |
# line 1: GSETTINGS_SCHEMA_DIR_CONDA_BACKUP: unbound variable | |
set -vxeo pipefail | |
conda env list | |
mamba install -c conda-forge -y numpy matplotlib | |
pip install -v . | |
pip install -r requirements-dev.txt | |
pip list | |
conda list | |
- name: Test the code | |
run: | | |
set -vxuo pipefail | |
pytest -s -vv | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: test-artifacts | |
path: /tmp/test_emulated_basler_camera_exposure_ms*.png |