Skip to content

Commit a3c0e67

Browse files
committed
ci (python-app.yml): add ssh-based debugging (with artifact-upload)
1 parent aef9904 commit a3c0e67

File tree

1 file changed

+33
-13
lines changed

1 file changed

+33
-13
lines changed

.github/workflows/python-app.yml

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name: CI
55

66
on:
77
push:
8-
branches:
8+
branches:
99
- main
1010
- develop
1111
- develop_carsten
@@ -19,6 +19,9 @@ jobs:
1919

2020
runs-on: ubuntu-latest
2121

22+
env:
23+
DEBUG_WITH_SSH: false
24+
2225
steps:
2326
- uses: actions/checkout@v2
2427

@@ -27,14 +30,6 @@ jobs:
2730
with:
2831
python-version: "3.11"
2932

30-
# The following command allows to connect to the ci-container via ssh
31-
# very useful for debugging
32-
# move this step before the failing step
33-
# source: https://github.com/marketplace/actions/debugging-with-tmate
34-
35-
# - name: Setup tmate session
36-
# uses: mxschmitt/action-tmate@v3
37-
3833
- name: Install pip
3934
run: |
4035
python -m pip install --upgrade pip
@@ -48,13 +43,38 @@ jobs:
4843
# install this package
4944
pwd
5045
pip install -r requirements.txt
51-
52-
46+
47+
5348
- name: install pyerk
5449
run: |
5550
# install in editable mode -> simplify the discovery of the (internal) test data
5651
pip install -e .
5752
58-
- name: run all tests
53+
54+
# - name: run all tests
55+
# run: |
56+
# python -m unittest
57+
58+
59+
# debugging (set env.DEBUG_WITH_SSH to true (see above))
60+
- name: Setup tmate session
61+
if: env.DEBUG_WITH_SSH == 'true'
62+
id: tmate
63+
uses: mxschmitt/action-tmate@v3
64+
with:
65+
detached: true
66+
67+
# this exports the ad-hoc ssh-connection address to an text file such that it can be accessed via API
68+
# this allows to connect to the debugging ssh server without manual copy-pasting
69+
70+
- name: Capture tmate output
71+
if: env.DEBUG_WITH_SSH == 'true'
5972
run: |
60-
python -m unittest
73+
echo $(cat /home/runner/work/_temp/_runner_file_commands/* | grep ::notice::SSH | awk '{print $NF}') > tmate-connection.txt
74+
75+
- name: Upload tmate logs as artifact
76+
if: env.DEBUG_WITH_SSH == 'true'
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: tmate-connection
80+
path: tmate-connection.txt

0 commit comments

Comments
 (0)