From 52d5efab19e710242d8697cdee2cb9afc68aaff1 Mon Sep 17 00:00:00 2001 From: LJ Date: Wed, 21 May 2025 17:35:46 -0700 Subject: [PATCH 1/6] build(mypy): run mypy in CI workflow --- .github/workflows/_test.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml index 49247cb7c..3b4424c42 100644 --- a/.github/workflows/_test.yml +++ b/.github/workflows/_test.yml @@ -30,16 +30,25 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: 'pip' + - name: Setup venv + run: | + python -m venv .venv - uses: actions/cache@v4 with: path: .venv key: ${{ runner.os }}-pythonenv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} restore-keys: | ${{ runner.os }}-pythonenv-${{ matrix.python-version }}- - - name: Python build & test + - name: Install toolchains run: | - python -m venv .venv source .venv/bin/activate - pip install maturin pytest + pip install maturin pytest mypy + - name: Build + run: | maturin develop + - name: Type check + run: | + mypy python + - name: Test + run: | pytest python/cocoindex/tests \ No newline at end of file From aa56f3ca9e78096a0cadb496cfce8cb739dbf992 Mon Sep 17 00:00:00 2001 From: LJ Date: Wed, 21 May 2025 17:37:43 -0700 Subject: [PATCH 2/6] build: no longer run build in CI workflow --- .github/workflows/CI.yml | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f321b31ba..10a820be5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -26,26 +26,6 @@ permissions: contents: read jobs: - build: - runs-on: ${{ matrix.platform.runner }} - strategy: - matrix: - platform: - - { os: linux, runner: ubuntu-24.04, target: x86_64, container: "ghcr.io/rust-cross/manylinux_2_28-cross:x86_64" } - - { os: macos, runner: macos-15, target: aarch64 } - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.platform.target }} - args: --release --out dist --find-interpreter - sccache: 'true' - manylinux: auto - container: ${{ matrix.platform.container }} test: name: Run test uses: ./.github/workflows/_test.yml From 47d2230fec2ca9b55dee845b325579727850c267 Mon Sep 17 00:00:00 2001 From: LJ Date: Wed, 21 May 2025 17:40:38 -0700 Subject: [PATCH 3/6] fix: always `source .venv/bin/activate` before each step --- .github/workflows/_test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml index 3b4424c42..e20483c31 100644 --- a/.github/workflows/_test.yml +++ b/.github/workflows/_test.yml @@ -45,10 +45,13 @@ jobs: pip install maturin pytest mypy - name: Build run: | + source .venv/bin/activate maturin develop - name: Type check run: | + source .venv/bin/activate mypy python - name: Test run: | + source .venv/bin/activate pytest python/cocoindex/tests \ No newline at end of file From 7e9ce2e41db19106799a9659eac0e688c8be956e Mon Sep 17 00:00:00 2001 From: LJ Date: Wed, 21 May 2025 17:44:07 -0700 Subject: [PATCH 4/6] test: inject a mypy error --- .github/workflows/_test.yml | 4 ++-- python/cocoindex/cli.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml index e20483c31..c3e5909af 100644 --- a/.github/workflows/_test.yml +++ b/.github/workflows/_test.yml @@ -47,11 +47,11 @@ jobs: run: | source .venv/bin/activate maturin develop - - name: Type check + - name: Type check (mypy) run: | source .venv/bin/activate mypy python - - name: Test + - name: Run tests run: | source .venv/bin/activate pytest python/cocoindex/tests \ No newline at end of file diff --git a/python/cocoindex/cli.py b/python/cocoindex/cli.py index 01ce9f09b..55cf63319 100644 --- a/python/cocoindex/cli.py +++ b/python/cocoindex/cli.py @@ -177,7 +177,8 @@ def ls(app_target: str | None): click.echo("No persisted flow setups found in the backend.") return - for name in sorted(persisted_flow_names): + persisted_flow_names = set(persisted_flow_names) + for name in persisted_flow_names: click.echo(name) @cli.command() From 412d5cb9c10f664530f6e209fbe1852021fa84cf Mon Sep 17 00:00:00 2001 From: LJ Date: Wed, 21 May 2025 17:47:30 -0700 Subject: [PATCH 5/6] test: revert prevsious injected error --- python/cocoindex/cli.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python/cocoindex/cli.py b/python/cocoindex/cli.py index 55cf63319..01ce9f09b 100644 --- a/python/cocoindex/cli.py +++ b/python/cocoindex/cli.py @@ -177,8 +177,7 @@ def ls(app_target: str | None): click.echo("No persisted flow setups found in the backend.") return - persisted_flow_names = set(persisted_flow_names) - for name in persisted_flow_names: + for name in sorted(persisted_flow_names): click.echo(name) @cli.command() From 564525c23f4622aec029d11a17bf5f9901cb76a2 Mon Sep 17 00:00:00 2001 From: LJ Date: Wed, 21 May 2025 17:49:05 -0700 Subject: [PATCH 6/6] style: minor words adjustment for workflow --- .github/workflows/_test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml index c3e5909af..715ba6b21 100644 --- a/.github/workflows/_test.yml +++ b/.github/workflows/_test.yml @@ -39,19 +39,19 @@ jobs: key: ${{ runner.os }}-pythonenv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} restore-keys: | ${{ runner.os }}-pythonenv-${{ matrix.python-version }}- - - name: Install toolchains + - name: Install Python toolchains run: | source .venv/bin/activate pip install maturin pytest mypy - - name: Build + - name: Python build run: | source .venv/bin/activate maturin develop - - name: Type check (mypy) + - name: Python type check (mypy) run: | source .venv/bin/activate mypy python - - name: Run tests + - name: Python tests run: | source .venv/bin/activate pytest python/cocoindex/tests \ No newline at end of file