From f0e82cbc327d105a2dfe239a740a9cc2d8217390 Mon Sep 17 00:00:00 2001 From: Zhengbo Wang Date: Fri, 17 Jan 2025 15:52:51 +0800 Subject: [PATCH] ci: downstream test for formulaic (#1817) * add-ci-formulatic * cd into formulaic folder * maybe green * revert wrong git * add install hatch * revert wrong git * using hatch run * change root dit * change config file location * remove unrelated and add show dep * sync pytest config * clean test --------- Co-authored-by: Francesco Bruzzesi <42817048+FBruzzesi@users.noreply.github.com> --- .github/workflows/downstream_tests.yml | 233 +++++++++++++++---------- 1 file changed, 138 insertions(+), 95 deletions(-) diff --git a/.github/workflows/downstream_tests.yml b/.github/workflows/downstream_tests.yml index 5ad95b6d9..647640dd9 100644 --- a/.github/workflows/downstream_tests.yml +++ b/.github/workflows/downstream_tests.yml @@ -1,6 +1,6 @@ name: Test Downstream Libraries - Fast -on: +on: pull_request: push: branches: [main] @@ -26,31 +26,31 @@ jobs: cache-dependency-glob: "pyproject.toml" - name: clone-altair run: | - git clone https://github.com/vega/altair.git --depth=1 - cd altair - git log + git clone https://github.com/vega/altair.git --depth=1 + cd altair + git log - name: install-basics run: uv pip install --upgrade tox virtualenv setuptools --system - name: install-altair-dev run: | - cd altair - uv pip install -e ".[dev, all]" --system - # temporary pin to get ci green - uv pip install "numpy<2.2" --system + cd altair + uv pip install -e ".[dev, all]" --system + # temporary pin to get ci green + uv pip install "numpy<2.2" --system - name: install-narwhals-dev run: | - uv pip uninstall narwhals --system - uv pip install -e . --system + uv pip uninstall narwhals --system + uv pip install -e . --system - name: show-deps run: uv pip freeze - name: Run pytest run: | - cd altair - pytest tests + cd altair + pytest tests - name: Run mypy run: | - cd altair - mypy altair tests + cd altair + mypy altair tests marimo: strategy: @@ -73,45 +73,45 @@ jobs: cache-dependency-glob: "pyproject.toml" - name: clone-marimo run: | - git clone https://github.com/marimo-team/marimo.git --depth=1 - cd marimo - uv venv -p 3.12 - git log + git clone https://github.com/marimo-team/marimo.git --depth=1 + cd marimo + uv venv -p 3.12 + git log - name: install-basics run: uv pip install --upgrade tox virtualenv setuptools hatch --system - name: install-marimo-dev run: | - cd marimo - . .venv/bin/activate - uv pip install -e ".[dev]" - which python + cd marimo + . .venv/bin/activate + uv pip install -e ".[dev]" + which python - name: install-narwhals-dev run: | - cd marimo - . .venv/bin/activate - uv pip uninstall narwhals - uv pip install -e ./.. + cd marimo + . .venv/bin/activate + uv pip uninstall narwhals + uv pip install -e ./.. - name: show-deps run: | - cd marimo - . .venv/bin/activate - uv pip freeze + cd marimo + . .venv/bin/activate + uv pip freeze - name: Create assets directory, copy over index.html continue-on-error: true run: | - mkdir -p marimo/marimo/_static/assets - cp marimo/frontend/index.html marimo/marimo/_static/index.html - cp marimo/frontend/public/favicon.ico marimo/marimo/_static/favicon.ico + mkdir -p marimo/marimo/_static/assets + cp marimo/frontend/index.html marimo/marimo/_static/index.html + cp marimo/frontend/public/favicon.ico marimo/marimo/_static/favicon.ico - name: Run tests with full dependencies if: ${{ matrix.dependencies == 'core,optional' }} run: | - cd marimo - . .venv/bin/activate - # make sure that we use the .venv when running tests, so that - # the local narwhals install is picked up - sed -i '/^\[tool.hatch.envs.default\]/a path = ".venv"' pyproject.toml - hatch run python -c "import narwhals; print(narwhals.__file__)" - hatch run test-optional:test-narwhals + cd marimo + . .venv/bin/activate + # make sure that we use the .venv when running tests, so that + # the local narwhals install is picked up + sed -i '/^\[tool.hatch.envs.default\]/a path = ".venv"' pyproject.toml + hatch run python -c "import narwhals; print(narwhals.__file__)" + hatch run test-optional:test-narwhals timeout-minutes: 15 scikit-lego: @@ -138,18 +138,18 @@ jobs: run: uv pip install --upgrade tox virtualenv setuptools --system - name: install-scikit-lego-dev run: | - cd scikit-lego - uv pip install -e ".[test]" --system + cd scikit-lego + uv pip install -e ".[test]" --system - name: install-narwhals-dev run: | - uv pip uninstall narwhals --system - uv pip install -e . --system + uv pip uninstall narwhals --system + uv pip install -e . --system - name: show-deps run: uv pip freeze - name: Run pytest run: | - cd scikit-lego - pytest -n auto --disable-warnings --cov=sklego -m "not cvxpy and not formulaic and not umap" + cd scikit-lego + pytest -n auto --disable-warnings --cov=sklego -m "not cvxpy and not formulaic and not umap" shiny: strategy: @@ -171,28 +171,28 @@ jobs: cache-dependency-glob: "pyproject.toml" - name: clone-shiny run: | - git clone https://github.com/posit-dev/py-shiny.git - cd py-shiny - git log + git clone https://github.com/posit-dev/py-shiny.git + cd py-shiny + git log - name: install-basics run: uv pip install --upgrade tox virtualenv setuptools --system - name: install-shiny-dev env: UV_SYSTEM_PYTHON: 1 run: | - cd py-shiny - make narwhals-install-shiny + cd py-shiny + make narwhals-install-shiny - name: install-narwhals-dev run: | - uv pip uninstall narwhals --system - uv pip install -e . --system + uv pip uninstall narwhals --system + uv pip install -e . --system - name: show-deps run: uv pip freeze - name: Run `make narwhals-test-integration` run: | - cd py-shiny - make narwhals-test-integration - + cd py-shiny + make narwhals-test-integration + tea-tasting: strategy: matrix: @@ -203,9 +203,9 @@ jobs: - uses: actions/checkout@v4 - name: clone-tea-tasting run: | - git clone https://github.com/e10v/tea-tasting.git --depth=1 - cd tea-tasting - git log + git clone https://github.com/e10v/tea-tasting.git --depth=1 + cd tea-tasting + git log - name: install-pdm uses: pdm-project/setup-pdm@v4 with: @@ -214,22 +214,22 @@ jobs: cache-dependency-path: tea-tasting/pdm.lock - name: install-tea-tasting-test run: | - cd tea-tasting - pdm sync -G test + cd tea-tasting + pdm sync -G test - name: install-narwhals-dev run: | - cd tea-tasting - pdm remove narwhals - pdm add ./..[dev] + cd tea-tasting + pdm remove narwhals + pdm add ./..[dev] - name: show-deps run: | - cd tea-tasting - pdm list + cd tea-tasting + pdm list - name: run-pytest run: | - cd tea-tasting - pdm run test - + cd tea-tasting + pdm run test + tubular: strategy: matrix: @@ -250,25 +250,25 @@ jobs: cache-dependency-glob: "pyproject.toml" - name: clone-tubular run: | - git clone https://github.com/lvgig/tubular --depth=1 - cd tubular - git log + git clone https://github.com/lvgig/tubular --depth=1 + cd tubular + git log - name: install-basics run: uv pip install --upgrade tox virtualenv setuptools pytest-env --system - name: install-tubular-dev run: | - cd tubular - uv pip install -e ".[dev]" --system + cd tubular + uv pip install -e ".[dev]" --system - name: install-narwhals-dev run: | - uv pip uninstall narwhals --system - uv pip install -e . --system + uv pip uninstall narwhals --system + uv pip install -e . --system - name: show-deps run: uv pip freeze - name: Run pytest run: | - cd tubular - pytest tests --config-file=pyproject.toml + cd tubular + pytest tests --config-file=pyproject.toml plotly: strategy: @@ -290,25 +290,25 @@ jobs: cache-dependency-glob: "pyproject.toml" - name: clone-plotly run: | - git clone https://github.com/plotly/plotly.py --depth=1 - cd plotly.py - git log + git clone https://github.com/plotly/plotly.py --depth=1 + cd plotly.py + git log - name: install-basics run: uv pip install --upgrade tox virtualenv setuptools --system - name: install-deps run: | - cd plotly.py - uv pip install -r packages/python/plotly/test_requirements/requirements_312_optional.txt --system + cd plotly.py + uv pip install -r packages/python/plotly/test_requirements/requirements_312_optional.txt --system - name: install-narwhals-dev run: | - uv pip uninstall narwhals --system - uv pip install -e . --system + uv pip uninstall narwhals --system + uv pip install -e . --system - name: show-deps run: uv pip freeze - name: Run pytest on plotly express run: | - cd plotly.py - pytest packages/python/plotly/plotly/tests/test_optional/test_px + cd plotly.py + pytest packages/python/plotly/plotly/tests/test_optional/test_px hierarchicalforecast: strategy: @@ -330,22 +330,65 @@ jobs: cache-dependency-glob: "pyproject.toml" - name: clone-hierarchicalforecast run: | - git clone https://github.com/Nixtla/hierarchicalforecast --depth=1 - cd hierarchicalforecast - git log + git clone https://github.com/Nixtla/hierarchicalforecast --depth=1 + cd hierarchicalforecast + git log - name: install-basics run: uv pip install --upgrade tox virtualenv setuptools --system - name: install-deps run: | - cd hierarchicalforecast - uv pip install --system ".[dev]" + cd hierarchicalforecast + uv pip install --system ".[dev]" - name: install-narwhals-dev run: | - uv pip uninstall narwhals --system - uv pip install -e . --system + uv pip uninstall narwhals --system + uv pip install -e . --system - name: show-deps run: uv pip freeze - name: Run tests run: | - cd hierarchicalforecast - nbdev_test --do_print --timing --n_workers 0 + cd hierarchicalforecast + nbdev_test --do_print --timing --n_workers 0 + + formulaic: + strategy: + matrix: + python-version: ["3.12"] + os: [ubuntu-latest] + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + enable-cache: "true" + cache-suffix: ${{ matrix.python-version }} + cache-dependency-glob: "pyproject.toml" + - name: clone-formulaic + run: | + git clone https://github.com/matthewwardrop/formulaic.git --depth=1 + cd formulaic + git log + - name: create-hatch-env + run: | + cd formulaic + uv pip install hatch hatch-vcs --system + - name: install-formulaic-dev + run: | + cd formulaic + hatch run uv pip install -e ".[arrow,calculus]" + - name: install-narwhals-dev + run: | + cd formulaic + hatch run uv pip uninstall narwhals + hatch run uv pip install -e ./.. + - name: show-deps + run: hatch run uv pip freeze + - name: run test + run: | + cd formulaic + hatch run tests --config-file=pyproject.toml