diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4a40792..38d4d19 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,83 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 # 检出仓库代码 + - 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: Start Xvfb + run: | + Xvfb :99 -screen 0 1024x768x24 & + echo "DISPLAY=:99" >> $GITHUB_ENV + + - name: Setup Xauthority + run: | + touch $HOME/.Xauthority + xauth nlist $DISPLAY | xauth -f $HOME/.Xauthority nmerge - + + - 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: Download AppImage + run: | + wget https://github.com/Snapmaker/OrcaSlicer/releases/download/nightlybuild/Snapmaker_Orca_Engine_Linux_V0.0.1.AppImage -O appimage.AppImage # 下载AppImage + chmod 777 appimage.AppImage # 给AppImage执行权限 + - name: Copy Config run: | - cd /home/runner/work/Snapmaker_Engine/Snapmaker_Engine/ - ls -a \ No newline at end of file + 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 & + 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 + kill $APPIMAGE_PID # Gracefully stop the AppImage + + - name: Upload Screenshots + uses: actions/upload-artifact@v2 + with: + name: Screenshots + path: /home/runner/work/screenshot_*.png \ No newline at end of file