Skip to content

Create add-to-project-ci.yml #273

Create add-to-project-ci.yml

Create add-to-project-ci.yml #273

Workflow file for this run

name: ci
on:
push:
branches:
- master
paths-ignore:
- 'conda-env-files/**'
pull_request:
branches:
- master
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: install dependencies
run: python -m pip install --upgrade pip
- name: lint
run: |
# Note: no q2lint here, since this isn't an official QIIME 2 product
pip install -q flake8
flake8
build-and-test:
needs: lint
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
# for versioneer
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- uses: qiime2/action-library-packaging@alpha1
with:
package-name: genome-sampler
additional-tests: pytest --pyargs genome_sampler
build-target: staging
library-token: ${{ secrets.LIBRARY_TOKEN }}
integrate:
needs: build-and-test
if: github.ref == 'refs/heads/master'
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: configure conda
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda config --set always_yes yes --set changeps1 no
sudo conda update -q conda
conda info -a
- name: set host helper env var
run: |
case "${{ matrix.os }}" in
'ubuntu-latest') echo 'QIIME2_PLATFORM=linux' >> $GITHUB_ENV ;;
'macos-latest') echo 'QIIME2_PLATFORM=osx' >> $GITHUB_ENV ;;
esac
- name: install QIIME 2 core distro
run: |
envFile=qiime2-latest-py36-$QIIME2_PLATFORM-conda.yml
wget https://raw.githubusercontent.com/qiime2/environment-files/master/latest/staging/$envFile
sudo conda env create -q -p ./genome-sampler-env --file $envFile
- name: install genome-sampler and snakemake
run: |
source "$CONDA/etc/profile.d/conda.sh"
sudo conda install -p ./genome-sampler-env -q \
-c https://packages.qiime2.org/qiime2/latest/tested/ \
-c conda-forge \
-c bioconda \
-c defaults \
--override-channels \
genome-sampler snakemake
- name: strip env
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate ./genome-sampler-env
python \
.github/workflows/bin/extract-env.py \
genome-sampler q2cli q2-feature-table q2-alignment q2-phylogeny snakemake \
--env-file conda-env-files/genome-sampler-py36-$QIIME2_PLATFORM-conda.yml
- name: cache env
uses: actions/upload-artifact@v2
with:
name: ${{ env.QIIME2_PLATFORM }}-conda-env
path: conda-env-files/genome-sampler-py36-${{ env.QIIME2_PLATFORM }}-conda.yml
commit-env-files:
needs: integrate
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: fetch envs
uses: actions/download-artifact@v2
with:
path: tmp-envs-dir
- name: merge results
run: |
mv tmp-envs-dir/linux-conda-env/* conda-env-files/
mv tmp-envs-dir/osx-conda-env/* conda-env-files/
- name: commit env files
run: |
git config --global user.name 'q2d2'
git config --global user.email '[email protected]'
git commit \
conda-env-files/genome-sampler-py36-linux-conda.yml \
conda-env-files/genome-sampler-py36-osx-conda.yml \
--allow-empty \
-m 'CI: updated envs'
git push
# TODO: refactor to use built-in runner conda
doc-build:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# TODO: any way to cache and extract the miniconda
# installation included in action-library-packaging?
- name: setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.6
- name: create conda testing env
run: conda create -q -y -p ./test-env
- name: install dependencies
run: |
conda install -p ./test-env -q -y \
-c conda-forge \
-c bioconda \
-c defaults \
--override-channels sphinx=2.4.4 pip
- name: install pip dependencies
shell: bash -l {0}
run: |
conda activate ./test-env
pip install -U "jupyter-book>=0.7.0b"
- name: build docs
run: conda run -p ./test-env jb build docs/
- name: save built doc
uses: actions/upload-artifact@v2
with:
name: docs
path: docs/_build/html
doc-publish:
needs: doc-build
runs-on: ubuntu-latest
# TODO: update the following when cutting a release
if: github.ref == 'refs/heads/some-release-branch'
steps:
- name: fetch built docs
uses: actions/download-artifact@v1
with:
name: docs
path: built-docs
- name: deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./built-docs