Skip to content

Commit

Permalink
Update examples screenshots from CI (#722)
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf authored Jul 24, 2023
1 parent 026a87b commit 1d34ce7
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/update-screenshots.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Update Screenshots

on:
workflow_dispatch:

env:
PER_PAGE: 20

jobs:
take-screenshots:
name: Take Screenshots
runs-on: ubuntu-latest
strategy:
matrix:
# if all examples are not built, add a new page here
page: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
steps:

- name: Checkout Bevy latest tag
uses: actions/checkout@master
with:
repository: 'bevyengine/bevy'
ref: 'latest'

# temporary: fetch tools from main branch
- name: Checkout Bevy Tools
uses: actions/checkout@master
with:
repository: 'bevyengine/bevy'
ref: 'main'
path: 'bevy-tools'
- name: Copy Bevy tools to latest
run: |
rm -rf tools
cp -r bevy-tools/tools/ tools
rm -rf bevy-tools
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Install Bevy dependencies
run: |
sudo apt-get update;
DEBIAN_FRONTEND=noninteractive sudo apt-get install --no-install-recommends -yq \
libasound2-dev libudev-dev;
- name: install xvfb, llvmpipe and lavapipe
run: |
sudo apt-get update -y -qq
sudo add-apt-repository ppa:oibaf/graphics-drivers -y
sudo apt-get update
sudo apt install -y xvfb libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
- name: Take Screenshots
run: |
xvfb-run cargo run -p example-showcase -- --page ${{ matrix.page }} --per-page ${{ env.PER_PAGE }} run --screenshot --in-ci
- name: Upload Generated Files
uses: actions/upload-artifact@v3
with:
name: screenshots-${{ matrix.page }}
path: screenshots

prepare-pr:
name: Prepare Screenshots Update PR
runs-on: ubuntu-latest
needs: take-screenshots
permissions:
pull-requests: write
contents: write
steps:

- name: Clone bevy-website repo
uses: actions/checkout@master

- name: Download all artifacts
uses: actions/download-artifact@v3

- name: Move examples to the correct folder
run: |
rm -rf static/screenshots
mkdir static/screenshots
for file in screenshots-*
do
rsync -a $file/* static/screenshots/
rm -rf $file
done
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
delete-branch: true
branch-suffix: random
title: Update Examples Screenshots
body: |
This PR updates the screenshots of the examples with latest version from Bevy.
It was automatically generated by a GitHub Action.

0 comments on commit 1d34ce7

Please sign in to comment.