Skip to content

Commit

Permalink
chore: add tmate and vnc support to test action (#101)
Browse files Browse the repository at this point in the history
closes #91
  • Loading branch information
mikesmithgh authored Dec 11, 2023
1 parent 64b390d commit dc49399
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 5 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ on:
branches:
- 'main'
workflow_dispatch:
inputs:
enable_debug_vnc:
required: false
type: boolean
default: false
enable_debug_tmate:
required: false
type: boolean
default: false
schedule:
# daily 9AM EST
- cron: "0 14 * * *"
Expand Down Expand Up @@ -36,9 +45,46 @@ jobs:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- name: Start Xvfb
if: ${{ ! inputs.enable_debug_vnc }}
run: |
Xvfb :1 -screen 0 1024x768x16 &
- name: (debug) Start TurboVNC
if: ${{ inputs.enable_debug_vnc }}
run: |
mkdir -p "$GITHUB_WORKSPACE/tmp"
curl -s -L https://github.com/TurboVNC/turbovnc/releases/download/3.1/turbovnc_3.1_amd64.deb -o "$GITHUB_WORKSPACE/tmp/turbovnc.deb"
cd "$GITHUB_WORKSPACE/tmp" || exit 1
sudo dpkg -i turbovnc.deb
sudo apt update
sudo apt install -f
cd "$GITHUB_WORKSPACE" || exit 1
export PATH="/opt/TurboVNC/bin:$PATH"
vncserver -SecurityTypes None
- name: (debug) Setup ngrok session
if: ${{ inputs.enable_debug_vnc }}
env:
NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }}
run: |
mkdir -p "$GITHUB_WORKSPACE/tmp/bin"
curl -s -L https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz -o "$GITHUB_WORKSPACE/tmp/ngrok.tgz"
cd "$GITHUB_WORKSPACE/tmp" || exit 1
tar -xvf ngrok.tgz -C "$GITHUB_WORKSPACE/tmp/bin"
cd "$GITHUB_WORKSPACE" || exit 1
export PATH="$GITHUB_WORKSPACE/tmp/bin:$PATH"
ngrok config add-authtoken "$NGROK_AUTH_TOKEN"
ngrok tcp 22 --log=stdout > "$GITHUB_WORKSPACE/tmp/ngrok.log" &
sleep 1 # wait for ngrok to start
NGROK_TLS_URL="$(curl --silent http://127.0.0.1:4040/api/tunnels | jq -r '.tunnels[0].public_url')"
host="$(echo $NGROK_TLS_URL | awk -F:// '{print $2}' | awk -F: ' {print $1}')"
port="$(echo $NGROK_TLS_URL | awk -F:// '{print $2}' | awk -F: ' {print $2}')"
printf '\n\nngrok agent running avaible at %s\n\nRun the following command on your machine:\n\n ssh -L 59000:localhost:5901 -C -N -p %s -l runner %s\n\nConnect on your machine at: localhost:59000\n\n' $NGROK_TLS_URL $port $host
- name: (debug) Setup tmate session
if: ${{ inputs.enable_debug_tmate || inputs.enable_debug_vnc }}
uses: mxschmitt/action-tmate@v3

- name: Test kitty-scrollback.nvim
run: |
# TODO: improve the env var exports, github actions are making it hard so I gave up for now
Expand Down
17 changes: 12 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,17 @@
## Troubleshooting

### Github Actions
- Interactive debug the action by temporarily adding the build step
```yml
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
```

#### Interactive debugging

- Run the worklow [tests](https://github.com/mikesmithgh/kitty-scrollback.nvim/actions/workflows/tests.yml)
- Check `enable_debug_vnc` to enable TurboVNC, ngrok, and tmate debugging
- This allows you to connect to the Github runner via vnc (for GUI) and ssh
- Check `enable_debug_tmate` to enable tmate debugging
- This allows you to connect to the Github runner via ssh

#### Verbose logging

- Enable verbose logging by running the action with [debug logging](https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging) enabled.
- This can also be achieved by setting `RUNNER_DEBUG` to `1`, `RUNNER_DEBUG=1 make test`

0 comments on commit dc49399

Please sign in to comment.