Repository navigation
143 lines (124 loc) · 4.12 KB
/
Copy pathci.yml
File metadata and controls
143 lines (124 loc) · 4.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ '**' ]
env:
TAGS: "-tags=ci"
COVERAGE: "-coverpkg=github.com/go-python/gopy/..."
# Init() in main_test will make sure all backends are available if
# GOPY_TRAVIS_CI is set
GOPY_TRAVIS_CI: 1
GOTRACEBACK: crash
GO111MODULE: auto
jobs:
build:
name: Build (${{ matrix.platform }}, Go ${{ matrix.go-version }}, Python ${{ matrix.python-version }})
strategy:
fail-fast: false
matrix:
# TODO: Consider official support matrix (OS and Go versions) and adjust this matrix accordingly
go-version: [1.25.x, 1.24.x, 1.23.x, 1.22.x]
platform: [ubuntu-latest, windows-latest, macos-15]
python-version: ['3.11', '3.12']
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Install Linux packages
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install curl libffi-dev python3-cffi python3-pip
# install pybindgen
python3 -m pip install --user -U pybindgen
# install goimports
go install golang.org/x/tools/cmd/goimports@latest
- name: Install macOS packages
if: startsWith(matrix.platform, 'macos-')
run: |
python3 -m pip install -U pybindgen
go install golang.org/x/tools/cmd/goimports@latest
- name: Install Windows packages
if: matrix.platform == 'windows-latest'
run: |
# install pybindgen and psutil (for memory tracking in tests)
python -m pip install -U pybindgen psutil
# install goimports
go install golang.org/x/tools/cmd/goimports@latest
- name: Build-Linux
if: matrix.platform == 'ubuntu-latest'
run: |
make
- name: Test Linux
if: matrix.platform == 'ubuntu-latest'
run: |
make test
- name: Build-macOS
if: startsWith(matrix.platform, 'macos-')
run: |
make
- name: Test macOS
if: startsWith(matrix.platform, 'macos-')
run: |
make test
- name: Build-Windows
if: matrix.platform == 'windows-latest'
run: |
go build -v ./...
- name: Test Windows
if: matrix.platform == 'windows-latest'
run: |
go test -v ./...
- name: Upload-Coverage
if: matrix.platform == 'ubuntu-latest'
uses: codecov/codecov-action@v4
# Builds and tests the opt-in cffi backend (GOPY_BACKEND=cffi). Runs beside
# the main matrix, on one Go version, and stops at the first failure.
cffi:
name: cffi backend (${{ matrix.platform }}, Python ${{ matrix.python-version }})
strategy:
fail-fast: true
matrix:
platform: [ubuntu-latest, windows-latest, macos-15]
python-version: ['3.11', '3.12']
runs-on: ${{ matrix.platform }}
env:
GOPY_BACKEND: cffi
# print the python stack if the process crashes, e.g. at exit
PYTHONFAULTHANDLER: 1
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: .github/requirements-cffi.txt
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.25.x
cache: true
- name: Install packages
run: |
python -m pip install -r .github/requirements-cffi.txt
go install golang.org/x/tools/cmd/goimports@v0.29.0
- name: Build
run: go build -v ./...
# The skipped tests use features the cffi backend does not support yet:
# Python callback arguments (TestBindFuncs), complex numbers as a plain
# function arg/return (TestBindSimple) or slice element (TestBuiltinSlices).
- name: Test
run: go test -v -skip '^(TestBindFuncs|TestBindSimple|TestBuiltinSlices)$' ./...