diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4fcfc06..a3daa9e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -205,6 +205,10 @@ jobs: uses: matrixorigin/CI/actions/seed-go-caches@main with: flavor: race + - name: Prepare Python UDF contract tests + if: ${{ hashFiles('pkg/udf/python/worker/requirements.txt') != '' }} + timeout-minutes: 5 + uses: matrixorigin/CI/actions/setup-python-udf@main - name: Unit Testing id: ut run: | @@ -565,6 +569,10 @@ jobs: echo "bucket=${{ secrets.S3BUCKET }}" >> $GITHUB_ENV # set ut workdir echo "UT_WORKDIR=${{ github.workspace }}" >> $GITHUB_ENV + - name: Prepare Python UDF contract tests + if: ${{ hashFiles('pkg/udf/python/worker/requirements.txt') != '' }} + timeout-minutes: 5 + uses: matrixorigin/CI/actions/setup-python-udf@main - name: Unit Testing run: | cd $GITHUB_WORKSPACE && make clean && make config diff --git a/.github/workflows/coverage-ut.yaml b/.github/workflows/coverage-ut.yaml index 1cf9a75..679fab9 100644 --- a/.github/workflows/coverage-ut.yaml +++ b/.github/workflows/coverage-ut.yaml @@ -171,6 +171,10 @@ jobs: with: setup-java: true go-version-file: "${{ github.workspace }}/go.mod" + - name: Prepare Python UDF contract tests + if: ${{ hashFiles('pkg/udf/python/worker/requirements.txt') != '' }} + timeout-minutes: 5 + uses: matrixorigin/CI/actions/setup-python-udf@main - name: Checkout CI coverage helper timeout-minutes: 5 uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 diff --git a/actions/setup-python-udf/action.yaml b/actions/setup-python-udf/action.yaml new file mode 100644 index 0000000..e8d97c6 --- /dev/null +++ b/actions/setup-python-udf/action.yaml @@ -0,0 +1,20 @@ +name: Set up Python UDF tests +description: Install the checked-out MatrixOne worker contract for host Go tests +runs: + using: composite + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install worker dependencies in a job-owned environment + shell: bash + run: | + set -euo pipefail + udf_venv=$(mktemp -d "$RUNNER_TEMP/python-udf.XXXXXX") + python3 -m venv "$udf_venv" + "$udf_venv/bin/python3" -m pip install --disable-pip-version-check --only-binary=:all: \ + --retries 2 --timeout 30 -r pkg/udf/python/worker/requirements.txt + "$udf_venv/bin/python3" -c 'import sys, pyarrow, pyarrow.flight; print(sys.executable, pyarrow.__version__, pyarrow.__file__)' + # Go tests resolve python3 from PATH; child workers must inherit exactly + # the interpreter into which this step installed the pinned requirements. + echo "$udf_venv/bin" >> "$GITHUB_PATH"