Skip to content

Initial repository setup #1

Initial repository setup

Initial repository setup #1

Workflow file for this run

# -----------------------------------------------------------------------------
# - invoked on push, pull_request, or manual trigger
# - test under all supported versions of Python (python_versions.json)
# -----------------------------------------------------------------------------
name: build
on: [push, pull_request, workflow_dispatch]
jobs:
get-python-versions:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install jq
run: sudo apt-get install jq
- name: Get Python versions
id: set-matrix
run: |
echo "MATRIX_RESULT=$(jq -c . python_versions.json)" >> $GITHUB_ENV
outputs:
matrix: ${{ env.MATRIX_RESULT }}
build:
needs: get-python-versions
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ${{ fromJSON(needs.get-python-versions.outputs.matrix) }}
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
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 vivarium
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: 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_exist=true" >> $GITHUB_ENV
else
echo "upstream_exist=false" >> $GITHUB_ENV
fi
- name: check for upstream vivarium_inputs
run: |
if git ls-remote --exit-code --heads https://github.com/ihmeuw/vivarium_inputs.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 vivarium
if: env.upstream_vivarium_exist == 'true'
run: |
echo "Cloning vivarium upstream branch: ${GITHUB_HEAD_REF}"
pushd ..
git clone --branch=${GITHUB_HEAD_REF} https://github.com/ihmeuw/vivarium.git
pushd vivarium
pip install .
popd && popd
- name: Retrieve upstream vivarium_public_health
if: env.upstream_vivarium_public_health_exist == 'true'
run: |
echo "Cloning vivarium_public_health upstream branch: ${GITHUB_HEAD_REF}"
pushd ..
git clone --branch=${GITHUB_HEAD_REF} https://github.com/ihmeuw/vivarium_public_health.git
pushd vivarium_public_health
pip install .
popd && popd
- name: Retrieve upstream vivarium_inputs
if: env.upstream_vivarium_inputs_exist == 'true'
run: |
echo "Cloning upstream vivarium_inputs branch: ${GITHUB_HEAD_REF}"
pushd ..
git clone --branch=${GITHUB_HEAD_REF} https://github.com/ihmeuw/vivarium_inputs.git
pushd vivarium_inputs
pip install .
popd && popd
- name: Install dependencies
run: |
pip install .[test]
- name: Lint
run: |
pip install black==22.3.0 isort
isort . --check -v
black . --check -v
- name: Test
run: |
pytest ./tests