build #280
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, manual trigger, or schedule | |
# - test under at least 3 versions of python | |
# ----------------------------------------------------------------------------- | |
name: build | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 8 * * *" | |
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 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: test_env_python${{ matrix.python-version }} | |
python-version: ${{ matrix.python-version }} | |
auto-activate-base: false | |
- name: Install hdf5 libs | |
run: | | |
sudo apt-get install libhdf5-dev | |
- 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: Conda info | |
run: | | |
conda info | |
conda list | |
echo branch_name = ${branch_name} | |
- name: check for upstream vivarium | |
run: | | |
if git ls-remote --exit-code --heads https://github.com/ihmeuw/vivarium.git ${branch_name} == "0"; then | |
echo "upstream_vivarium_exist=true" >> $GITHUB_ENV | |
else | |
echo "upstream_vivarium_exist=false" >> $GITHUB_ENV | |
fi | |
- name: check for upstream vivarium_public_health | |
run: | | |
if git ls-remote --exit-code --heads https://github.com/ihmeuw/vivarium_public_health.git ${branch_name} == "0"; then | |
echo "upstream_vivarium_public_health_exist=true" >> $GITHUB_ENV | |
else | |
echo "upstream_vivarium_public_health_exist=false" >> $GITHUB_ENV | |
fi | |
- name: check for upstream gbd_mapping | |
run: | | |
if git ls-remote --exit-code --heads https://github.com/ihmeuw/gbd_mapping.git ${branch_name} == "0"; then | |
echo "upstream_gbd_mapping_exist=true" >> $GITHUB_ENV | |
else | |
echo "upstream_gbd_mapping_exist=false" >> $GITHUB_ENV | |
fi | |
- name: print environment values | |
run: | | |
cat $GITHUB_ENV | |
- name: Retrieve upstream vivarium | |
if: env.upstream_vivarium_exist == 'true' | |
run: | | |
echo "Cloning vivarium upstream branch: ${branch_name}" | |
git clone --branch=${branch_name} https://github.com/ihmeuw/vivarium.git | |
pushd vivarium | |
pip install . | |
popd | |
- name: Retrieve upstream vivarium_public_health | |
if: env.upstream_vivarium_public_health_exist == 'true' | |
run: | | |
echo "Cloning vivarium_public_health upstream branch: ${branch_name}" | |
git clone --branch=${branch_name} https://github.com/ihmeuw/vivarium_public_health.git | |
pushd vivarium_public_health | |
pip install . | |
popd | |
- name: Retrieve upstream gbd_mapping | |
if: env.upstream_gbd_mapping_exist == 'true' | |
run: | | |
echo "Cloning upstream gbd_mapping branch: ${branch_name}" | |
git clone --branch=${branch_name} https://github.com/ihmeuw/gbd_mapping.git | |
pushd gbd_mapping | |
pip install . | |
popd | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install .[docs,test] | |
- name: Lint | |
run: | | |
pip install black==22.3.0 isort | |
black . --check --diff | |
isort . --check --verbose --only-modified --diff | |
- name: Test | |
run: | | |
if github.event_name == 'schedule'; then | |
pytest --runslow ./tests | |
else | |
pytest ./tests | |
fi | |
- name: Doc build | |
run: | | |
make html -C docs/ SPHINXOPTS="-W --keep-going -n" | |
- name: Doctest | |
run: | | |
make doctest -C docs/ |