File: release-python.yml

package info (click to toggle)
createrepo-c 1.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,704 kB
  • sloc: ansic: 31,242; python: 4,867; xml: 2,669; sh: 367; makefile: 26; perl: 7
file content (94 lines) | stat: -rw-r--r-- 2,626 bytes parent folder | download
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
---
name: Python Release

on:
  release:
    types: [created]

jobs:
  build_sdist:
    name: Build source packages
    runs-on: ubuntu-latest
    container: fedora:latest
    steps:
    - uses: actions/checkout@v4

    - name: Install dependencies
      run: |
        sudo dnf -y install dnf-plugins-core
        sudo dnf -y builddep createrepo_c.spec
        sudo dnf -y install twine pytest
        pip install --upgrade pip
        pip install scikit-build

    - name: Build Python sdist
      run: python3 setup.py sdist

    - name: Install and Test Python source package
      run: |
        pip install dist/*.tar.gz
        pytest --verbose --color=yes tests/python/tests/

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

  build_bdist:
    name: Build binary wheels
    runs-on: ubuntu-latest
    strategy:
      matrix:
        include:
          - arch: auto64  # native 64-bit
          - arch: aarch64
    # TODO: when github actions gets native aarch64 runners, ditch qemu, it will be much faster

    steps:
    - uses: actions/checkout@v4

    # setup Python for cibuildwheel
    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: '3.x'

    - name: Set up QEMU
      if: runner.os == 'Linux' && ${{ matrix.arch }} == "aarch64"
      uses: docker/setup-qemu-action@v3
      with:
        platforms: arm64

    - name: Build wheels for CPython
      uses: pypa/cibuildwheel@v2.22.0
      env:
        CIBW_ARCHS: ${{ matrix.arch }}
        CIBW_SKIP: "pp* *-musllinux_* cp36* cp37* cp38*"  # no PyPy or musl builds, no older Python versions
        CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28  # alma 8
        CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
        CIBW_BEFORE_ALL_LINUX: dnf -y install epel-release && yes | dnf -y builddep createrepo_c.spec
        CIBW_BEFORE_BUILD: python -m pip install scikit-build
        CIBW_TEST_REQUIRES: pytest
        CIBW_TEST_COMMAND: |
          pytest --verbose --color=yes {project}/tests/python/tests/

    - uses: actions/upload-artifact@v4
      with:
        path: ./wheelhouse/*.whl


  upload_pypi:
    name: Publish packages to PyPI
    # only publish packages once everything is successful
    needs: [build_bdist, build_sdist]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/download-artifact@v4
        with:
          name: artifact
          path: dist

      - uses: pypa/gh-action-pypi-publish@v1.12.3
        with:
          user: __token__
          password: ${{secrets.PYPI_API_TOKEN}}
          # To test: repository_url: https://test.pypi.org/legacy/