Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

[ci] move CI logic into shell scripts (fixes #114) #225

Merged
merged 11 commits into from
Nov 3, 2022
43 changes: 43 additions & 0 deletions .ci/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

set -e -u -o pipefail

OPERATING_SYSTEM=$(uname -s)

if [[ ${OPERATING_SYSTEM} == "Linux" ]]; then
sudo apt-get update -y
sudo apt-get install \
--no-install-recommends \
--yes \
graphviz
fi

# setting up a virtualenv isn't necessary for the "pre-commit" task
if [[ ${TASK} != "pre-commit" ]]; then
mkdir -p "${HOME}/venvs/hamilton-venv"
python -m venv "${HOME}/venvs/hamilton-venv"
source "${HOME}/venvs/hamilton-venv/bin/activate"
pip install \
-r requirements-test.txt
fi

if [[ ${TASK} == "async" ]]; then
pip install \
-r graph_adapter_tests/h_async/requirements-test.txt
fi

if [[ ${TASK} == "pyspark" ]]; then
if [[ ${OPERATING_SYSTEM} == "Linux" ]]; then
sudo apt-get install \
--no-install-recommends \
--yes \
default-jre
fi
fi

echo "----- python version -----"
python --version

echo "----- pip version -----"
pip --version
echo "-----------------------"
56 changes: 56 additions & 0 deletions .ci/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

set -e -u -o pipefail

echo "running CI task '${TASK}'"

if [[ ${TASK} == "pre-commit" ]]; then
pip install pre-commit
pre-commit run --all-files
exit 0
fi

echo "using venv at '${HOME}/venvs/hamilton-venv/bin/activate'"
source "${HOME}/venvs/hamilton-venv/bin/activate"

if [[ ${TASK} == "async" ]]; then
pip install .
pytest graph_adapter_tests/h_async
exit 0
fi

if [[ ${TASK} == "dask" ]]; then
pip install -e '.[dask]'
pytest graph_adapter_tests/h_dask
exit 0
fi

if [[ ${TASK} == "integrations" ]]; then
pip install -e '.[pandera]'
pytest tests/integrations
exit 0
fi

if [[ ${TASK} == "ray" ]]; then
pip install -e '.[ray]'
pytest graph_adapter_tests/h_ray
exit 0
fi

if [[ ${TASK} == "pyspark" ]]; then
pip install -e '.[pyspark]'
pytest graph_adapter_tests/h_spark
exit 0
fi

if [[ ${TASK} == "tests" ]]; then
pip install .
pytest \
--cov=hamilton \
--ignore tests/integrations \
tests/
exit 0
fi

echo "ERROR: did not recognize TASK '${TASK}'"
exit 1
Loading