Skip to content

Instantly share code, notes, and snippets.

@berquist
Created January 2, 2022 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save berquist/a60e0c1c915d484ba04d86ab78a8b5b7 to your computer and use it in GitHub Desktop.
Save berquist/a60e0c1c915d484ba04d86ab78a8b5b7 to your computer and use it in GitHub Desktop.
---
# yamllint disable rule:line-length
name: CI
# yamllint disable-line rule:truthy
on:
push:
branches:
- "master"
pull_request:
branches:
- "master"
jobs:
test:
name: Test Python ${{ matrix.python-version }} / ${{ matrix.env-type.env-type-name }} / H5py ${{ matrix.h5py-version }}
runs-on: self-hosted
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
# yamllint disable rule:braces
env-type:
- { env-type-name: venv, shell: bash }
- { env-type-name: conda, shell: 'bash -l {0}' }
# yamllint enable rule:braces
h5py-version:
# - "2.10"
- "3"
defaults:
run:
shell: ${{ matrix.env-type.shell }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
if: ${{ matrix.env-type.env-type-name == 'venv' }}
- name: Set up Python ${{ matrix.python-version }} with conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test
auto-activate-base: false
auto-update-conda: true
# environment-file: devtools/conda-envs/test_env.yaml
miniforge-version: latest
python-version: ${{ matrix.python-version }}
show-channel-urls: true
if: ${{ matrix.env-type.env-type-name == 'conda' }}
# This needs to come after the possible conda install due to using `bash -l {0}`.
- name: Install HDF5 using system package manager
run: |
sudo apt-get update
sudo apt-get install -y libhdf5-103
- name: Update pip and setuptools
run: python -m pip install -U pip setuptools
- name: Print pip config
run: python -m pip config list
- name: Install test dependencies
run: python -m pip install pytest-cov
- name: Install package
run: |
python -m pip install .
PACKAGE_INSTALL_DIR=$(python -c 'import libstore as _; print(_.__path__[0])')
find $PACKAGE_INSTALL_DIR -type f | sort
- name: Install h5py for venv via pip
run: python -m pip install h5py==${{ matrix.h5py-version }}
if: ${{ matrix.env-type.env-type-name == 'venv' }}
- name: Install h5py for conda via conda
run: conda install h5py=${{ matrix.h5py-version }}
if: ${{ matrix.env-type.env-type-name == 'conda' }}
- name: Print Python environment
run: |
python -m pip list
- name: Print conda environment
run: conda list
if: ${{ matrix.env-type.env-type-name == 'conda' }}
- name: Print conda info
run: conda info
if: ${{ matrix.env-type.env-type-name == 'conda' }}
- name: Print conda config
run: conda config --show
if: ${{ matrix.env-type.env-type-name == 'conda' }}
- name: Run tests
run: |
PACKAGE_INSTALL_DIR=$(python -c 'import libstore as _; print(_.__path__[0])')
# Testing the installed package requires moving out of the source
# directory. There are problems with the pytest cache when trying
# to run from a non-writable dir.
cd ~
python -m pytest -v --cov=libstore --cov-report=xml ${PACKAGE_INSTALL_DIR}
# - name: CodeCov
# uses: codecov/codecov-action@v1
# with:
# file: ./coverage.xml
# flags: unittests
# name: codecov-py${{ matrix.python-version }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment