A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
dagger: fix backend test (#2652)
Kyle Penfound3688b3651be7
diff --git a/.github/workflows/test_be_dagger.yaml b/.github/workflows/test_be_dagger.yamlnew file mode 100644index 0000000000..8ba94b21ca--- /dev/null+++ b/.github/workflows/test_be_dagger.yaml@@ -0,0 +1,41 @@+name: Test BE Dagger++on:+ push:+ branches: [main]+ pull_request:++jobs:+ changes:+ runs-on: ubuntu-latest+ outputs:+ backend: ${{ steps.filter.outputs.backend }}+ steps:+ - uses: actions/checkout@v4+ - uses: dorny/paths-filter@v3+ id: filter+ with:+ filters: |+ backend:+ - 'marimo/**'+ - 'tests/**'+ - 'pyproject.toml'+ - 'dagger/**'++ test_python:+ needs: changes+ if: ${{ needs.changes.outputs.backend == 'true' }}+ name: Daggerized Backend Test+ runs-on: ubuntu-latest+ timeout-minutes: 15++ steps:+ - name: 🛑 Cancel Previous Runs+ uses: styfle/[email protected]++ - uses: actions/checkout@v4++ - uses: dagger/dagger-for-github@v6+ name: 🚀 Dagger+ with:+ args: backend testdiff --git a/dagger/src/main/backend.py b/dagger/src/main/backend.pyindex df5bea604e..8c76a9bbf7 100644--- a/dagger/src/main/backend.py+++ b/dagger/src/main/backend.py@@ -13,13 +13,25 @@ class Backend:)@function- def test(self) -> dagger.Container:- return (- # python base+ async def test(self) -> dagger.Container:+ env = (Env().py()- .with_directory("/src", self.src)+ .with_directory("/src", self.src, owner="nonroot").with_workdir("/src")+ # from GHA: This step is needed since some of our tests rely on the index.html file+ .with_exec(["mkdir", "-p", "marimo/_static/assets"])+ .with_exec(["cp", "frontend/index.html", "marimo/_static/index.html"])+ .with_exec(["cp", "frontend/public/favicon.ico", "marimo/_static/favicon.ico"]).with_exec(["make", "py"])- .with_exec(["make", "py-test"])+ .with_exec(["hatch", "run", "lint"])+ .with_exec(["hatch", "run", "typecheck:check"]))++ await env.sync()++ # test:test+ await env.with_exec(["hatch", "run", "+py=3.12", "test:test", "-v", "tests/", "-k", "not test_cli"]).sync()++ # test-optional:test+ return env.with_exec(["hatch", "run", "+py=3.12", "test-optional:test", "-v", "tests/", "-k", "not test_cli"])diff --git a/dagger/src/main/env.py b/dagger/src/main/env.pyindex 6045d2d50a..337f371618 100644--- a/dagger/src/main/env.py+++ b/dagger/src/main/env.py@@ -37,9 +37,6 @@ class Env:# python basedag.container().from_("python:3.12-bookworm")- .with_mounted_cache(- "/root/.cache/pip", dag.cache_volume("python-312")- ).with_exec(["apt-get", "update"]).with_exec([@@ -51,7 +48,15 @@ class Env:"python3-gdal",])+ .with_exec(["adduser", "nonroot"])+ .with_mounted_cache(+ "/home/nonroot/.cache/pip", dag.cache_volume("python-312"), owner="nonroot"+ )+ .with_mounted_cache(+ "/home/nonroot/.cache/uv", dag.cache_volume("uv-python-312"), owner="nonroot"+ ).with_exec(["pip", "install", "hatch", "typos"])+ .with_user("nonroot"))@function