Skip to content

Commit 49007c9

Browse files
committed
DEBUG: with tmate
This is a bit more complicated than using `action-tmate` because I want this to be run in the minimal Git for Windows SDK, not in MSYS2. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent d196a0b commit 49007c9

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

.github/workflows/main.yml

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,45 @@ jobs:
2525
concurrency:
2626
group: windows-build-${{ github.ref }}
2727
steps:
28-
- uses: actions/checkout@v4
2928
- uses: git-for-windows/setup-git-for-windows-sdk@v1
29+
- name: debug using tmate
30+
shell: bash
31+
run: |
32+
(
33+
cd / &&
34+
G4W=/c/Program\ Files/Git &&
35+
cp -n "$G4W"/usr/bin/{ssh-keygen.exe,msys-crypto-3.dll,msys-z.dll} usr/bin/ &&
36+
37+
CURL="$G4W"/mingw64/bin/curl.exe &&
38+
"$CURL" -Lo /usr/bin/zstd.exe https://github.com/git-for-windows/git-sdk-64/raw/HEAD/usr/bin/zstd.exe &&
39+
"$CURL" -Lo /tmp/tmate.tar.zst https://repo.msys2.org/msys/x86_64/tmate-2.4.0-4-x86_64.pkg.tar.zst &&
40+
tar xvf /tmp/tmate.tar.zst usr/bin/tmate.exe &&
41+
"$CURL" -Lo /tmp/libevent.tar.zst https://repo.msys2.org/msys/x86_64/libevent-2.1.12-4-x86_64.pkg.tar.zst &&
42+
tar xvf /tmp/libevent.tar.zst usr/bin/msys-event-2-1-7.dll &&
43+
"$CURL" -Lo /tmp/msgpack-c.tar.zst https://repo.msys2.org/msys/x86_64/msgpack-c-6.1.0-1-x86_64.pkg.tar.zst &&
44+
tar xvf /tmp/msgpack-c.tar.zst usr/bin/msys-msgpack-c-2.dll &&
45+
"$CURL" -Lo /tmp/libssh.tar.zst https://repo.msys2.org/msys/x86_64/libssh-0.11.1-1-x86_64.pkg.tar.zst &&
46+
tar xvf /tmp/libssh.tar.zst usr/bin/msys-ssh-4.dll
47+
) &&
48+
49+
# restrict SSH access to the "actor", i.e. the GitHub user who triggered this workflow
50+
# this requires calling `ssh -i <private-key> [...]` later on
51+
mkdir -p ~/.ssh &&
52+
curl -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
53+
https://api.github.com/users/${{github.actor}}/keys |
54+
sed -n 's/.*"key": "\(.*\)".*/\1/p' >~/.ssh/authorized_keys &&
55+
56+
# Generate an SSH key (needed for tmate)
57+
echo -e 'y\n' | ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa &&
58+
59+
# Start tmate session
60+
export CHERE_INVOKING=1 &&
61+
tmate -S /tmp/tmate.sock -a ~/.ssh/authorized_keys new-session -d &&
62+
tmate -S /tmp/tmate.sock wait tmate-ready &&
63+
64+
# Print SSH invocation, then let the workflow continue
65+
tmate -S /tmp/tmate.sock display -p '#{tmate_ssh}'
66+
- uses: actions/checkout@v4
3067
- name: build
3168
shell: bash
3269
env:
@@ -35,3 +72,13 @@ jobs:
3572
run: . /etc/profile && ci/make-test-artifacts.sh artifacts
3673
- name: run t0610
3774
run: cd t && sh t0610-*.sh -ivx
75+
- name: wait for tmate to be done
76+
if: always()
77+
shell: bash
78+
run: |
79+
PATH=$HOME/bin:$PATH
80+
while test -e /tmp/tmate.sock
81+
do
82+
tmate -S /tmp/tmate.sock display -p '#{tmate_ssh}'
83+
sleep 5
84+
done

0 commit comments

Comments
 (0)