Skip to content

Commit

Permalink
Add email on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Ericgig committed Oct 19, 2023
1 parent 8d69ca4 commit f975b2a
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 3 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ on:
branches:
- master

schedule:
- cron: "0 12 * * 0" # Every Sunday at noon UTC

defaults:
run:
# The slightly odd shell call is to force bash to read .bashrc, which is
Expand Down
102 changes: 102 additions & 0 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# The name is short because we mostly care how it appears in the pull request
# "checks" dialogue box - it looks like
# Tests / ubuntu-latest, python-3.9, defaults
# or similar.
name: Weekly

on:
schedule:
- cron: "0 12 * * 0" # Every Sunday at noon UTC

defaults:
run:
# The slightly odd shell call is to force bash to read .bashrc, which is
# necessary for having conda behave sensibly. We use bash as the shell even
# on Windows, since we don't run anything much complicated, and it makes
# things much simpler.
shell: bash -l {0}

jobs:
if: github.repository == 'qutip/qutip-jax'
cases:
name: ${{ matrix.os }}, ${{ matrix.case-name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.9]
case-name: [defaults]

steps:
- uses: actions/checkout@v2

- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}

- name: Install QuTiP from GitHub
run: |
python -mpip install git+https://github.com/qutip/qutip.git@master
python -c 'import qutip; qutip.about()'
- name: Install qutip-jax and dependencies
# Install in editable mode so Coveralls detects the tree structure
# relative to the git repository root as well.
run: |
python -mpip install -e .[full]
- name: Package information
run: |
conda list
python -c 'import qutip_jax; print(qutip_jax.__version__)'
- name: Run tests
# If our tests are running for longer than an hour, _something_ is wrong
# somewhere. The GitHub default is 6 hours, which is a bit long to wait
# to see if something hung.
timeout-minutes: 60
run: |
pytest --durations=0 --durations-min=1.0 --verbosity=1 --color=yes -W ignore::UserWarning:qutip
# Above flags are:
# --durations=0 --durations-min=1.0
# at the end, show a list of all the tests that took longer than a
# second to run
# --verbosity=1
# turn the verbosity up so pytest prints the names of the tests
# it's currently working on
# --cov=qutip_jax
# limit coverage reporting to code that's within the qutip_jax package
# --color=yes
# force coloured output in the terminal
# --cov-report=
# don't print the coverage report to the terminal---it just adds
# cruft, and we're going to upload the .coverage file to Coveralls
# -W ignore::UserWarning:qutip
# Ignore matplotlib missing warnings
# These flags are added to those in pyproject.toml.
finalise:
name: Send Email on Failure
needs: cases
if: failure()
runs-on: ubuntu-latest
uses: dawidd6/action-send-mail@v3
with:
# Required mail server address if not connection_url:
server_address: smtp-mail.outlook.com
server_port: 587
secure: true
# Optional (recommended) mail server username:
username: ${{ secrets.OUTLOOK_ADR }}
# Optional (recommended) mail server password:
password: ${{ secrets.OUTLOOK_PWD }}
# Required mail subject:
subject: ${{ github.job }} job of ${{ github.repository }} has ${{ job.status }}
# Required recipients' addresses:
to: [email protected]
# Required sender full name (address can be skipped):
from: QuTiP-Jax
# Optional plain body:
body: ${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has ${{ job.status }}

0 comments on commit f975b2a

Please sign in to comment.