Update deploy.yml #23
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
# ----------------------------------------------------------------------------- | |
# - invoked on push, pull_request, or manual trigger | |
# - test under at least 3 versions of python | |
# - look for an upstream (vivarium) branch and use it if it exists | |
# ----------------------------------------------------------------------------- | |
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: check for upstream branch | |
run: | | |
if git ls-remote --exit-code --heads https://github.com/ihmeuw/vivarium.git ${GITHUB_HEAD_REF} == "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: ${GITHUB_HEAD_REF}" | |
git clone --branch=${GITHUB_HEAD_REF} https://github.com/ihmeuw/vivarium.git | |
pushd vivarium | |
pip install . | |
popd | |
- name: Install dependencies | |
run: | | |
pip install .[dev] | |
- 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/ | |
- name: Lint | |
run: | | |
pip install black==22.3.0 isort | |
black . --check --diff | |
isort . --check --verbose --only-modified --diff |