Daily runs #703
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
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.10' | |
NOTE: 'Nightly Builds' # run once with nightlies | |
- PYTHON_VERSION: '3.10' | |
NOTE: 'Default Builds' # run once with normal dependencies | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
- uses: mamba-org/setup-micromamba@875557da4ee020f18df03b8910a42203fbf02da1 | |
with: | |
environment-file: environment.yml | |
create-args: >- | |
python=${{ matrix.PYTHON_VERSION }} | |
- name: Install nightlies | |
if: matrix.NOTE == 'Nightly Builds' | |
shell: bash -el {0} | |
run: | | |
# needed for tabmat | |
echo "Install compilation dependencies" | |
micromamba install -y c-compiler cxx-compiler cython jemalloc-local libgomp mako xsimd | |
PRE_WHEELS="https://pypi.anaconda.org/scipy-wheels-nightly/simple" | |
for pkg in numpy pandas scikit-learn scipy; do | |
echo "Installing $pkg nightly" | |
micromamba remove -y --force $pkg | |
pip install --pre --no-deps --only-binary :all: --upgrade --timeout=60 -i $PRE_WHEELS $pkg | |
done | |
echo Install tabmat nightly | |
micromamba remove -y --force tabmat | |
pip install git+https://github.com/Quantco/tabmat | |
- name: Install repository | |
shell: bash -el {0} | |
run: pip install --no-use-pep517 --no-deps --disable-pip-version-check -e . | |
- name: Run pytest | |
shell: bash -el {0} | |
run: pytest -nauto tests/glm --doctest-modules src/glum/ | |
- name: Run doctest | |
shell: bash -el {0} | |
# 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. | |
run: | | |
mkdir ../temp | |
cp README.md ../temp | |
cd ../temp | |
python -m doctest -v README.md | |
- name: Issue on failure | |
uses: actions/github-script@v6 | |
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"], | |
labels: ["[bot] Daily run"] | |
}) | |
} | |
}); |