|
| 1 | +name: Python Package |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + paths: |
| 6 | + - 'pyroscope_ffi/python/**' |
| 7 | + - '.github/workflows/ci-ffi-python.yml' |
| 8 | + branches: |
| 9 | + - '**' |
| 10 | + pull_request: |
| 11 | + paths: |
| 12 | + - 'pyroscope_ffi/python/**' |
| 13 | + - '.github/workflows/ci-ffi-python.yml' |
| 14 | + branches: |
| 15 | + - '**' |
| 16 | + |
| 17 | +jobs: |
| 18 | + linux-build: |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + build-arch: |
| 23 | + - manylinux2010_x86_64 |
| 24 | + |
| 25 | + name: Linux - ${{ matrix.build-arch }} |
| 26 | + runs-on: ubuntu-latest |
| 27 | + |
| 28 | + steps: |
| 29 | + - uses: AutoModality/action-clean@v1 |
| 30 | + - uses: actions/checkout@v2 |
| 31 | + with: |
| 32 | + submodules: recursive |
| 33 | + |
| 34 | + - if: matrix.build-arch == 'manylinux2014_aarch64' |
| 35 | + uses: docker/setup-qemu-action@v1 |
| 36 | + with: |
| 37 | + platforms: arm64 |
| 38 | + |
| 39 | + - name: Build in Docker |
| 40 | + run: pyroscope_ffi/python/scripts/docker.sh |
| 41 | + env: |
| 42 | + BUILD_ARCH: ${{ matrix.build-arch }} |
| 43 | + |
| 44 | + - uses: actions/upload-artifact@v2 |
| 45 | + with: |
| 46 | + name: "linux.whl" |
| 47 | + path: pyroscope_ffi/python/dist/* |
| 48 | + |
| 49 | + linux-test: |
| 50 | + strategy: |
| 51 | + fail-fast: false |
| 52 | + matrix: |
| 53 | + PYROSCOPE_DETECT_SUBPROCESSES: [1, 0] |
| 54 | + PYROSCOPE_ONCPU: [1, 0] |
| 55 | + PYROSCOPE_GIL_ONLY: [1, 0] |
| 56 | + PYROSCOPE_NATIVE: [1, 0] |
| 57 | + PYTHON_VERSION: ['2.7', '3.7', '3.8', '3.9', '3.10'] |
| 58 | + needs: ['linux-build'] |
| 59 | + name: Linux Test |
| 60 | + runs-on: ubuntu-latest |
| 61 | + steps: |
| 62 | + - name: Set up Python |
| 63 | + uses: actions/setup-python@v4 |
| 64 | + with: |
| 65 | + python-version: ${{ matrix.PYTHON_VERSION }} |
| 66 | + architecture: x64 |
| 67 | + - uses: actions/download-artifact@master |
| 68 | + with: |
| 69 | + name: "linux.whl" |
| 70 | + path: "${{github.workspace}}/python" |
| 71 | + |
| 72 | + - run: "cd ${{ github.workspace }}/python && ls -l" |
| 73 | + - run: "cd ${{ github.workspace }}/python && pip install *.whl" |
| 74 | + - uses: actions/checkout@v2 |
| 75 | + with: |
| 76 | + submodules: recursive |
| 77 | + - name: Run Python Script |
| 78 | + run: pyroscope_ffi/python/scripts/tests/test.py |
| 79 | + env: |
| 80 | + PYROSCOPE_RUN_ID: ${{ github.run_id }} |
| 81 | + PYROSCOPE_ARCH: x86-64-linux |
| 82 | + PYROSCOPE_API_TOKEN: ${{ secrets.PYROSCOPE_API_TOKEN }} |
| 83 | + PYROSCOPE_DETECT_SUBPROCESSES: ${{ matrix.PYROSCOPE_DETECT_SUBPROCESSES }} |
| 84 | + PYROSCOPE_ONCPU: ${{ matrix.PYROSCOPE_ONCPU }} |
| 85 | + PYROSCOPE_GIL_ONLY: ${{ matrix.PYROSCOPE_GIL_ONLY }} |
| 86 | + PYROSCOPE_NATIVE: ${{ matrix.PYROSCOPE_NATIVE }} |
| 87 | + PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }} |
| 88 | + |
| 89 | + linux-arm-build: |
| 90 | + strategy: |
| 91 | + fail-fast: false |
| 92 | + matrix: |
| 93 | + build-arch: |
| 94 | + - manylinux2014_aarch64 |
| 95 | + |
| 96 | + name: Linux - ${{ matrix.build-arch }} |
| 97 | + runs-on: [self-hosted, Linux, ARM64] |
| 98 | + |
| 99 | + steps: |
| 100 | + - uses: AutoModality/action-clean@v1 |
| 101 | + - uses: actions/checkout@v2 |
| 102 | + with: |
| 103 | + submodules: recursive |
| 104 | + |
| 105 | + - name: Build in Docker |
| 106 | + run: pyroscope_ffi/python/scripts/docker.sh |
| 107 | + env: |
| 108 | + BUILD_ARCH: ${{ matrix.build-arch }} |
| 109 | + |
| 110 | + - uses: actions/upload-artifact@v2 |
| 111 | + with: |
| 112 | + name: "linux-arm.whl" |
| 113 | + path: pyroscope_ffi/python/dist/* |
| 114 | + |
| 115 | + macos-build: |
| 116 | + strategy: |
| 117 | + fail-fast: false |
| 118 | + matrix: |
| 119 | + include: |
| 120 | + - macos-version: "11.0" |
| 121 | + target: x86_64-apple-darwin |
| 122 | + py-platform: macosx-11_0_x86_64 |
| 123 | + - macos-version: "11.0" |
| 124 | + target: aarch64-apple-darwin |
| 125 | + py-platform: macosx-11_0_arm64 |
| 126 | + |
| 127 | + name: macOS - ${{ matrix.py-platform }} |
| 128 | + runs-on: macos-${{ matrix.macos-version }} |
| 129 | + |
| 130 | + steps: |
| 131 | + - uses: actions/checkout@v2 |
| 132 | + |
| 133 | + - uses: actions-rs/toolchain@v1 |
| 134 | + with: |
| 135 | + toolchain: stable |
| 136 | + target: ${{ matrix.target }} |
| 137 | + profile: minimal |
| 138 | + override: true |
| 139 | + |
| 140 | + - uses: actions/setup-python@v2 |
| 141 | + with: |
| 142 | + python-version: 3.9 |
| 143 | + |
| 144 | + |
| 145 | + - name: Build Wheel |
| 146 | + run: | |
| 147 | + pip install wheel |
| 148 | + python3 setup.py bdist_wheel -p ${{ matrix.py-platform }} |
| 149 | + working-directory: pyroscope_ffi/python |
| 150 | + env: |
| 151 | + CARGO_BUILD_TARGET: ${{ matrix.target }} |
| 152 | + |
| 153 | + - uses: actions/upload-artifact@v2 |
| 154 | + with: |
| 155 | + name: ${{ matrix.target }} |
| 156 | + path: pyroscope_ffi/python/dist/* |
| 157 | + |
| 158 | + macos-intel-test: |
| 159 | + strategy: |
| 160 | + fail-fast: false |
| 161 | + matrix: |
| 162 | + PYROSCOPE_DETECT_SUBPROCESSES: [1, 0] |
| 163 | + PYROSCOPE_ONCPU: [1, 0] |
| 164 | + PYROSCOPE_GIL_ONLY: [1, 0] |
| 165 | + PYROSCOPE_NATIVE: [1, 0] |
| 166 | + PYTHON_VERSION: ['2.7', '3.7', '3.8', '3.9', '3.10'] |
| 167 | + needs: ['macos-build'] |
| 168 | + name: Macos Test |
| 169 | + runs-on: macos-11.0 |
| 170 | + steps: |
| 171 | + - name: Set up Python |
| 172 | + uses: actions/setup-python@v4 |
| 173 | + with: |
| 174 | + python-version: ${{ matrix.PYTHON_VERSION }} |
| 175 | + architecture: x64 |
| 176 | + - uses: actions/download-artifact@master |
| 177 | + with: |
| 178 | + name: x86_64-apple-darwin |
| 179 | + path: "${{github.workspace}}/python" |
| 180 | + |
| 181 | + - run: "python --version" |
| 182 | + - run: "python3 --version" |
| 183 | + - run: "cd ${{ github.workspace }}/python && ls -l" |
| 184 | + - run: "cd ${{ github.workspace }}/python && pip3 install *.whl" |
| 185 | + - uses: actions/checkout@v2 |
| 186 | + with: |
| 187 | + submodules: recursive |
| 188 | + - name: Run Python Script |
| 189 | + run: pyroscope_ffi/python/scripts/tests/test.py |
| 190 | + env: |
| 191 | + PYROSCOPE_RUN_ID: ${{ github.run_id }} |
| 192 | + PYROSCOPE_ARCH: x86-64-apple-darwin |
| 193 | + PYROSCOPE_API_TOKEN: ${{ secrets.PYROSCOPE_API_TOKEN }} |
| 194 | + PYROSCOPE_DETECT_SUBPROCESSES: ${{ matrix.PYROSCOPE_DETECT_SUBPROCESSES }} |
| 195 | + PYROSCOPE_ONCPU: ${{ matrix.PYROSCOPE_ONCPU }} |
| 196 | + PYROSCOPE_GIL_ONLY: ${{ matrix.PYROSCOPE_GIL_ONLY }} |
| 197 | + PYROSCOPE_NATIVE: ${{ matrix.PYROSCOPE_NATIVE }} |
| 198 | + PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }} |
| 199 | + |
| 200 | + sdist-build: |
| 201 | + name: sdist |
| 202 | + runs-on: ubuntu-latest |
| 203 | + |
| 204 | + steps: |
| 205 | + - uses: AutoModality/action-clean@v1 |
| 206 | + - uses: actions/checkout@v2 |
| 207 | + |
| 208 | + - uses: actions/setup-python@v2 |
| 209 | + with: |
| 210 | + python-version: 3.7 |
| 211 | + |
| 212 | + - name: Build sdist |
| 213 | + run: python setup.py sdist |
| 214 | + working-directory: pyroscope_ffi/python |
| 215 | + |
| 216 | + - uses: actions/upload-artifact@v2 |
| 217 | + with: |
| 218 | + name: "sdist.whl" |
| 219 | + path: pyroscope_ffi/python/dist/* |
0 commit comments