Skip to content

perf(ci): Cut Docker smoke-test time on large runners #1850

perf(ci): Cut Docker smoke-test time on large runners

perf(ci): Cut Docker smoke-test time on large runners #1850

Workflow file for this run

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 when needed
run: |
# Large runners normally have hundreds of GiB free. Keep the fallback for
# smaller runners, but avoid spending minutes deleting unused toolchains.
# Docker images and the host toolchains/venv may live on different
# filesystems, so both must have room before cleanup is skipped.
docker_root=$(docker info --format '{{.DockerRootDir}}')
available_kib=$(df -Pk / "$docker_root" | awk 'NR > 1 && (min == "" || $4 < min) {min = $4} END {print min}')
if (( available_kib >= 30 * 1024 * 1024 )); then
echo "Skipping cleanup: $((available_kib / 1024 / 1024)) GiB free on / and Docker storage"
exit 0
fi
df -h / "$docker_root"
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/share/boost \
/usr/local/lib/android /opt/hostedtoolcache/CodeQL /usr/local/.ghcup /usr/share/swift
docker system prune -af --volumes
df -h / "$docker_root"
- 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