summaryrefslogtreecommitdiff
path: root/.github/workflows/kit.yml
blob: dff56cda94bf3f0bf69c23918b0d2712ea20fd7e (plain)
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt

# Based on:
# https://github.com/joerick/cibuildwheel/blob/master/examples/github-deploy.yml

name: "Kits"

on:
  push:
    branches:
      # Don't build kits all the time, but do if the branch is about kits.
      - "**/*kit*"
  workflow_dispatch:

defaults:
  run:
    shell: bash

env:
  PIP_DISABLE_PIP_VERSION_CHECK: 1

jobs:
  wheels:
    name: "Build wheels on ${{ matrix.os }}"
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - os: ubuntu-latest
            cibw_arch: x86_64 i686 aarch64
          - os: windows-latest
            cibw_arch: x86 AMD64
          - os: macos-latest
            cibw_arch: x86_64
      fail-fast: false

    steps:
      - name: Setup QEMU
        if: matrix.os == 'ubuntu-latest'
        uses: docker/setup-qemu-action@v1
        with:
          platforms: arm64

      - name: "Check out the repo"
        uses: actions/checkout@v2

      - name: "Install Python 3.8"
        uses: actions/setup-python@v2
        with:
          python-version: "3.8"

      - name: "Install tools"
        run: |
          python -m pip install -r requirements/kit.pip

      - name: "Build wheels"
        env:
          # Don't build wheels for PyPy.
          CIBW_SKIP: pp*
          CIBW_ARCHS: ${{ matrix.cibw_arch }}
        run: |
          python -m cibuildwheel --output-dir wheelhouse
          ls -al wheelhouse/

      - name: "Upload wheels"
        uses: actions/upload-artifact@v2
        with:
          name: dist
          path: wheelhouse/*.whl

  sdist:
    name: "Build source distribution"
    runs-on: ubuntu-latest
    steps:
      - name: "Check out the repo"
        uses: actions/checkout@v2

      - name: "Install Python 3.8"
        uses: actions/setup-python@v2
        with:
          python-version: "3.8"

      - name: "Install tools"
        run: |
          python -m pip install -r requirements/kit.pip

      - name: "Build sdist"
        run: |
          python -m build
          ls -al dist/

      - name: "Upload sdist"
        uses: actions/upload-artifact@v2
        with:
          name: dist
          path: dist/*.tar.gz

  pypy:
    name: "Build PyPy wheels"
    runs-on: ubuntu-latest
    steps:
      - name: "Check out the repo"
        uses: actions/checkout@v2

      - name: "Install PyPy"
        uses: actions/setup-python@v2
        with:
          python-version: "pypy3"

      - name: "Install requirements"
        run: |
          pypy3 -m pip install -r requirements/kit.pip

      - name: "Build wheels"
        run: |
          pypy3 setup.py bdist_wheel --python-tag pp36
          pypy3 setup.py bdist_wheel --python-tag pp37
          pypy3 setup.py bdist_wheel --python-tag pp38
          ls -al dist/

      - name: "Upload wheels"
        uses: actions/upload-artifact@v2
        with:
          name: dist
          path: dist/*.whl

  prerel:
    name: "Build ${{ matrix.python-version }} wheels on ${{ matrix.os }}"
    if: ${{ false }}  # disable for now, since there are no pre-rel Python versions.
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os:
          - ubuntu-latest
          - windows-latest
          - macos-latest
        python-version:
          - "3.10.0-rc.2"
      fail-fast: false

    steps:
      - name: "Check out the repo"
        uses: actions/checkout@v2

      - name: "Install Python ${{ matrix.python-version }}"
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}

      - name: "Install wheel tools"
        run: |
          python -m pip install -r requirements/kit.pip

      - name: "Build wheel"
        run: |
          python -m build

      - name: "Convert to manylinux wheel"
        if: runner.os == 'Linux'
        run: |
          ls -la dist/
          auditwheel show dist/*.whl
          auditwheel repair dist/*.whl
          ls -la wheelhouse/
          auditwheel show wheelhouse/*.whl
          rm dist/*.whl
          mv wheelhouse/*.whl dist/
          ls -al dist/

      - name: "Upload wheels"
        uses: actions/upload-artifact@v2
        with:
          name: dist
          path: dist/*.whl