-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
116 lines (104 loc) · 3.58 KB
/
action.yml
File metadata and controls
116 lines (104 loc) · 3.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: 'Setup OpenGL and Run Commands'
description: 'Installs OpenGL and runs the specified command(s)'
author: 'Your Name'
inputs:
commands:
description: 'Command(s) to execute after OpenGL setup'
required: true
default: ''
runs:
using: 'composite'
steps:
- name: Setup OpenGL (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update -qq -y
export DEBIAN_FRONTEND=noninteractive
sudo apt-get -y install \
freeglut3-dev \
libgl1-mesa-dev \
libxcursor-dev \
libpulse-dev \
libxinerama-dev \
libxrandr-dev \
libxv-dev \
mesa-utils \
libgl1 \
libglx-mesa0 \
mesa-common-dev \
libglapi-mesa \
libgbm1 \
libgl1-mesa-dri \
libsdl1.2-dev \
libfreetype6-dev \
xvfb \
x11-utils
shell: bash
- name: Setup OpenGL (Windows)
if: runner.os == 'Windows'
uses: ssciwr/setup-mesa-dist-win@v2
- name: Setup OpenGL (macOS)
if: runner.os == 'macOS'
run: |
brew install freeglut || echo "freeglut already installed"
brew install --cask xquartz || echo "xquartz already installed"
# Persist environment variables to subsequent steps via $GITHUB_ENV.
echo "DYLD_LIBRARY_PATH=$(brew --prefix freeglut)/lib:${DYLD_LIBRARY_PATH:-}" >> $GITHUB_ENV
echo "LIBGL_ALWAYS_SOFTWARE=1" >> $GITHUB_ENV
# Add XQuartz binaries (including Xvfb/xdpyinfo) to PATH for subsequent steps.
echo "/opt/X11/bin" >> $GITHUB_PATH
shell: bash
- name: Execute Commands (Linux)
if: runner.os == 'Linux'
run: |
export LIBGL_ALWAYS_SOFTWARE=1
echo "set -e" > /tmp/commands.sh
echo "${{ inputs.commands }}" >> /tmp/commands.sh
chmod +x /tmp/commands.sh
COMMANDS="bash /tmp/commands.sh"
echo $COMMANDS
/usr/bin/xvfb-run -s "-screen 0 2560x1440x24 +extension GLX +extension RENDER" $COMMANDS
shell: bash
- name: Execute Commands (Windows)
if: runner.os == 'Windows'
run: |
set LIBGL_ALWAYS_SOFTWARE=1
${{ inputs.commands }}
shell: cmd
- name: Execute Commands (macOS)
if: runner.os == 'macOS'
run: |
set -euo pipefail
XVFB_BIN="/opt/X11/bin/Xvfb"
XDPYINFO_BIN="/opt/X11/bin/xdpyinfo"
export DISPLAY=:99
export LIBGL_ALWAYS_SOFTWARE=1
export LIBGL_ALWAYS_INDIRECT=1
# Start a headless X server for OpenGL contexts on CI.
"$XVFB_BIN" "$DISPLAY" -screen 0 2560x1440x24 +extension GLX +extension RENDER +iglx -ac &
XVFB_PID=$!
trap 'kill "$XVFB_PID" >/dev/null 2>&1 || true' EXIT
# Wait for Xvfb to accept connections before starting OpenGL clients.
for _ in $(seq 1 30); do
if "$XDPYINFO_BIN" -display "$DISPLAY" >/dev/null 2>&1; then
break
fi
sleep 1
done
if ! "$XDPYINFO_BIN" -display "$DISPLAY" >/dev/null 2>&1; then
echo "Xvfb did not become ready on $DISPLAY"
exit 1
fi
if ! "$XDPYINFO_BIN" -display "$DISPLAY" | grep -q "GLX"; then
echo "GLX extension is not available on $DISPLAY"
"$XDPYINFO_BIN" -display "$DISPLAY" || true
exit 1
fi
if command -v glxinfo >/dev/null 2>&1; then
glxinfo -B || true
fi
echo "set -e" > /tmp/commands.sh
echo "${{ inputs.commands }}" >> /tmp/commands.sh
chmod +x /tmp/commands.sh
bash /tmp/commands.sh
shell: bash