Skip to content

experiment with screenshot preview #25

experiment with screenshot preview

experiment with screenshot preview #25

name: Take Screenshot
on:
push:
branches:
- main
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
DISPLAY: :99
SLINT_FULLSCREEN: 1
RUST_LOG: debug
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache cargo bin
uses: actions/cache@v2
with:
path: ~/.cargo/bin
key: ${{ runner.os }}-cargo-bin-foo-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-foo-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-git-foo-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-cargo-build-target-foo-${{ hashFiles('**/Cargo.lock') }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y xvfb x11-apps scrot imagemagick libxkbcommon-x11-0
- name: Build
run: cargo build --release
- name: Start Xvfb
run: |
Xvfb :99 -screen 0 768x1024x24 & > /dev/null 2>&1 &
sleep 5
cargo run --release > cargo.log 2>&1 &
sleep 30
cat cargo.log
xwd -root -out screenshot.xwd
convert screenshot.xwd fooPoop.png
scrot screenshot.png
- name: Commit and push screenshot
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Add screenshot" -a
git push