This is an automated email from the ASF dual-hosted git repository.

xushiyan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hudi-rs.git


The following commit(s) were added to refs/heads/main by this push:
     new 36316e0  ci: merge python code coverage report with rust (#67)
36316e0 is described below

commit 36316e083e7f7716abceb8f49e8bdc76e16e5b0f
Author: Shiyan Xu <[email protected]>
AuthorDate: Sat Jul 20 03:01:26 2024 -0500

    ci: merge python code coverage report with rust (#67)
---
 .github/workflows/ci.yml | 79 +++++++++++++++++++++++++++++++++++++++++++-----
 python/pyproject.toml    |  3 +-
 2 files changed, 73 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 16913b1..cddc006 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -40,19 +40,82 @@ jobs:
       - name: Check code style
         run: cd python && make check-rust
 
-  test:
-    runs-on: ubuntu-latest
+  rust-tests:
+    strategy:
+      fail-fast: false
+      matrix:
+        # TODO: add windows which does not support container
+        os: [ ubuntu-22.04 ]
+    runs-on: ${{ matrix.os }}
     container:
-      image: xd009642/tarpaulin:0.29.1
+      image: xd009642/tarpaulin:0.30.0
       options: --security-opt seccomp=unconfined
     steps:
       - uses: actions/checkout@v4
-      - name: Unit test with code coverage
+      - name: Rust unit tests with coverage report
         # 
https://github.com/xd009642/tarpaulin/issues/1092#issuecomment-1407739176
-        run: cargo tarpaulin --engine llvm --no-dead-code --no-fail-fast 
--all-features --workspace --out xml
-      - name: Upload coverage reports to Codecov
+        run: cargo tarpaulin --engine llvm --no-dead-code --no-fail-fast 
--all-features --workspace -o xml --output-dir ./cov-reports
+      - name: Upload coverage report
+        uses: actions/upload-artifact@v4
+        with:
+          name: cov-report-rust-tests-${{ runner.os }}
+          path: ./cov-reports
+          if-no-files-found: 'error'
+
+  python-tests:
+    strategy:
+      fail-fast: false
+      matrix:
+        # TODO: add windows
+        os: [ ubuntu-22.04, macos-14 ]
+        python-version: [ '3.8', '3.12' ]
+        exclude:
+          - os: macos-14
+            python-version: '3.8'
+    runs-on: ${{ matrix.os }}
+    steps:
+      - uses: actions/checkout@v4
+      - name: Set up Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v5
+        with:
+          python-version: ${{ matrix.python-version }}
+          cache: pip
+          cache-dependency-path: pyproject.toml
+      - name: Setup Python venv
+        working-directory: ./python
+        run: |
+          make setup-venv
+          source venv/bin/activate
+          make develop
+      - name: Python unit tests with coverage report
+        run: |
+          pushd python
+          source venv/bin/activate
+          coverage run --include 'hudi/*' -m pytest -v
+          # move to parent so the reported file paths will match the actual 
repo paths
+          popd
+          coverage xml --data-file=python/.coverage -o 
./cov-reports/cov-report-python-tests-${{ join(matrix.*, '-') }}.xml
+      - name: Upload coverage report
+        uses: actions/upload-artifact@v4
+        with:
+          name: cov-report-python-tests-${{ join(matrix.*, '-') }}
+          path: ./cov-reports
+          if-no-files-found: 'error'
+
+
+  publish-coverage:
+    name: Publish coverage reports to codecov.io
+    runs-on: ubuntu-latest
+    needs: [ rust-tests, python-tests ]
+    steps:
+      - uses: actions/download-artifact@v4
+        with:
+          pattern: cov-report-*
+          merge-multiple: true
+          path: ./cov-reports
+      - name: Upload coverage reports to codecov.io
         uses: codecov/codecov-action@v4
         with:
           fail_ci_if_error: true
-        env:
-          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
+          token: ${{ secrets.CODECOV_TOKEN }}
+          files: ./cov-reports/*
diff --git a/python/pyproject.toml b/python/pyproject.toml
index 36e44d5..36f350e 100644
--- a/python/pyproject.toml
+++ b/python/pyproject.toml
@@ -40,7 +40,8 @@ dependencies = [
 ]
 
 optional-dependencies = { devel = [
-    "pytest"
+    "pytest",
+    "coverage",
 ] }
 
 dynamic = ["version"]

Reply via email to