File: python-publish-release.yml

package info (click to toggle)
capstone 5.0.7-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 58,212 kB
  • sloc: ansic: 96,103; cpp: 67,489; cs: 29,510; python: 25,829; pascal: 24,412; java: 15,582; ml: 14,473; makefile: 1,274; sh: 479; ruby: 386
file content (103 lines) | stat: -rw-r--r-- 3,150 bytes parent folder | download | duplicates (3)
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
name: RELEASE BUILD - PyPI 📦 Distribution

on: [push, pull_request, release, workflow_dispatch]

jobs:
  build_wheels:
    name: Build wheels on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
    steps:
      - uses: actions/checkout@v4

      - name: Set up MSVC x64
        if: matrix.os == 'windows-latest'
        uses: ilammy/msvc-dev-cmd@v1

      - name: Set up QEMU
        if: runner.os == 'Linux'
        uses: docker/setup-qemu-action@v3
        with:
          platforms: all
          # Temporary fix due to
          # https://github.com/pypa/cibuildwheel/issues/2257
          # https://github.com/docker/setup-qemu-action/issues/188
          # https://github.com/tonistiigi/binfmt/issues/215
          image: tonistiigi/binfmt:qemu-v8.1.5

      - name: Build wheels
        uses: pypa/cibuildwheel@v2.20.0
        env:
          CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
          CIBW_ARCHS_LINUX: "x86_64 i686 aarch64" # ppc64le s390x really slow
          CIBW_ARCHS_WINDOWS: "AMD64" # ARM64  Seems ARM64 will rebuild amd64 wheel for unknow reason.
          CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*"
          CIBW_SKIP: ""
        with:
          package-dir: bindings/python

      - uses: actions/upload-artifact@v4
        with:
          path: ./wheelhouse/*.whl
          name: artifacts-${{ matrix.os }}

      - name: Check binaries (Windows)
        if: matrix.os == 'windows-latest'
        run: |
          python3.exe suite/check_wheel_bin_arch.py ./wheelhouse/

      - name: Check binaries (Unix)
        if: matrix.os != 'windows-latest'
        run: |
          ./suite/check_wheel_bin_arch.py ./wheelhouse/

  make_sdist:
    name: Make SDist
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
      with:
        fetch-depth: 0  # Optional, use if you use setuptools_scm
        submodules: true  # Optional, use if you have submodules

    - name: Build SDist
      run: |
        cd bindings/python
        pipx run build --sdist

    - name: Test build with sdist
      run: |
        TMP_DIR=$(mktemp -d)
        tar -xf bindings/python/dist/*.tar.gz -C $TMP_DIR/
        cd $TMP_DIR/*/src
        cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCAPSTONE_BUILD_TESTS=OFF -DCAPSTONE_BUILD_CSTOOL=OFF -B build
        cmake --build build

    - uses: actions/upload-artifact@v4
      with:
        path: bindings/python/dist/*.tar.gz

  publish:
    needs: [build_wheels]
    runs-on: ubuntu-latest
    if: github.event_name == 'release' && github.event.prerelease == false && github.event.action == 'published'
    permissions:
      id-token: write
    steps:
      - uses: actions/download-artifact@v4
        with:
          merge-multiple: true
          path: dist

      - name: Show downloaded artifacts
        run: ls -laR dist

      - name: Publish distribution 📦 to PyPI
        if: ${{ success() }}
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          verbose: true
          user: __token__
          password: ${{ secrets.pypi_pass }}