Skip to content

update CI

update CI #205

name: Test and deploy code
on: [push]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.8", "3.9", "3.10"]
defaults: # Needed for conda
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
with:
lfs: true
submodules: true
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
use-mamba: true
miniforge-variant: Mambaforge
channels: acellera,conda-forge,defaults
- name: Install HTMD conda deps # psfgen should not be included by default in HTMD due to licensing
run: |
mamba install --file package/htmd-deps/DEPENDENCIES python=${{ matrix.python-version }} -y
- name: Install pip dependencies
run: |
pip install flake8 pytest
pip install .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test
run: |
export HTMD_NONINTERACTIVE=1
pytest --verbose --durations=10 ./htmd/
deploy:
if: startsWith(github.event.ref, 'refs/tags/')
needs: test
runs-on: ${{ matrix.os }}
defaults: # Needed for conda
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- name: Set version envvar
run: echo "BUILD_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Check version envvar
run: echo "Building version $BUILD_VERSION"
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: writedeps
auto-update-conda: true
python-version: ${{ matrix.python-version }}
uses-mamba: true
miniforge-variant: Mambaforge
channels: acellera,conda-forge,defaults
- name: Dump exact dependencies yaml file
run: |
mamba install --file package/htmd-deps/DEPENDENCIES python=${{ matrix.python-version }} -y
python package/htmd-deps/write_meta_yaml.py package/htmd-deps
- uses: conda-incubator/setup-miniconda@v2
with:
auto-activate-base: true
activate-environment: build
python-version: ${{ matrix.python-version }}
uses-mamba: true
miniforge-variant: Mambaforge
- name: Build htmd-deps conda package
run: |
echo "Building version $BUILD_VERSION"
mamba install anaconda-client conda-build python=${{ matrix.python-version }} boa
conda mambabuild --python ${{ matrix.python-version }} package/htmd-deps --output-folder ./pkg/ --no-include-recipe --no-anaconda-upload -c acellera -c conda-forge
- name: Build htmd conda package
run: |
echo "Building version $BUILD_VERSION"
conda mambabuild --python ${{ matrix.python-version }} package/htmd --output-folder ./pkg/ --no-include-recipe --no-anaconda-upload -c acellera -c conda-forge
- name: Upload to conda
run: |
anaconda -t ${{ secrets.ANACONDA_TOKEN_BASIC }} upload -u acellera ./pkg/*/htmd-*.tar.bz2