Skip to content

Mic-4180/update-readthedocs-yml #815

Mic-4180/update-readthedocs-yml

Mic-4180/update-readthedocs-yml #815

Workflow file for this run

# -----------------------------------------------------------------------------
# - invoked on push, pull_request, or manual trigger
# - test under at least 3 versions of python
# -----------------------------------------------------------------------------
name: build
on: [push, pull_request, workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
defaults:
run:
shell: bash -le {0}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: get upstream branch name
run: |
if "${{ github.event_name == 'pull_request' }}" ; then
echo "branch_name=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
else
echo "branch_name=${GITHUB_REF_NAME}" >> $GITHUB_ENV
fi
- name: check for upstream branch
run: |
if git ls-remote --exit-code --heads https://github.com/ihmeuw/vivarium.git ${branch_name} == "0"; then
echo "upstream_exist=true" >> $GITHUB_ENV
else
echo "upstream_exist=false" >> $GITHUB_ENV
fi
- name: print environment values
run: |
cat $GITHUB_ENV
- name: Update pip
run: |
python -m pip install --upgrade pip
- name: Retrieve upstream branch if exists
if: env.upstream_exist == 'true'
run: |
echo "Cloning upstream branch: ${branch_name}"
git clone --branch=${branch_name} https://github.com/ihmeuw/vivarium.git
pushd vivarium
pip install .
popd
- name: Install dependencies
run: |
pip install .[dev]
- name: Lint
run: |
pip install black==22.3.0 isort
black . --check --diff
isort . --check --verbose --only-modified --diff
- name: Test
run: |
pytest ./tests
- name: Doc build
run: |
make html -C docs/ SPHINXOPTS="-W --keep-going -n"
- name: Doctest
run: |
make doctest -C docs/