From 9f789a3eb3b576989078b47e81f801d29e7153ab Mon Sep 17 00:00:00 2001 From: Maxime Mouial Date: Fri, 7 Dec 2018 15:16:52 -0700 Subject: [PATCH] Add test matrix for Python versions --- .circleci/config.yml | 43 +++++++++++++++++++++++++++++++++++++++++++ test/main.go | 18 ++++++++++++++++++ test/test.py | 3 +++ 3 files changed, 64 insertions(+) create mode 100644 .circleci/config.yml create mode 100644 test/main.go create mode 100644 test/test.py diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..1b71f53 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,43 @@ +version: 2 + +templates: + job_template: &job_template + working_directory: /go/src/github.com/DataDog/go-python3 + docker: + - image: golang:1.11.2 + +jobs: + python3.5: + <<: *job_template + steps: + - checkout + - run: echo "deb http://deb.debian.org/debian unstable main" >> /etc/apt/sources.list + - run: apt-get update && apt-get install -y python3.5-dev + - run: cp /usr/lib/x86_64-linux-gnu/pkgconfig/python-3.5.pc /usr/lib/x86_64-linux-gnu/pkgconfig/python3.pc + - run: cd test && go build && ./test + + python3.6: + <<: *job_template + steps: + - checkout + - run: echo "deb http://deb.debian.org/debian unstable main" >> /etc/apt/sources.list + - run: apt-get update && apt-get install -y python3.6-dev + - run: cp /usr/lib/x86_64-linux-gnu/pkgconfig/python-3.6.pc /usr/lib/x86_64-linux-gnu/pkgconfig/python3.pc + - run: cd test && go build && ./test + + python3.7: + <<: *job_template + steps: + - checkout + - run: echo "deb http://deb.debian.org/debian unstable main" >> /etc/apt/sources.list + - run: apt-get update && apt-get install -y python3.7-dev + - run: cp /usr/lib/x86_64-linux-gnu/pkgconfig/python-3.7.pc /usr/lib/x86_64-linux-gnu/pkgconfig/python3.pc + - run: cd test && go build && ./test + +workflows: + version: 2 + build_test_deploy: + jobs: + - python3.5 + - python3.6 + - python3.7 diff --git a/test/main.go b/test/main.go new file mode 100644 index 0000000..8c8fbe9 --- /dev/null +++ b/test/main.go @@ -0,0 +1,18 @@ +package main + +/* +#cgo pkg-config: python3 +#include "Python.h" +*/ +import "C" + +import ( + "fmt" + python "github.com/DataDog/go-python3" +) + +func main() { + C.Py_Initialize() + ret, err := python.PyRun_AnyFile("test.py") + fmt.Printf("%d %v\n", ret, err) +} diff --git a/test/test.py b/test/test.py new file mode 100644 index 0000000..cfdbc6d --- /dev/null +++ b/test/test.py @@ -0,0 +1,3 @@ +import sys + +print(sys.version)