perf(api): detect MIME types without copying the upload #1841
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
| name: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| env: | |
| PIPELINE_FAMILY: "general" | |
| jobs: | |
| lint: | |
| runs-on: opensource-linux-8core | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Read Python version from .python-version | |
| run: echo "PYTHON_VERSION=$(cat .python-version)" >> $GITHUB_ENV | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| cache-suffix: lint | |
| - name: Set up Python ${{ env.PYTHON_VERSION }} | |
| run: uv python install ${{ env.PYTHON_VERSION }} | |
| - name: Install lint dependencies | |
| run: uv sync --only-group lint --locked | |
| - name: Lint | |
| run: make check | |
| shellcheck: | |
| runs-on: opensource-linux-8core | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: ShellCheck | |
| uses: ludeeus/action-shellcheck@master | |
| test: | |
| runs-on: opensource-linux-8core | |
| needs: lint | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Read Python version from .python-version | |
| run: echo "PYTHON_VERSION=$(cat .python-version)" >> $GITHUB_ENV | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| cache-suffix: test | |
| - name: Set up Python ${{ env.PYTHON_VERSION }} | |
| run: uv python install ${{ env.PYTHON_VERSION }} | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update && sudo apt-get install --yes poppler-utils libreoffice | |
| make install-pandoc | |
| sudo add-apt-repository -y ppa:alex-p/tesseract-ocr5 | |
| sudo apt-get install -y tesseract-ocr tesseract-ocr-kor | |
| tesseract --version | |
| - name: Install test dependencies | |
| run: uv sync --group test --locked | |
| - name: Install NLP models | |
| run: make install-nlp-models | |
| - name: Run core tests | |
| run: make test | |
| - name: Check coverage | |
| run: make check-coverage | |
| changelog: | |
| runs-on: opensource-linux-8core | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - if: github.ref != 'refs/heads/main' | |
| uses: dorny/paths-filter@v3 | |
| id: changes | |
| with: | |
| filters: | | |
| src: | |
| - 'doc_recipe/**' | |
| - 'recipe-notebooks/**' | |
| - if: steps.changes.outputs.src == 'true' && github.ref != 'refs/heads/main' | |
| uses: dangoslen/changelog-enforcer@v3 | |
| test_dockerfile: | |
| runs-on: opensource-linux-8core | |
| needs: lint | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Read Python version from .python-version | |
| run: echo "PYTHON_VERSION=$(cat .python-version)" >> $GITHUB_ENV | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| cache-suffix: smoke | |
| - name: Set up Python ${{ env.PYTHON_VERSION }} | |
| run: uv python install ${{ env.PYTHON_VERSION }} | |
| - name: Free up disk space | |
| run: | | |
| # Clear some space (https://github.com/actions/runner-images/issues/2840) | |
| echo "Disk usage before cleanup:" | |
| df -h | |
| # Remove unnecessary pre-installed software | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /usr/local/share/boost | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| sudo rm -rf /usr/local/.ghcup | |
| sudo rm -rf /usr/share/swift | |
| # Clean up docker to ensure we start fresh | |
| docker system prune -af --volumes | |
| echo "Disk usage after cleanup:" | |
| df -h | |
| - name: Install smoke test dependencies | |
| run: uv sync --only-group smoke --locked | |
| - name: Build Dockerfile | |
| run: make docker-build | |
| - name: Test Dockerfile | |
| run: make docker-test |