-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
24aafb5
commit 98aee8d
Showing
8 changed files
with
86 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ on: | |
pull_request: | ||
paths: | ||
- 'binder/**.yml' | ||
- 'binder/Dockerfile' | ||
- 'binder/apt.txt' | ||
|
||
concurrency: | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
# Inherit from an upstream image | ||
FROM jupyter/base-notebook:2023-05-15 | ||
|
||
# Copy necessary files | ||
COPY binder/environment.yml /tmp/environment.yml | ||
COPY binder/apt.txt /tmp/apt.txt | ||
|
||
RUN mamba env update --prefix ${CONDA_DIR} --file /tmp/environment.yml | ||
# Switch to root user to install apt packages | ||
USER root | ||
|
||
# Install apt packages and clean up | ||
RUN apt-get update && \ | ||
xargs -a /tmp/apt.txt apt install -y && \ | ||
apt-get autoremove -y && \ | ||
apt-get autoclean && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
rm /tmp/apt.txt | ||
|
||
USER root | ||
RUN apt-get update && xargs -a /tmp/apt.txt apt install -y && rm -r /var/lib/apt/lists/* | ||
USER 1001 | ||
# Install conda packages and clean up | ||
USER jovyan | ||
RUN mamba env update --prefix ${CONDA_DIR} --file /tmp/environment.yml && \ | ||
mamba clean --all -f -y |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,8 @@ libxdamage1 | |
libxfixes3 | ||
libxkbcommon0 | ||
libxrandr2 | ||
xorg | ||
xserver-xorg | ||
xvfb | ||
libx11-dev | ||
libxext-dev |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
|
||
playwright install | ||
python main.py | ||
pytest -v -s |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import platform | ||
|
||
from playwright.sync_api import sync_playwright | ||
|
||
# get the OS name | ||
os_name = platform.system() | ||
chrome_args = ['--enable-unsafe-webgpu', '--ignore-gpu-blocklist', '--disable-software-rasterizer'] | ||
|
||
if os_name == 'Linux': | ||
chrome_args.extend( | ||
['--enable-features=Vulkan,UseSkiaRenderer', '--use-angle=vulkan', '--enable-gpu'] | ||
) | ||
|
||
|
||
def test_gpu_hardware_acceleration(): | ||
with sync_playwright() as p: | ||
browser = p.chromium.launch(args=chrome_args) | ||
page = browser.new_page() | ||
page.goto('chrome://gpu') | ||
feature_status_list = page.query_selector('.feature-status-list') | ||
assert 'Hardware accelerated' in feature_status_list.inner_text() | ||
# Check if webGL is enabled | ||
print(feature_status_list.inner_text()) | ||
assert 'OpenGL: Enabled' in feature_status_list.inner_text() | ||
assert 'WebGL: Hardware accelerated' in feature_status_list.inner_text() | ||
assert 'WebGL2: Hardware accelerated' in feature_status_list.inner_text() | ||
assert 'WebGPU: Hardware accelerated' in feature_status_list.inner_text() | ||
browser.close() |