Skip to content

Commit

Permalink
ci: Launch tmate session if pytest fails on workflow dispatch run (#1748
Browse files Browse the repository at this point in the history
)

* If the pytest jobs fail and the ci workflow was triggered as the result of
a workflow dispatch, launch a tmate session which allows for sshing into the
runner with the environment from the failed job.
   - c.f. https://github.com/mxschmitt/action-tmate

This idea comes from Simon Willison's (@simonw) blog post:
https://til.simonwillison.net/github-actions/debug-tmate
  • Loading branch information
matthewfeickert authored Jan 21, 2022
1 parent 3c3d2db commit 8a6f857
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ jobs:
run: |
pytest -r sx --ignore tests/benchmarks/ --ignore tests/contrib --ignore tests/test_notebooks.py
- name: Launch a tmate session if tests fail
if: failure() && github.event_name == 'workflow_dispatch'
uses: mxschmitt/action-tmate@v3

- name: Report core project coverage with Codecov
if: github.event_name != 'schedule' && matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v2
Expand Down

0 comments on commit 8a6f857

Please sign in to comment.