-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
96a2be5
commit fd38196
Showing
7 changed files
with
192 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Run image | ||
description: Run private container from GitHub Packages Registry after Docker login | ||
inputs: | ||
python_version: | ||
description: 'Python version' | ||
required: true | ||
pandas_version: | ||
description: 'Pandas version' | ||
required: true | ||
numpy_version: | ||
description: 'Numpy version' | ||
required: true | ||
scikit_version: | ||
description: 'Scikit-learn version' | ||
required: true | ||
scipy_version: | ||
description: 'Scipy version' | ||
required: true | ||
tabmat_version: | ||
description: 'Tabmat version' | ||
required: true | ||
runs: | ||
using: 'docker' | ||
image: condaforge/mambaforge:latest | ||
args: | ||
- /bin/bash | ||
- "-l" | ||
- "-c" | ||
- "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_daily.sh" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Daily runs | ||
on: | ||
schedule: | ||
- cron: '0 5 * * *' | ||
push: | ||
paths: | ||
- '.github/workflows/daily.yml' | ||
|
||
jobs: | ||
linux-daily-unittests: | ||
name: "Linux - daily unit tests - Python ${{ matrix.PYTHON_VERSION}} - ${{ matrix.NOTE }}" | ||
runs-on: ubuntu-latest | ||
env: | ||
CI: True | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- PYTHON_VERSION: '3.9' | ||
PANDAS_VERSION: 'nightly' | ||
NUMPY_VERSION: 'nightly' | ||
# See https://github.com/Quantco/glum/issues/506 | ||
# SCIKIT_VERSION: 'nightly' | ||
SCIKIT_VERSION: '' | ||
SCIPY_VERSION: 'nightly' | ||
TABMAT_VERSION: 'nightly' | ||
NOTE: 'Nightly Builds' # run once with nightlies | ||
- PYTHON_VERSION: '3.9' | ||
PANDAS_VERSION: '' | ||
NUMPY_VERSION: '' | ||
SCIKIT_VERSION: '' | ||
SCIPY_VERSION: '' | ||
TABMAT_VERSION: '' | ||
NOTE: 'Default Builds' # run once with normal dependencies | ||
steps: | ||
- name: Pull image | ||
run: docker pull condaforge/mambaforge:latest | ||
- name: Checkout branch | ||
uses: actions/checkout@v2.3.5 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
- name: Run CI inside of container | ||
uses: ./.github/actions/daily_unittests | ||
with: | ||
python_version: ${{ matrix.PYTHON_VERSION }} | ||
pandas_version: ${{ matrix.PANDAS_VERSION }} | ||
numpy_version: ${{ matrix.NUMPY_VERSION }} | ||
scikit_version: ${{ matrix.SCIKIT_VERSION }} | ||
scipy_version: ${{ matrix.SCIPY_VERSION }} | ||
tabmat_version: ${{ matrix.TABMAT_VERSION }} | ||
- name: Issue on failure | ||
uses: actions/github-script@v5 | ||
if: ${{ failure() }} | ||
with: | ||
script: | | ||
github.rest.issues.listForRepo({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
state: "open", | ||
labels: "[bot] Daily run" | ||
}).then((issues) => { | ||
if (issues.data.length === 0){ | ||
github.rest.issues.create({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
title: "Daily run failure: Unit tests", | ||
body: "The daily unit tests failed. See https://github.com/Quantco/glum/actions/runs/${{ github.run_id }} for details.", | ||
assignees: ["MarcAntoineSchmidtQC", "lbittarello"], | ||
labels: ["[bot] Daily 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/bin/bash | ||
|
||
set -exo pipefail | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
source ${SCRIPT_DIR}/base.sh "$PYTHON_VERSION" | ||
|
||
mamba install -y yq | ||
|
||
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" | ||
# TODO: switch to a special channel once we have a Quetz instance up and running | ||
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/ | ||
|
||
# Check that the readme example will work by running via doctest. | ||
# We run outside the repo to make the test a bit more similar to | ||
# a user running after installing with conda. | ||
mkdir ../temp | ||
cp README.md ../temp | ||
cd ../temp | ||
python -m doctest -v README.md |
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
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
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
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