github actions shared lib fix

This commit is contained in:
Thephaseless 2024-12-11 00:21:07 +00:00
parent b0fb72dff2
commit 986f7446bf
4 changed files with 28 additions and 2 deletions

View File

@ -23,13 +23,16 @@ RUN curl -LsSf https://astral.sh/uv/install.sh | sh
COPY pyproject.toml uv.lock ./
RUN uv sync
COPY github_actions_fix.sh ./
RUN ./github_actions_fix.sh
COPY . .
RUN cd .venv/lib/*/site-packages/seleniumbase/drivers && ln -s /usr/bin/chromedriver uc_driver
FROM base AS test
RUN uv sync --group test
RUN . .venv/bin/activate && pytest --retries 2 -n auto --xvfb
RUN ./test.sh
FROM base

6
cmd.sh
View File

@ -1,3 +1,7 @@
#!/bin/sh
. .venv/bin/activate && python3 main.py
if [ -f ld_fix.sh ]; then
. ./ld_fix.sh
fi
uv run main.py

12
github_actions_fix.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
# Source .venv
. .venv/bin/activate
# Fix for actions LD_LIBRARY_PATH env
touch ld_fix.sh
PYTHON_PATH=$(which python3)
PYTHON_DIR=$(dirname $PYTHON_PATH)
echo "export LD_LIBRARY_PATH=$PYTHON_DIR/../lib" >> ld_fix.sh
echo "export PATH=$PYTHON_DIR:\$PATH" >> ld_fix.sh
chmod +x ld_fix.sh

7
test.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
if [ -f ./ld_fix.sh ]; then
. ./ld_fix.sh
fi
uv run pytest --retries 2 -n auto --xvfb