Skip to content

Commit df9fc0b

Browse files
authored
fix: build ruby and python in docker (#159)
- build ruby gems and python wheels in docker (as build, not run) on linux, remove docker.sh - move building logic from yaml files to ffi.mk - use cargo workspaces instead of many separate projects
1 parent ff17111 commit df9fc0b

File tree

47 files changed

+1269
-10521
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1269
-10521
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
**/target/
2+
**/pkg/
3+
**/dist/
4+
**/build/
5+
**/*egg-info*/
6+
**/**/Makefile

.github/workflows/ci-ffi-python.yml

Lines changed: 46 additions & 195 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,31 @@ name: Python Package
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [ main ]
66
pull_request:
7-
branches: [main]
7+
branches: [ main ]
88

99
jobs:
1010
linux-build:
11-
strategy:
12-
fail-fast: false
13-
matrix:
14-
build-arch:
15-
- manylinux2014_x86_64
16-
17-
name: Linux - ${{ matrix.build-arch }}
18-
runs-on: ubuntu-latest
11+
name: Linux - amd64
12+
runs-on: ubuntu-latest # TODO try using grafana runners
1913

2014
steps:
21-
- uses: AutoModality/action-clean@v1
2215
- uses: actions/checkout@v3
23-
with:
24-
submodules: recursive
25-
2616
- name: Build in Docker
27-
run: pyroscope_ffi/python/scripts/docker.sh
28-
env:
29-
BUILD_ARCH: ${{ matrix.build-arch }}
17+
run: make wheel/linux/amd64
3018

3119
- uses: actions/upload-artifact@v2
3220
with:
33-
name: "linux.whl"
21+
name: "linux.whl"
3422
path: pyroscope_ffi/python/dist/*
3523

3624
linux-test:
3725
strategy:
3826
fail-fast: false
3927
matrix:
40-
PYTHON_VERSION: [ '3.7', '3.8', '3.9', '3.10'] # todo bring back 2.7, do not rely on gh runners, use docker environment
41-
needs: ['linux-build']
28+
PYTHON_VERSION: [ '3.7', '3.8', '3.9', '3.10', '3.11' ]
29+
needs: [ 'linux-build' ]
4230
name: Linux Test
4331
runs-on: ubuntu-latest
4432
env:
@@ -60,202 +48,29 @@ jobs:
6048
- run: "cd ${{ github.workspace }}/python && ls -l"
6149
- run: "cd ${{ github.workspace }}/python && pip install *.whl"
6250
- uses: actions/checkout@v3
63-
with:
64-
submodules: recursive
6551
- run: docker run -d -p4040:4040 grafana/pyroscope
6652
- run: python pyroscope_ffi/python/scripts/tests/test.py
6753

6854
linux-arm-build:
69-
strategy:
70-
fail-fast: false
71-
matrix:
72-
build-arch:
73-
- manylinux2014_aarch64
74-
75-
name: Linux - ${{ matrix.build-arch }}
55+
name: Linux - arm64
7656
runs-on: [self-hosted, Linux, ARM64]
77-
7857
steps:
7958
- uses: AutoModality/action-clean@v1
8059
- uses: actions/checkout@v3
81-
with:
82-
submodules: recursive
8360
- name: Build in Docker
84-
run: pyroscope_ffi/python/scripts/docker.sh
85-
env:
86-
BUILD_ARCH: ${{ matrix.build-arch }}
61+
run: make wheel/linux/arm64
8762

8863
- uses: actions/upload-artifact@v2
8964
with:
9065
name: "linux-arm.whl"
9166
path: pyroscope_ffi/python/dist/*
9267

93-
# macos-build:
94-
# strategy:
95-
# fail-fast: false
96-
# matrix:
97-
# include:
98-
# - macos-version: "11.0"
99-
# target: x86_64-apple-darwin
100-
# py-platform: macosx-11_0_x86_64
101-
# - macos-version: "11.0"
102-
# target: aarch64-apple-darwin
103-
# py-platform: macosx-11_0_arm64
104-
#
105-
# name: macOS - ${{ matrix.py-platform }}
106-
# runs-on: macos-${{ matrix.macos-version }}
107-
#
108-
# steps:
109-
# - uses: actions/checkout@v3
110-
# with:
111-
# submodules: recursive
112-
#
113-
# - uses: actions-rs/toolchain@v1
114-
# with:
115-
# toolchain: stable
116-
# target: ${{ matrix.target }}
117-
# profile: minimal
118-
# override: true
119-
#
120-
# - uses: actions/setup-python@v4
121-
# with:
122-
# python-version: 3.9
123-
#
124-
#
125-
# - name: Build Wheel
126-
# run: |
127-
# pip install wheel
128-
# python3 setup.py bdist_wheel -p ${{ matrix.py-platform }}
129-
# working-directory: pyroscope_ffi/python
130-
# env:
131-
# CARGO_BUILD_TARGET: ${{ matrix.target }}
132-
#
133-
# - uses: actions/upload-artifact@v2
134-
# with:
135-
# name: ${{ matrix.target }}
136-
# path: pyroscope_ffi/python/dist/*
137-
#
138-
# macos-intel-test:
139-
# strategy:
140-
# fail-fast: false
141-
# matrix:
142-
# PYTHON_VERSION: ['3.7', '3.8', '3.9', '3.10']
143-
# needs: ['macos-build']
144-
# name: Macos Test
145-
# runs-on: macos-11.0
146-
# env:
147-
# PYROSCOPE_RUN_ID: ${{ github.run_id }}
148-
# PYROSCOPE_ARCH: x86-64-apple-darwin
149-
# PYROSCOPE_API_TOKEN: ${{ secrets.PYROSCOPE_API_TOKEN }}
150-
# PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
151-
# steps:
152-
# - name: Set up Python
153-
# uses: actions/setup-python@v4
154-
# with:
155-
# python-version: ${{ matrix.PYTHON_VERSION }}
156-
# architecture: x64
157-
# - uses: actions/download-artifact@master
158-
# with:
159-
# name: x86_64-apple-darwin
160-
# path: "${{github.workspace}}/python"
161-
# - run: "python --version ; pip --version ; python3 --version ; pip3 --version; pip list; uname -a"
162-
# - run: "pip install pip cffi --upgrade"
163-
# - run: "cd ${{ github.workspace }}/python && ls -l"
164-
# - name: Install wheel
165-
# run: "cd ${{ github.workspace }}/python && pip install *.whl"
166-
# env:
167-
# SYSTEM_VERSION_COMPAT: 0
168-
# - uses: actions/checkout@v3
169-
# with:
170-
# submodules: recursive
171-
# - run: python pyroscope_ffi/python/scripts/tests/test.py
172-
173-
174-
# windows-build:
175-
# strategy:
176-
# fail-fast: false
177-
# matrix:
178-
# include:
179-
# - windows-version: "2022"
180-
# target: x86_64-pc-windows-gnu
181-
# py-platform: win_amd64
182-
#
183-
# name: windows - ${{ matrix.py-platform }}
184-
# runs-on: windows-${{ matrix.windows-version }}
185-
#
186-
# steps:
187-
# - uses: actions/checkout@v3
188-
#
189-
# - uses: actions-rs/toolchain@v1
190-
# with:
191-
# toolchain: stable
192-
# target: ${{ matrix.target }}
193-
# profile: minimal
194-
# override: true
195-
#
196-
# - uses: actions/setup-python@v2
197-
# with:
198-
# python-version: 3.9
199-
#
200-
#
201-
# - name: Build Wheel
202-
# run: |
203-
# pip install wheel
204-
# python3 setup.py bdist_wheel -p ${{ matrix.py-platform }}
205-
# working-directory: pyroscope_ffi/python
206-
# env:
207-
# CARGO_BUILD_TARGET: ${{ matrix.target }}
208-
#
209-
# - uses: actions/upload-artifact@v2
210-
# with:
211-
# name: ${{ matrix.target }}
212-
# path: pyroscope_ffi/python/dist/*
213-
#
214-
# windows-test:
215-
# strategy:
216-
# fail-fast: false
217-
# matrix:
218-
# PYTHON_VERSION: ['2.7', '3.7', '3.8', '3.9', '3.10']
219-
# needs: ['windows-build']
220-
# name: Windows Test
221-
# runs-on: windows-2022
222-
# env:
223-
# PYROSCOPE_RUN_ID: ${{ github.run_id }}
224-
# PYROSCOPE_ARCH: x86_64-pc-windows-gnu
225-
# PYROSCOPE_API_TOKEN: ${{ secrets.PYROSCOPE_API_TOKEN }}
226-
# PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
227-
# steps:
228-
# - name: Set up Python
229-
# uses: actions/setup-python@v4
230-
# with:
231-
# python-version: ${{ matrix.PYTHON_VERSION }}
232-
# architecture: x64
233-
# - uses: actions/download-artifact@master
234-
# with:
235-
# name: x86_64-pc-windows-gnu
236-
# path: "${{github.workspace}}/python"
237-
#
238-
# - run: "python --version"
239-
# - run: "python3 --version"
240-
# - run: "cd ${{ github.workspace }}/python && ls"
241-
# - run: |
242-
# cd ${{ github.workspace }}/python
243-
# foreach($file in Get-ChildItem -Filter *.whl){pip install $file}
244-
# - uses: actions/checkout@v3
245-
# with:
246-
# submodules: recursive
247-
# - run: python pyroscope_ffi/python/scripts/tests/test.py
248-
24968
sdist-build:
25069
name: sdist
25170
runs-on: ubuntu-latest
25271

25372
steps:
254-
- uses: AutoModality/action-clean@v1
25573
- uses: actions/checkout@v3
256-
with:
257-
submodules: recursive
258-
25974
- uses: actions/setup-python@v4
26075
with:
26176
python-version: 3.9
@@ -270,3 +85,39 @@ jobs:
27085
with:
27186
name: "sdist.whl"
27287
path: pyroscope_ffi/python/dist/*
88+
89+
macos-build:
90+
strategy:
91+
fail-fast: false
92+
matrix:
93+
include:
94+
- macos-version: "11.0"
95+
target: x86_64-apple-darwin
96+
py-platform: macosx-11_0_x86_64
97+
mk-arch: amd64
98+
- macos-version: "11.0"
99+
target: aarch64-apple-darwin
100+
py-platform: macosx-11_0_arm64
101+
mk-arch: arm64
102+
103+
name: macOS - ${{ matrix.py-platform }}
104+
runs-on: macos-${{ matrix.macos-version }}
105+
106+
steps:
107+
- uses: actions/checkout@v3
108+
- uses: actions-rs/toolchain@v1
109+
with:
110+
toolchain: 1.76.0
111+
target: ${{ matrix.target }}
112+
profile: minimal
113+
override: true
114+
115+
- uses: actions/setup-python@v4
116+
with:
117+
python-version: 3.11
118+
119+
- run: make wheel/mac/${{ matrix.mk-arch }}
120+
- uses: actions/upload-artifact@v2
121+
with:
122+
name: ${{ github.sha }}
123+
path: pyroscope_ffi/python/dist/*

0 commit comments

Comments
 (0)