summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yaml
blob: fc24f17325b4d29d4cc8c5f6c4361121fa17dfb9 (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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
---
name: PyYAML CI

on:
  push:
  pull_request:
  workflow_dispatch:

env:
  LIBYAML_REPO: https://github.com/yaml/libyaml
  LIBYAML_REF: '0.2.5'

jobs:
  python_sdist:
    name: pyyaml sdist
    runs-on: ubuntu-latest
    steps:
    - name: checkout pyyaml
      uses: actions/checkout@v2

    - name: install a python
      uses: actions/setup-python@v2
      with:
        python-version: 3.x

    - name: install build deps
      run: |
        python -V

        python -m pip install build

    - name: build sdist
      run: |
        # we DO want to force Cythoning, at least until 6.0
        export PYYAML_FORCE_CYTHON=1
        # we don't actually want to build the lib
        export PYYAML_FORCE_LIBYAML=0

        python -m build .

        # ensure exactly one artifact was produced
        shopt -s nullglob
        DISTFILES=(dist/*.tar.gz)
        if [[ ${DISTFILES[@]} -ne 1 ]]; then
          echo "unexpected content in dist dir: $(ls dist/*.tar.gz)"
          exit 1
        fi

    - name: test sdist
      run: |
        # install some libyaml headers
        # TODO should we smoke test the sdist against the libyaml we built?
        sudo apt update
        sudo apt install libyaml-dev -y

        # ensure Cython is not present so we use only what's in the sdist
        python -m pip uninstall Cython -y || true

        # pass no extra args- we should auto-install with libyaml since it's
        # present
        python -m pip install dist/*.tar.gz -v

        python packaging/build/smoketest.py

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


  linux_libyaml:
    name: libyaml ${{matrix.arch}} ${{matrix.platform}}
    runs-on: ubuntu-latest
    strategy:
      matrix:
        platform:
        # manylinux1 is forward-compatible to 2010/2014
        #- manylinux2014
        #- manylinux2010
        - manylinux1
        arch:
        - x86_64
    env:
      DOCKER_IMAGE: quay.io/pypa/${{matrix.platform}}_${{matrix.arch}}
    steps:
    - name: check cached libyaml state
      id: cached_libyaml
      uses: actions/cache@v2
      with:
        path: |
          libyaml
        key: libyaml_${{matrix.platform}}_${{matrix.arch}}_${{env.LIBYAML_REF}}

    - name: checkout pyyaml
      uses: actions/checkout@v2
      if: steps.cached_libyaml.outputs.cache-hit != 'true'

    - name: build libyaml
      run: >
        docker run --rm
        -v $(pwd):/io
        -e LIBYAML_REF
        -e LIBYAML_REPO
        --workdir /io
        "$DOCKER_IMAGE"
        /io/packaging/build/libyaml.sh
      if: steps.cached_libyaml.outputs.cache-hit != 'true'

  linux_pyyaml:
    needs: linux_libyaml
    name: pyyaml ${{matrix.arch}} ${{matrix.platform}} ${{matrix.python_tag}}
    runs-on: ubuntu-latest
    strategy:
      matrix:
        platform:
        # so long as manylinux1 container builds work, they're
        # forward-compatible to 2010/2014
        # - manylinux2014
        # - manylinux2010
        - manylinux1
        arch:
        - x86_64
        python_tag:
        # NB manylinux >=2014 containers don't have Python 2.7, so we have to
        # use exclude to skip it
        - cp27-cp27mu
        - cp36-cp36m
        - cp37-cp37m
        - cp38-cp38
        - cp39-cp39
#        exclude:
#        - platform: manylinux2014
#          arch: x86_64
#          python_tag: cp27-cp27mu
    env:
      AW_PLAT: ${{matrix.platform}}_${{matrix.arch}}
      DOCKER_IMAGE: quay.io/pypa/${{matrix.platform}}_${{matrix.arch}}
      PYTHON_TAG: ${{matrix.python_tag}}
      PYYAML_BUILD_WHEELS: 1
    steps:
    - uses: actions/checkout@v2

    - name: fetch cached libyaml
      id: cached_libyaml
      uses: actions/cache@v2
      with:
        path: |
          libyaml
        key: libyaml_${{matrix.platform}}_${{matrix.arch}}_${{env.LIBYAML_REF}}

    - name: ensure libyaml fetched
      run: exit 1
      if: steps.cached_libyaml.outputs.cache-hit != 'true'

    - name: start container
      run: >
        docker run -t -d --rm
        --name worker
        -v $(pwd):/io
        "$DOCKER_IMAGE"
        bash

    - name: build/test/package
      run: >
        docker exec
        -e PYTHON_TAG
        -e PYYAML_RUN_TESTS
        -e PYYAML_BUILD_WHEELS
        -e AW_PLAT
        --workdir /io worker
        /io/packaging/build/manylinux.sh

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

  macos_libyaml:
    name: libyaml ${{matrix.arch}} ${{matrix.platform}}
    runs-on: ${{matrix.platform}}
    strategy:
      matrix:
        platform:
        - macos-10.15
        arch:
        - x86_64
    steps:
    - name: check cached libyaml state
      id: cached_libyaml
      uses: actions/cache@v2
      with:
        path: |
          libyaml
        key: libyaml_${{matrix.platform}}_${{matrix.arch}}_${{env.LIBYAML_REF}}

    - name: checkout pyyaml
      uses: actions/checkout@v2
      if: steps.cached_libyaml.outputs.cache-hit != 'true'

    - name: build libyaml
      env:
        MACOSX_DEPLOYMENT_TARGET: '10.9'
      run: |
        brew install automake coreutils
        bash ./packaging/build/libyaml.sh
      if: steps.cached_libyaml.outputs.cache-hit != 'true'

  macos_pyyaml:
    needs: macos_libyaml
    name: pyyaml ${{matrix.arch}} ${{matrix.platform}} ${{matrix.python_tag}}
    runs-on: ${{matrix.platform}}
    strategy:
      matrix:
        platform:
        - macos-10.15
        arch:
        - x86_64
        python_tag:
        - cp27*
        - cp36*
        - cp37*
        - cp38*
        - cp39*
    steps:
    - name: checkout pyyaml
      uses: actions/checkout@v2

    - name: get cached libyaml state
      id: cached_libyaml
      uses: actions/cache@v2
      with:
        path: |
          libyaml
        key: libyaml_${{matrix.platform}}_${{matrix.arch}}_${{env.LIBYAML_REF}}

    - name: ensure libyaml fetched
      run: exit 1
      if: steps.cached_libyaml.outputs.cache-hit != 'true'

    - name: install a python
      uses: actions/setup-python@v2
      with:
        python-version: 3.x

    - name: build/test/package
      env:
        CIBW_BUILD: ${{matrix.python_tag}}
        CIBW_BUILD_VERBOSITY: 1
      run: |
        bash ./packaging/build/macos.sh

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