@@ -53,20 +53,83 @@ jobs:
5353 - name : Install Firefox and GeckoDriver
5454 run : |
5555 sudo apt-get update
56- sudo apt-get install -y firefox-esr wget
56+ sudo apt-get install -y firefox-esr wget xvfb dbus-x11 openbox
5757 sudo rm -rf /var/lib/apt/lists/*
58- wget -O /tmp/geckodriver.tar.gz https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux64.tar.gz
58+ # Use a more recent GeckoDriver version
59+ wget -O /tmp/geckodriver.tar.gz https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz
5960 sudo tar -xzf /tmp/geckodriver.tar.gz -C /usr/local/bin/
6061 sudo chmod +x /usr/local/bin/geckodriver
6162 rm /tmp/geckodriver.tar.gz
63+ # Verify installations
64+ firefox --version
65+ geckodriver --version
6266
6367 - name : Install Python dependencies
6468 run : |
6569 python -m pip install --upgrade pip
66- pip install -r python_components/accessibility_scan/requirements.txt
70+ pip install -r python_components/accessibility_scan/requirements.txt
6771
68- - name : Run tests
72+ - name : Start Rails server
6973 env :
7074 RAILS_ENV : test
7175 DATABASE_URL : postgres://postgres:postgres@localhost:5432/access_pdf_test
72- run : python python_components/accessibility_scan/main.py
76+ run : |
77+ # Start Rails server on a specific port in the background
78+ bin/rails server -e test -p 3000 &
79+ echo $! > rails_server.pid
80+
81+ # Wait for Rails server to be ready
82+ echo "Waiting for Rails server to start..."
83+ timeout=60
84+ while ! curl -f http://localhost:3000 >/dev/null 2>&1; do
85+ sleep 2
86+ timeout=$((timeout - 2))
87+ if [ $timeout -le 0 ]; then
88+ echo "Rails server failed to start within 60 seconds"
89+ exit 1
90+ fi
91+ done
92+ echo "Rails server is ready!"
93+
94+ - name : Debug Environment
95+ run : |
96+ echo "=== System Information ==="
97+ uname -a
98+ echo "=== Firefox Version ==="
99+ firefox --version
100+ echo "=== GeckoDriver Version ==="
101+ geckodriver --version
102+ echo "=== Network ==="
103+ netstat -tlnp | grep :3000
104+ echo "=== Rails Server Test ==="
105+ curl -v http://localhost:3000 || echo "Rails server not responding"
106+
107+ - name : Run Accessibility Scan
108+ env :
109+ RAILS_ENV : test
110+ DATABASE_URL : postgres://postgres:postgres@localhost:5432/access_pdf_test
111+ DISPLAY : :99
112+ MOZ_HEADLESS : 1
113+ DBUS_SESSION_BUS_ADDRESS : /dev/null
114+ run : |
115+ # Start virtual display with better settings
116+ Xvfb :99 -screen 0 1280x1024x24 -ac +extension GLX +render -noreset &
117+ sleep 3
118+
119+ # Start a minimal window manager to help with graphics
120+ openbox --display=:99 &
121+ sleep 2
122+
123+ # Debug: Check if Rails server is still running
124+ curl -f http://localhost:3000 || (echo "Rails server not responding" && exit 1)
125+
126+ # Run the accessibility scan with timeout
127+ timeout 300 python python_components/accessibility_scan/main.py || (echo "Accessibility scan timed out or failed" && exit 1)
128+
129+ - name : Stop Rails server
130+ if : always()
131+ run : |
132+ if [ -f rails_server.pid ]; then
133+ kill $(cat rails_server.pid) || true
134+ rm rails_server.pid
135+ fi
0 commit comments