From dc49399417cb7ca5277a3c98b77444161b49e69d Mon Sep 17 00:00:00 2001 From: Mike <10135646+mikesmithgh@users.noreply.github.com> Date: Mon, 11 Dec 2023 09:25:46 -0500 Subject: [PATCH] chore: add tmate and vnc support to test action (#101) closes #91 --- .github/workflows/tests.yml | 46 +++++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 17 ++++++++++---- 2 files changed, 58 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 266aaa79..144c2aad 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 * * *" @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0f922bcf..4048a35d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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`