Move workflow #2
Workflow file for this run
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_utils | ||
on: | ||
workflow_call: | ||
inputs: | ||
dependencies: | ||
description: "String of comma-separated dependencies to check for upstream branches" | ||
required: true | ||
type: string | ||
skip_mypy: | ||
description: "Boolean to determine if mypy should be run" | ||
required: false | ||
default: true | ||
type: boolean | ||
install_type: | ||
description: "String of install type. Typically dev or test" | ||
required: false | ||
default: "dev" | ||
type: string | ||
jobs: | ||
build_template: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash -le {0} | ||
install dependencies: | ||
uses: ihmeuw/vivarium_build_utils/.github/workflows/install.yml@albrja/mic-5469/modularize-workflows | ||
with: | ||
dependencies: ${{ inputs.dependencies }} | ||
install_type: ${{ inputs.install_type }} | ||
steps: | ||
# - uses: actions/checkout@v3 | ||
# with: | ||
# fetch-depth: 0 | ||
# - 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: Update pip | ||
# run: | | ||
# python -m pip install --upgrade pip | ||
# - name: Install dependencies | ||
# run: | | ||
# echo "Install requirement is ${{ inputs.install_type }}" | ||
# pip install .[${{ inputs.install_type }}] | ||
# git checkout ${branch_name} | ||
# - name: Check for dependency branches and install if needed | ||
# run: | | ||
# git clone https://github.com/ihmeuw/vivarium_build_utils.git ../vivarium_build_utils | ||
# echo "----------------------------------------" | ||
# echo "Contents of install_dependency_branch.sh" | ||
# echo "----------------------------------------" | ||
# cat ../vivarium_build_utils/install_dependency_branch.sh | ||
# echo "" | ||
# echo "----------------------------------------" | ||
# for package in $(echo ${{ inputs.dependencies }} | sed "s/,/ /g"); do | ||
# sh ../vivarium_build_utils/install_dependency_branch.sh ${package} ${branch_name} github | ||
# done | ||
# - name: print environment values | ||
# run: | | ||
# cat $GITHUB_ENV | ||
- name: Lint | ||
run: | | ||
pip install black==22.3.0 isort | ||
isort . --check --verbose --only-modified --diff | ||
echo "----------------------------------------" | ||
black . --check --diff | ||
echo "----------------------------------------" | ||
if "${{ inputs.skip_mypy }}" == "false"; then | ||
mypy . | ||
fi | ||
- 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/ | ||
- name: Send mail | ||
# Notify when cron job fails | ||
if: (github.event_name == 'schedule' && failure()) | ||
uses: dawidd6/action-send-mail@v2 | ||
with: | ||
# mail server settings | ||
server_address: smtp.gmail.com | ||
server_port: 465 | ||
# user credentials | ||
username: ${{ secrets.NOTIFY_EMAIL }} | ||
password: ${{ secrets.NOTIFY_PASSWORD }} | ||
# email subject | ||
subject: ${{ github.job }} job of ${{ github.repository }} has ${{ job.status }} | ||
# email body as text | ||
body: ${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has ${{ job.status }} | ||
# comma-separated string, send email to | ||
to: [email protected] | ||
# from email name | ||
from: Vivarium Notifications |