File: python-publish.yml

package info (click to toggle)
rust-capstone-sys 0.17.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 44,524 kB
  • sloc: ansic: 70,376; cs: 18,890; pascal: 14,893; java: 14,778; ml: 13,672; python: 6,145; makefile: 1,172; sh: 532; cpp: 285
file content (80 lines) | stat: -rw-r--r-- 2,694 bytes parent folder | download | duplicates (2)
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
name: PyPI 📦 Distribution

on: [push]

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [macos-latest, ubuntu-latest, windows-latest]
        platform: [x32, x64]
    steps:
    - uses: actions/checkout@v2

    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: '3.x'

    - name: Set up MSVC x86
      if: matrix.os == 'windows-latest' && matrix.platform == 'x32'
      uses: ilammy/msvc-dev-cmd@v1
      with:
        arch: x86

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

    - name: Install dependencies
      run: |
        pip install setuptools wheel
    - name: Build distribution 📦
      shell: bash 
      run: |
        if [ ${{ matrix.platform }} == 'x32' ] && [ ${{ matrix.os }} == 'windows-latest' ]; then
             cd bindings/python && python setup.py build -p win32 bdist_wheel -p win32
        elif [ ${{ matrix.platform }} == 'x32' ] && [ ${{ matrix.os }} == 'ubuntu-latest' ]; then
             docker run --rm -v `pwd`/:/work dockcross/manylinux1-x86 > ./dockcross
             chmod +x ./dockcross
             chmod +x bindings/python/build_wheel.sh
             ./dockcross bindings/python/build_wheel.sh
        elif [ ${{ matrix.platform }} == 'x64' ] && [ ${{ matrix.os }} == 'ubuntu-latest' ]; then
             docker run --rm -v `pwd`/:/work dockcross/manylinux1-x64 > ./dockcross
             chmod +x ./dockcross
             chmod +x bindings/python/build_wheel.sh
             ./dockcross bindings/python/build_wheel.sh
        elif [ ${{ matrix.platform }} == 'x32' ] && [ ${{ matrix.os }} == 'macos-latest' ]; then
             cd bindings/python && python setup.py sdist
        else
             cd bindings/python && python setup.py bdist_wheel
        fi
    - uses: actions/upload-artifact@v2
      with:
         path: ${{ github.workspace }}/bindings/python/dist/*

  publish:
    needs: [build]
    runs-on: ubuntu-latest
    if: startsWith(github.ref, 'refs/tags')
    steps:
      - uses: actions/download-artifact@v2
        with:
          name: artifact
          path: dist

      # - name: Publish distribution 📦 to test PyPI
      #   uses: pypa/gh-action-pypi-publish@master
      #   with:
      #     user: __token__
      #     password: ${{ secrets.testpypi_pass }}
      #     repository_url: https://test.pypi.org/legacy/

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