• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2name: PyYAML CI
3
4on:
5  push:
6  pull_request:
7    types: [opened, synchronize, edited, reopened]
8  workflow_dispatch:
9
10env:
11  LIBYAML_REPO: https://github.com/yaml/libyaml
12  LIBYAML_REF: 0.2.5
13
14jobs:
15  python_sdist:
16    name: PyYAML sdist
17    runs-on: ubuntu-latest
18    steps:
19    - name: Checkout pyyaml
20      uses: actions/checkout@v2
21
22    - name: Install a python
23      uses: actions/setup-python@v2
24      with:
25        python-version: 3.x
26
27    - name: Install build deps
28      run: |
29        python -V
30        python -m pip install build
31
32    - name: Build sdist
33      run: |
34        # We DO want to force Cythoning, at least until 6.0.
35        export PYYAML_FORCE_CYTHON=1
36        # We don't actually want to build the lib.
37        export PYYAML_FORCE_LIBYAML=0
38
39        python -m build .
40
41        # Ensure exactly one artifact was produced.
42        [[ $(shopt -s nullglob; ls dist/*.tar.gz | wc -w) == 1 ]] || {
43          echo "Unexpected content in dist dir: '$(ls dist/*.tar.gz)'."
44          exit 1
45        }
46
47    - name: Test sdist
48      run: |
49        # Install some libyaml headers.
50        # TODO Should we smoke test the sdist against the libyaml we built?
51        sudo apt update
52        sudo apt install libyaml-dev -y
53
54        # Ensure Cython is not present so we use only what's in the sdist.
55        python -m pip uninstall Cython -y || true
56
57        # Pass no extra args.
58        # We should auto-install with libyaml since it's present.
59        python -m pip install dist/*.tar.gz -v
60
61        python packaging/build/smoketest.py
62
63    - name: Upload sdist artifact
64      uses: actions/upload-artifact@v2
65      with:
66        name: dist
67        path: dist/*.tar.gz
68
69
70  linux_libyaml:
71    name: libyaml ${{matrix.arch}} ${{matrix.platform}}
72    runs-on: ubuntu-latest
73    strategy:
74      matrix:
75        platform:
76        # manylinux1 is forward-compatible to 2010/2014.
77        #- manylinux2014
78        #- manylinux2010
79        - manylinux1
80        arch:
81        - x86_64
82    env:
83      DOCKER_IMAGE: quay.io/pypa/${{matrix.platform}}_${{matrix.arch}}
84    steps:
85    - name: Check cached libyaml state
86      id: cached_libyaml
87      uses: actions/cache@v2
88      with:
89        path: libyaml
90        key: libyaml_${{matrix.platform}}_${{matrix.arch}}_${{env.LIBYAML_REF}}
91
92    - name: Checkout pyyaml
93      uses: actions/checkout@v2
94      if: steps.cached_libyaml.outputs.cache-hit != 'true'
95
96    - name: Build libyaml
97      run: >
98        docker run --rm
99        --volume "$(pwd):/io"
100        --env LIBYAML_REF
101        --env LIBYAML_REPO
102        --workdir /io
103        "$DOCKER_IMAGE"
104        /io/packaging/build/libyaml.sh
105      if: steps.cached_libyaml.outputs.cache-hit != 'true'
106
107  linux_pyyaml:
108    needs: linux_libyaml
109    name: pyyaml ${{matrix.arch}} ${{matrix.platform}} ${{matrix.python_tag}}
110    runs-on: ubuntu-latest
111    strategy:
112      matrix:
113        platform:
114        # So long as manylinux1 container builds work, they're
115        # forward-compatible to 2010/2014.
116        # - manylinux2014
117        # - manylinux2010
118        - manylinux1
119        arch:
120        - x86_64
121        python_tag:
122        # NB manylinux >=2014 containers don't have Python 2.7, so we have to
123        # use exclude to skip it.
124        - cp27-cp27mu
125        - cp36-cp36m
126        - cp37-cp37m
127        - cp38-cp38
128        - cp39-cp39
129#        exclude:
130#        - platform: manylinux2014
131#          arch: x86_64
132#          python_tag: cp27-cp27mu
133    env:
134      AW_PLAT: ${{matrix.platform}}_${{matrix.arch}}
135      DOCKER_IMAGE: quay.io/pypa/${{matrix.platform}}_${{matrix.arch}}
136      PYTHON_TAG: ${{matrix.python_tag}}
137      PYYAML_BUILD_WHEELS: 1
138    steps:
139    - uses: actions/checkout@v2
140
141    - name: Fetch cached libyaml
142      id: cached_libyaml
143      uses: actions/cache@v2
144      with:
145        path: libyaml
146        key: libyaml_${{matrix.platform}}_${{matrix.arch}}_${{env.LIBYAML_REF}}
147
148    - name: Ensure libyaml fetched
149      run: exit 1
150      if: steps.cached_libyaml.outputs.cache-hit != 'true'
151
152    - name: Start container
153      run: >
154        docker run --rm --tty --detach
155        --name worker
156        --volume "$(pwd):/io"
157        "$DOCKER_IMAGE"
158        bash
159
160    - name: Build/Test/Package
161      run: >
162        docker exec
163        --env PYTHON_TAG
164        --env PYYAML_RUN_TESTS
165        --env PYYAML_BUILD_WHEELS
166        --env AW_PLAT
167        --workdir /io worker
168        /io/packaging/build/manylinux.sh
169
170    - uses: actions/upload-artifact@v2
171      with:
172        name: dist
173        path: dist/*.whl
174
175  macos_libyaml:
176    name: libyaml ${{matrix.arch}} ${{matrix.platform}}
177    runs-on: ${{matrix.platform}}
178    strategy:
179      matrix:
180        platform:
181        - macos-10.15
182        arch:
183        - x86_64
184    steps:
185    - name: Check cached libyaml state
186      id: cached_libyaml
187      uses: actions/cache@v2
188      with:
189        path: libyaml
190        key: libyaml_${{matrix.platform}}_${{matrix.arch}}_${{env.LIBYAML_REF}}
191
192    - name: Checkout pyyaml
193      uses: actions/checkout@v2
194      if: steps.cached_libyaml.outputs.cache-hit != 'true'
195
196    - name: Build libyaml
197      env:
198        MACOSX_DEPLOYMENT_TARGET: '10.9'
199      run: |
200        brew install automake coreutils
201        bash ./packaging/build/libyaml.sh
202      if: steps.cached_libyaml.outputs.cache-hit != 'true'
203
204  macos_pyyaml:
205    needs: macos_libyaml
206    name: pyyaml ${{matrix.arch}} ${{matrix.platform}} ${{matrix.python_tag}}
207    runs-on: ${{matrix.platform}}
208    strategy:
209      matrix:
210        platform:
211        - macos-10.15
212        arch:
213        - x86_64
214        python_tag:
215        - cp27*
216        - cp36*
217        - cp37*
218        - cp38*
219        - cp39*
220    steps:
221    - name: Checkout pyyaml
222      uses: actions/checkout@v2
223
224    - name: Get cached libyaml state
225      id: cached_libyaml
226      uses: actions/cache@v2
227      with:
228        path: libyaml
229        key: libyaml_${{matrix.platform}}_${{matrix.arch}}_${{env.LIBYAML_REF}}
230
231    - name: Ensure libyaml fetched
232      run: exit 1
233      if: steps.cached_libyaml.outputs.cache-hit != 'true'
234
235    - name: Install a python
236      uses: actions/setup-python@v2
237      with:
238        python-version: 3.x
239
240    - name: Build/Test/Package
241      env:
242        CIBW_BUILD: ${{matrix.python_tag}}
243        CIBW_BUILD_VERBOSITY: 1
244      run: bash ./packaging/build/macos.sh
245
246    - uses: actions/upload-artifact@v2
247      with:
248        name: dist
249        path: dist/*.whl
250...
251