Skip to content

Latest commit

 

History

History
37 lines (29 loc) · 1.03 KB

File metadata and controls

37 lines (29 loc) · 1.03 KB

ScreenshotGUIAppInGithubAction

  • Runs a gui command using Xvfb (virtual framebuffer)
  • Extracts a screenshot using xwd (x window dump)
  • Artifacts the screenshot

Quite useful for quickly testing a GUI app in CI with pictures

jobs:
  linuxRun:
    runs-on: ubuntu-18.04
    
    steps:
      - name: Install dependencies
        run: sudo apt-get install -y xvfb x11-apps imagemagick xterm

      - name: launch and screenshot
        run: |
          export DISPLAY=:99
          sudo Xvfb :99 -screen 0 1024x768x8 &
          sleep 5
          xterm -hold -e echo "Checkout the artifact!" 2>/dev/null &
          sleep 5
          xwd -root -silent | convert xwd:- png:screenshot.png
          
      - name: upload artifact
        uses: actions/upload-artifact@v3
        with:
          name: screenshot
          path: screenshot.png

The sleeps appear necessary to allow for the app and frame buffer to run

E.g

screenshot