From 51a7c7edddcfd8c8400243bf803530c7fd7aaebb Mon Sep 17 00:00:00 2001 From: Patrick Devaney Date: Fri, 3 Jan 2025 17:43:37 -0500 Subject: [PATCH] [CLEANUP] --- .github/workflows/docker-test.yml | 11 ++++++-- tests/Dockerfile | 47 ++++++++++++++++++------------- 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index 7a475cbf..4bbc456f 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -46,7 +46,14 @@ jobs: -e OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} \ -v ${{ github.workspace }}/logs:/usr/src/app/logs \ ${{ env.IMAGE_TAG }} \ - /usr/src/app/tests | tee ${{ github.workspace }}/logs/test_logs.txt + /usr/src/app/tests --continue-on-collection-errors --tb=short --disable-warnings | tee ${{ github.workspace }}/logs/test_logs.txt - name: Print test logs - run: cat ${{ github.workspace }}/logs/test_logs.txt || echo "No test logs found" \ No newline at end of file + run: cat ${{ github.workspace }}/logs/test_logs.txt || echo "No test logs found" + + # Optional: Add debug step if needed + - name: Debug Docker container + if: failure() + run: | + docker run --rm ${{ env.IMAGE_TAG }} --version + docker run --rm -e OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} ${{ env.IMAGE_TAG }} -h \ No newline at end of file diff --git a/tests/Dockerfile b/tests/Dockerfile index 61a90e78..822761b1 100644 --- a/tests/Dockerfile +++ b/tests/Dockerfile @@ -8,35 +8,44 @@ ENV PYTHONDONTWRITEBYTECODE=1 \ PIP_DISABLE_PIP_VERSION_CHECK=1 \ PIP_DEFAULT_TIMEOUT=100 -# Set the working directory to the root of the project (relative to pyproject.toml) +# Set the working directory WORKDIR /usr/src/app # Copy the entire project into the container COPY . . -# Install Poetry -RUN pip install poetry +# Install system dependencies and clean up +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + git \ + && rm -rf /var/lib/apt/lists/* -# Configure Poetry to avoid virtual environments and install dependencies -RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi +# Install Poetry and pytest +RUN pip install --no-cache-dir poetry pytest -# Install pytest explicitly -RUN pip install pytest +# Configure Poetry and install project dependencies +RUN poetry config virtualenvs.create false && \ + poetry install --no-interaction --no-ansi -# Check if pytest is installed successfully -RUN pytest --version || echo "pytest not found" - -# Ensure the logs directory has correct permissions +# Create logs directory with proper permissions RUN mkdir -p /usr/src/app/logs && chmod -R 777 /usr/src/app/logs -# Ensure that the PATH includes the directory where pytest is installed -ENV PATH="/usr/local/bin:$PATH" +# Add pytest to PATH and verify installation +ENV PATH="/usr/local/bin:/root/.local/bin:$PATH" + +# Verify pytest installation +RUN python -m pytest --version + +# Create a shell script to run tests +COPY <