diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c5397184..f321b31b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -12,14 +12,14 @@ on: - src/** - python/** - "*.toml" - - ".github/workflows/CI.yml" + - ".github/workflows/*.yml" push: branches: [main] paths: - src/** - python/** - "*.toml" - - ".github/workflows/CI.yml" + - ".github/workflows/*.yml" workflow_dispatch: permissions: @@ -46,3 +46,6 @@ jobs: sccache: 'true' manylinux: auto container: ${{ matrix.platform.container }} + test: + name: Run test + uses: ./.github/workflows/_test.yml diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml new file mode 100644 index 00000000..c2716b62 --- /dev/null +++ b/.github/workflows/_test.yml @@ -0,0 +1,43 @@ +name: Run Tests + +on: + workflow_call: + +env: + CARGO_TERM_COLOR: always + +jobs: + rust: + strategy: + matrix: + python-version: [3.11, 3.13] + platform: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v4 + + - run: rustup toolchain install stable --profile minimal + - name: Rust Cache + uses: Swatinem/rust-cache@v2.7.3 + - name: Rust build + run: cargo build --verbose + - name: Rust tests + run: cargo test --verbose + + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + - 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 + run: | + python -m venv .venv + source .venv/bin/activate + pip install maturin pytest + maturin develop + pytest python/cocoindex/tests \ No newline at end of file