Run AppImage #64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run AppImage | |
on: | |
workflow_dispatch: | |
inputs: | |
manual-run: | |
description: '测试远程调用' | |
required: true | |
default: 'true' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Create Cache Directory | |
run: mkdir -p ./apt-cache/*.deb | |
- name: Install GUI Dependency | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
libgl1-mesa-glx \ | |
libglu1-mesa \ | |
libx11-6 \ | |
libxext6 \ | |
libxrender1 \ | |
libxi6 \ | |
libxtst6 \ | |
libxt6 \ | |
libxfixes3 \ | |
libxrandr2 \ | |
libasound2 \ | |
libpango1.0-0 \ | |
libatk1.0-0 \ | |
libgtk-3-0 \ | |
libgstreamer1.0-0 \ | |
gstreamer1.0-plugins-base \ | |
gstreamer1.0-plugins-good \ | |
gstreamer1.0-plugins-bad \ | |
gstreamer1.0-plugins-ugly \ | |
libfuse-dev \ | |
libegl1 \ | |
libwebkit2gtk-4.0-37 \ | |
xvfb \ | |
at-spi2-core \ | |
dbus-x11 \ | |
imagemagick \ | |
- name: Install and configure locales | |
run: | | |
sudo apt-get install -y locales | |
sudo locale-gen en_GB.UTF-8 | |
sudo dpkg-reconfigure locales | |
- name: Setup Xauthority | |
run: | | |
if [ ! -f $HOME/.Xauthority ]; then | |
touch $HOME/.Xauthority | |
xauth nlist $DISPLAY | xauth -f $HOME/.Xauthority nmerge - | |
else | |
echo ".Xauthority 已配置,跳过配置步骤。" | |
fi | |
- name: Start Xvfb | |
run: | | |
Xvfb :99 -screen 0 1024x768x24 & | |
echo "DISPLAY=:99" >> $GITHUB_ENV | |
- name: Start AT-SPI Registry | |
run: | | |
echo "Starting AT-SPI Registry" | |
export XDG_SESSION_COOKIE=$(xauth list | grep .$DISPLAY | cut -d' ' -f1) | |
dbus-launch --exit-with-session | |
echo "AT-SPI Registry started" | |
- name: Cache AppImage | |
uses: actions/cache@v3 | |
with: | |
path: appimage.AppImage | |
key: appimage-cache-${{ runner.os }} | |
restore-keys: | | |
appimage-cache-${{ runner.os }}- | |
- name: Download AppImage | |
run: | | |
if [ ! -f appimage.AppImage ]; then | |
echo "下载 AppImage" | |
wget https://github.com/Snapmaker/OrcaSlicer/releases/download/nightlybuild/Snapmaker_Orca_Engine_Linux_V0.0.1.AppImage -O appimage.AppImage | |
chmod 777 appimage.AppImage | |
else | |
echo "AppImage 已下载,跳过下载步骤。" | |
fi | |
- name: Copy Config | |
run: | | |
mkdir -p ~/.config/Snapmaker_Orca | |
cp Snapmaker_Orca.conf ~/.config/Snapmaker_Orca/Snapmaker_Orca.conf | |
- name: Run AppImage | |
run: | | |
./appimage.AppImage /home/runner/work/Snapmaker_Engine/Snapmaker_Engine/3DBenchy.3mf | |
cd /home/runner/work/Snapmaker_Engine/Snapmaker_Engine/ | |
ls -a | |
env: | |
DISPLAY: ":99" | |
# debug | |
# - name: Run AppImage | |
# run: | | |
# ./appimage.AppImage /home/runner/work/Snapmaker_Engine/Snapmaker_Engine/3DBenchy.3mf & | |
# APPIMAGE_PID=$! | |
# echo "AppImage is running with PID $APPIMAGE_PID" | |
# env: | |
# DISPLAY: ":99" | |
# - name: Capture Screenshots | |
# run: | | |
# for i in {1..10}; do | |
# sleep 5 # Capture a screenshot every 5 seconds | |
# import -display :99 -window root /home/runner/work/screenshot_$i.png | |
# echo "Screenshot $i captured" | |
# done | |
# | |
# - name: Gracefully stop the AppImage | |
# run: | | |
# if [ -n "$APPIMAGE_PID" ]; then | |
# kill $APPIMAGE_PID | |
# else | |
# echo "PID not found, cannot kill the AppImage process." | |
# fi | |
# - name: Upload Screenshots | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: Screenshots | |
# path: /home/runner/work/screenshot_*.png |