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

kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-go.git


The following commit(s) were added to refs/heads/main by this push:
     new abf0dd8  GH-9: Add test CI: Debian + CGO + Python (#117)
abf0dd8 is described below

commit abf0dd8eb7608ed78cb6a0ed8dfe145aa4eb6caa
Author: Raúl Cumplido <[email protected]>
AuthorDate: Wed Sep 11 01:56:01 2024 +0200

    GH-9: Add test CI: Debian + CGO + Python (#117)
    
    Fix GH-9
    
    This part:
    
https://github.com/apache/arrow/blob/58415d1fac50cb829b3dcf08526033d6db8c30db/.github/workflows/go.yml#L233-L270
    
    ---------
    
    Co-authored-by: Sutou Kouhei <[email protected]>
---
 .github/workflows/test.yml             | 40 +++++++++++++++++++++++++++
 ci/docker/debian-cgo-python.dockerfile | 34 +++++++++++++++++++++++
 ci/scripts/cgo_python_test.sh          | 49 ++++++++++++++++++++++++++++++++++
 compose.yaml                           | 19 +++++++++++++
 4 files changed, 142 insertions(+)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 882546b..2f10275 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -129,6 +129,46 @@ jobs:
         continue-on-error: true
         run: |
           docker compose push debian-cgo
+  docker-cgo-python:
+    name: AMD64 Debian 12 Go ${{ matrix.go }} - CGO Python
+    runs-on: ubuntu-latest
+    timeout-minutes: 15
+    strategy:
+      fail-fast: false
+      matrix:
+        go:
+          - '1.22'
+          - '1.23'
+    env:
+      GO: ${{ matrix.go }}
+    steps:
+      - name: Checkout
+        uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # 
v4.1.7
+        with:
+          submodules: recursive
+      - name: Login to GitHub Container registry
+        uses: docker/login-action@v3
+        with:
+          registry: ghcr.io
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+      - name: Pull
+        run: |
+          docker compose pull debian || :
+          docker compose pull debian-cgo-python || :
+      - name: Build
+        run: |
+          docker compose build debian
+          docker compose build debian-cgo-python
+      - name: Test
+        run: |
+          docker compose run debian-cgo-python
+      - name: Push
+        if: >-
+          success() && github.event_name == 'push' && github.repository == 
'apache/arrow-go' && github.ref_name == 'main'
+        continue-on-error: true
+        run: |
+          docker compose push debian-cgo-python
   macos:
     name: AMD64 macOS 12 Go ${{ matrix.go }}
     runs-on: macos-12
diff --git a/ci/docker/debian-cgo-python.dockerfile 
b/ci/docker/debian-cgo-python.dockerfile
new file mode 100644
index 0000000..a24955f
--- /dev/null
+++ b/ci/docker/debian-cgo-python.dockerfile
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+ARG base
+FROM ${base}
+
+ENV DEBIAN_FRONTEND noninteractive
+
+# Install python3 and pip so we can install pyarrow to test the C data 
interface.
+RUN apt-get update -y -q && \
+    apt-get install -y -q --no-install-recommends \
+        python3 \
+        python3-pip \
+        python3-venv && \
+    apt-get clean
+
+ENV ARROW_PYTHON_VENV /arrow-dev
+RUN python3 -m venv ${ARROW_PYTHON_VENV} && \
+    . ${ARROW_PYTHON_VENV}/bin/activate && \
+    pip install pyarrow cffi --only-binary pyarrow
diff --git a/ci/scripts/cgo_python_test.sh b/ci/scripts/cgo_python_test.sh
new file mode 100755
index 0000000..df0a671
--- /dev/null
+++ b/ci/scripts/cgo_python_test.sh
@@ -0,0 +1,49 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -eux
+
+source_dir=${1}
+
+if [ -n "${ARROW_PYTHON_VENV:-}" ]; then
+  # shellcheck disable=SC1091
+  . "${ARROW_PYTHON_VENV}/bin/activate"
+fi
+
+export GOFLAGS="${GOFLAGS:-} -gcflags=all=-d=checkptr"
+
+pushd "${source_dir}/arrow/cdata/test"
+
+case "$(uname)" in
+MINGW*)
+  testlib="cgotest.dll"
+  ;;
+*)
+  testlib="cgotest.so"
+  ;;
+esac
+
+go build -tags cdata_test,assert -buildmode=c-shared -o "${testlib}" .
+
+python test_export_to_cgo.py
+
+rm "${testlib}"
+rm "${testlib%.*}.h"
+
+popd
diff --git a/compose.yaml b/compose.yaml
index 42d306b..4a82f87 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -64,3 +64,22 @@ services:
     environment:
       ARROW_GO_TESTCGO: "1"
     command: *go-command
+  debian-cgo-python:
+    # Usage:
+    #   docker compose build debian
+    #   docker compose build debian-cgo-python
+    #   docker compose run debian-cgo-python
+    image: ${REPO}:${ARCH}-debian-${GO}-cgo-python
+    build:
+      context: .
+      dockerfile: ci/docker/debian-cgo-python.dockerfile
+      cache_from:
+        - ${REPO}:${ARCH}-debian-${GO}-cgo-python
+      args:
+        base: ${REPO}:${ARCH}-debian-${DEBIAN}-${GO}
+    shm_size: *shm-size
+    volumes: *debian-volumes
+    command: &cgo-python-command |
+      /bin/bash -c " \
+        git config --global --add safe.directory /arrow-go && \
+        /arrow-go/ci/scripts/cgo_python_test.sh /arrow-go"

Reply via email to