Skip to content

Commit

Permalink
Consolidate actions. (#509)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtilly committed Jan 3, 2022
1 parent f11a47f commit 551863a
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 108 deletions.
29 changes: 0 additions & 29 deletions .github/actions/daily_unittests/action.yml

This file was deleted.

17 changes: 16 additions & 1 deletion .github/actions/unittests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,26 @@ inputs:
python_version:
description: 'Python version'
required: true
pandas_version:
description: 'Pandas version'
required: false
numpy_version:
description: 'Numpy version'
required: false
scikit_version:
description: 'Scikit-learn version'
required: false
scipy_version:
description: 'Scipy version'
required: false
tabmat_version:
description: 'Tabmat version'
required: false
runs:
using: 'docker'
image: condaforge/mambaforge:latest
args:
- /bin/bash
- "-l"
- "-c"
- "./.github/workflows/test.sh ${{ inputs.python_version }}"
- "PYTHON_VERSION=${{ inputs.python_version }} PANDAS_VERSION=${{ inputs.pandas_version }} NUMPY_VERSION=${{ inputs.numpy_version }} SCIKIT_VERSION=${{ inputs.scikit_version }} SCIPY_VERSION=${{ inputs.scipy_version }} TABMAT_VERSION=${{ inputs.tabmat_version }} ./.github/workflows/test.sh"
2 changes: 1 addition & 1 deletion .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
with:
ref: ${{ github.head_ref }}
- name: Run CI inside of container
uses: ./.github/actions/daily_unittests
uses: ./.github/actions/unittests
with:
python_version: ${{ matrix.PYTHON_VERSION }}
pandas_version: ${{ matrix.PANDAS_VERSION }}
Expand Down
57 changes: 54 additions & 3 deletions .github/workflows/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,64 @@
set -exo pipefail

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
source ${SCRIPT_DIR}/base.sh $*
source ${SCRIPT_DIR}/base.sh "$PYTHON_VERSION"

mamba install -y yq
yq -Y ". + {dependencies: [.dependencies[], \"python=${PYTHON_VERSION}\"] }" environment.yml > /tmp/environment.yml

cat environment.yml > /tmp/environment.yml

# pin version of some libraries, if specified
LIBRARIES=("python" "pandas" "numpy" "scikit" "scipy" "tabmat")
for library in "${LIBRARIES[@]}"; do
varname="${library^^}_VERSION"
version=${!varname}
if [[ -n "$version" && "$version" != "nightly" ]]; then
if [[ "${library}" == "scikit" ]]; then
library="scikit-learn"
fi
yq -Y --in-place ". + {dependencies: [.dependencies[], \"${library}=${version}\"]}" /tmp/environment.yml
fi
done

cat /tmp/environment.yml

mamba env create -f /tmp/environment.yml
mamba env update -n $(yq -r .name environment.yml) --file environment-benchmark.yml
conda activate $(yq -r .name environment.yml)

# This needs to be done before any 'uninstall --force'
if [[ "$TABMAT_VERSION" == "nightly" ]]; then
echo "Install compilation dependencies"
mamba install -y c-compiler cxx-compiler cython jemalloc-local libgomp mako xsimd
fi

PRE_WHEELS="https://pypi.anaconda.org/scipy-wheels-nightly/simple"
if [[ "$NUMPY_VERSION" == "nightly" ]]; then
echo "Installing Numpy nightly"
conda uninstall -y --force numpy
pip install --pre --no-deps --upgrade --timeout=60 -i $PRE_WHEELS numpy
fi
if [[ "$PANDAS_VERSION" == "nightly" ]]; then
echo "Installing Pandas nightly"
conda uninstall -y --force pandas
pip install --pre --no-deps --upgrade --timeout=60 -i $PRE_WHEELS pandas
fi
if [[ "$SCIKIT_VERSION" == "nightly" ]]; then
echo "Install scikit-learn nightly"
conda uninstall -y --force scikit-learn
pip install --pre --no-deps --upgrade --timeout=60 -i $PRE_WHEELS scikit-learn
fi
if [[ "$SCIPY_VERSION" == "nightly" ]]; then
echo "Installing Scipy nightly"
conda uninstall -y --force scipy
pip install --pre --no-deps --upgrade --timeout=60 -i $PRE_WHEELS scipy
fi
if [[ "$TABMAT_VERSION" == "nightly" ]]; then
echo "Install tabmat nightly"
conda uninstall -y --force tabmat
pip install git+https://github.com/Quantco/tabmat
fi

pip install --no-use-pep517 --no-deps --disable-pip-version-check -e .
pytest -nauto tests --doctest-modules src/

Expand All @@ -19,4 +70,4 @@ pytest -nauto tests --doctest-modules src/
mkdir ../temp
cp README.md ../temp
cd ../temp
python -m doctest -v README.md
python -m doctest -v README.md
74 changes: 0 additions & 74 deletions .github/workflows/test_daily.sh

This file was deleted.

0 comments on commit 551863a

Please sign in to comment.