Add test matrix for Python versions

master
Maxime Mouial 2018-12-07 15:16:52 -07:00
parent f71adb9d2c
commit 9f789a3eb3
3 changed files with 64 additions and 0 deletions

43
.circleci/config.yml Normal file
View File

@ -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

18
test/main.go Normal file
View File

@ -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)
}

3
test/test.py Normal file
View File

@ -0,0 +1,3 @@
import sys
print(sys.version)