Skip to content

Commit

Permalink
apacheGH-9: Add test CI: Debian + CGO + Python
Browse files Browse the repository at this point in the history
  • Loading branch information
raulcd committed Sep 10, 2024
1 parent 3efb5f8 commit 234c129
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions ci/docker/debian-12-cgo-python.dockerfile
Original file line number Diff line number Diff line change
@@ -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
51 changes: 51 additions & 0 deletions ci/scripts/go_cgo_python_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/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 -ex

source_dir=${1}

if [ -n "${ARROW_PYTHON_VENV:-}" ]; then
. "${ARROW_PYTHON_VENV}/bin/activate"
fi

export GOFLAGS="${GOFLAGS} -gcflags=all=-d=checkptr"

pushd ${source_dir}/arrow/cdata/test

case "$(uname)" in
Linux)
testlib="cgotest.so"
;;
Darwin)
testlib="cgotest.so"
;;
MINGW*)
testlib="cgotest.dll"
;;
esac

go build -tags cdata_test,assert -buildmode=c-shared -buildvcs=false -o $testlib .

python test_export_to_cgo.py

rm $testlib
rm "${testlib%.*}.h"

popd
18 changes: 18 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,21 @@ services:
environment:
ARROW_GO_TESTCGO: "1"
command: *go-command
debian-cgo-python:
# Usage:
# docker compose build debian-cgo-python
# docker compose run debian-cgo-python
image: ${REPO}:${ARCH}-debian-${DEBIAN}-${GO}-cgo-python
build:
context: .
dockerfile: ci/docker/debian-${DEBIAN}-cgo-python.dockerfile
cache_from:
- ${REPO}:${ARCH}-debian-${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 &&
/arrow-go/ci/scripts/go_cgo_python_test.sh /arrow-go"

0 comments on commit 234c129

Please sign in to comment.