-
Notifications
You must be signed in to change notification settings - Fork 4.7k
chore(dev): add local Docker test setup and tighten .dockerignore #1458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
BrunoAnalytics
wants to merge
5
commits into
microsoft:main
Choose a base branch
from
BrunoAnalytics:chore/dev-docker-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
16270bf
chore(dev): add local Docker test env (python:3.11-slim + ffmpeg/exif…
6374a68
docs(readme): add quickstart for local Docker tests
ca584e3
docs(readme): add no-Docker setup and test instructions
98f15db
chore(docker): set final WORKDIR=/work and add pytest ENTRYPOINT to m…
0f47291
ci: add GitHub Actions workflow to run markitdown tests (ffmpeg/exift…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,2 +1,7 @@ | ||
| * | ||
| !packages/ | ||
| .venv/ | ||
| __pycache__/ | ||
| *.pyc | ||
| .git/ | ||
| dist/ | ||
| build/ | ||
| .pytest_cache/ |
This file contains hidden or 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,45 @@ | ||
| name: CI - MarkItDown tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "chore/dev-docker-tests" ] | ||
| pull_request: | ||
| branches: [ "main" ] | ||
|
|
||
| jobs: | ||
| tests: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout source | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Python 3.11 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
| cache: "pip" | ||
|
|
||
| - name: Install system deps (ffmpeg, exiftool) | ||
| run: | | ||
| sudo apt-get update -y | ||
| sudo apt-get install -y ffmpeg exiftool | ||
|
|
||
| - name: Install project deps | ||
| run: | | ||
| python -m pip install -U pip | ||
| pip install -e 'packages/markitdown[all]' | ||
| pip install -e packages/markitdown-sample-plugin | ||
| pip install pytest | ||
|
|
||
| - name: Run tests (skip network-heavy) | ||
| env: | ||
| PYTEST_ADDOPTS: -k "not convert_url and not convert_http_uri" | ||
| run: | | ||
| pytest -q packages/markitdown/tests | tee last-run.txt | ||
|
|
||
| - name: Upload test summary | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: pytest-summary | ||
| path: last-run.txt |
This file contains hidden or 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,33 +1,26 @@ | ||
| FROM python:3.13-slim-bullseye | ||
| # imagem Debian (não Alpine) — suporta onnxruntime e magika | ||
| FROM python:3.11-slim | ||
| WORKDIR /work | ||
|
|
||
| ENV DEBIAN_FRONTEND=noninteractive | ||
| ENV EXIFTOOL_PATH=/usr/bin/exiftool | ||
| ENV FFMPEG_PATH=/usr/bin/ffmpeg | ||
| # instala compiladores e dependências do sistema | ||
| RUN apt-get update && apt-get install -y \ | ||
| build-essential git ffmpeg libxml2 libxslt1-dev \ | ||
| libffi-dev libssl-dev python3-dev \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Runtime dependency | ||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| ffmpeg \ | ||
| exiftool | ||
| # copia o código do repositório | ||
| COPY . . | ||
|
|
||
| ARG INSTALL_GIT=false | ||
| RUN if [ "$INSTALL_GIT" = "true" ]; then \ | ||
| apt-get install -y --no-install-recommends \ | ||
| git; \ | ||
| fi | ||
| # instala o markitdown e pytest | ||
| RUN pip install --no-cache-dir -U pip \ | ||
| && pip install --no-cache-dir -e 'packages/markitdown[all]' pytest | ||
|
|
||
| # Cleanup | ||
| RUN rm -rf /var/lib/apt/lists/* | ||
| # define o diretório do pacote e roda os testes | ||
| WORKDIR /work | ||
| CMD ["pytest", "-q"] | ||
|
|
||
| WORKDIR /app | ||
| COPY . /app | ||
| RUN pip --no-cache-dir install \ | ||
| /app/packages/markitdown[all] \ | ||
| /app/packages/markitdown-sample-plugin | ||
| # garante que a variável pode vir de fora sem estourar o entrypoint | ||
| ENV PYTEST_ADDOPTS="" | ||
|
|
||
| # Default USERID and GROUPID | ||
| ARG USERID=nobody | ||
| ARG GROUPID=nogroup | ||
|
|
||
| USER $USERID:$GROUPID | ||
|
|
||
| ENTRYPOINT [ "markitdown" ] | ||
| # executa os testes do pacote principal; caminho relativo exige WORKDIR=/work | ||
| ENTRYPOINT ["pytest", "-q", "packages/markitdown/tests"] | ||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
variable files
