1--- 2# This is the actual artifact build/release workflow. This workflow exists temporarily 3# because GHA doesn't support a dynamic/conditional matrix. Ensure changes are synced with ci.yaml. 4name: Manual Artifact Build 5 6on: 7# push: 8# pull_request: 9# types: [opened, synchronize, edited, reopened] 10 workflow_dispatch: 11 12env: 13 LIBYAML_REPO: https://github.com/yaml/libyaml 14 LIBYAML_REF: 0.2.5 15 16jobs: 17 python_sdist: 18 name: pyyaml sdist 19 runs-on: ubuntu-latest 20 steps: 21 - name: Checkout PyYAML 22 uses: actions/checkout@v2 23 24 - name: Install a python 25 uses: actions/setup-python@v2 26 with: 27 python-version: 3.x 28 29 - name: Build sdist 30 env: 31 PYYAML_FORCE_CYTHON: 1 32 PYYAML_FORCE_LIBYAML: 0 33 run: | 34 python -V 35 python -m pip install build 36 37 python -m build . 38 39 # Ensure exactly one artifact was produced. 40 [[ $(shopt -s nullglob; ls dist/*.tar.gz | wc -w) == 1 ]] || { 41 echo "Unexpected content in dist dir: '$(ls dist/*.tar.gz)'." 42 exit 1 43 } 44 45 - name: Test sdist 46 run: | 47 # Install some libyaml headers. 48 # TODO Should we smoke test the sdist against the libyaml we built? 49 sudo apt update 50 sudo apt install libyaml-dev -y 51 52 # Ensure Cython is not present so we use only what's in the sdist. 53 python -m pip uninstall Cython -y || true 54 55 # Pass no extra args. 56 # We should auto-install with libyaml since it's present. 57 python -m pip install dist/*.tar.gz -v 58 59 python packaging/build/smoketest.py 60 61 - name: Upload sdist artifact 62 uses: actions/upload-artifact@v2 63 with: 64 name: dist 65 path: dist/*.tar.gz 66 67 68 linux_libyaml: 69 name: libyaml ${{matrix.cfg.arch}} ${{matrix.cfg.platform}} 70 runs-on: ubuntu-latest 71 strategy: 72 matrix: 73 cfg: 74 - { platform: manylinux1, arch: x86_64 } 75 - { platform: manylinux2014, arch: x86_64 } 76 - { platform: manylinux2014, arch: aarch64 } 77 - { platform: manylinux2014, arch: s390x } 78 env: 79 DOCKER_IMAGE: quay.io/pypa/${{matrix.cfg.platform}}_${{matrix.cfg.arch}} 80 steps: 81 - name: Check cached libyaml state 82 id: cached_libyaml 83 uses: actions/cache@v2 84 with: 85 path: libyaml 86 key: libyaml_${{matrix.cfg.platform}}_${{matrix.cfg.arch}}_${{env.LIBYAML_REF}} 87 88 - name: configure docker foreign arch support 89 uses: docker/setup-qemu-action@v1 90 if: matrix.cfg.arch != 'x86_64' && steps.cached_libyaml.outputs.cache-hit != 'true' 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 - name: ensure output is world readable (or cache fill fails with Permission Denied) 108 run: > 109 sudo chmod -R a+r ./libyaml/ 110 if: steps.cached_libyaml.outputs.cache-hit != 'true' 111 112 113 linux_pyyaml: 114 needs: linux_libyaml 115 name: pyyaml ${{matrix.arch}} ${{matrix.platform}} ${{matrix.spec}} 116 runs-on: ubuntu-latest 117 strategy: 118 matrix: 119 include: 120 - { platform: manylinux1, arch: x86_64, spec: cp36 } 121 - { platform: manylinux1, arch: x86_64, spec: cp37 } 122 - { platform: manylinux1, arch: x86_64, spec: cp38 } 123 - { platform: manylinux1, arch: x86_64, spec: cp39 } 124 - { platform: manylinux2014, arch: x86_64, spec: cp310 } 125 - { platform: manylinux2014, arch: aarch64, spec: cp36 } 126 - { platform: manylinux2014, arch: aarch64, spec: cp37 } 127 - { platform: manylinux2014, arch: aarch64, spec: cp38 } 128 - { platform: manylinux2014, arch: aarch64, spec: cp39 } 129 - { platform: manylinux2014, arch: aarch64, spec: cp310 } 130 - { platform: manylinux2014, arch: s390x, spec: cp36 } 131 - { platform: manylinux2014, arch: s390x, spec: cp37 } 132 - { platform: manylinux2014, arch: s390x, spec: cp38 } 133 - { platform: manylinux2014, arch: s390x, spec: cp39 } 134 - { platform: manylinux2014, arch: s390x, spec: cp310 } 135 136 steps: 137 - name: Checkout PyYAML 138 uses: actions/checkout@v2 139 140 - name: Fetch cached libyaml 141 id: cached_libyaml 142 uses: actions/cache@v2 143 with: 144 path: libyaml 145 key: libyaml_${{matrix.platform}}_${{matrix.arch}}_${{env.LIBYAML_REF}} 146 147 - name: Ensure libyaml fetched 148 run: exit 1 149 if: steps.cached_libyaml.outputs.cache-hit != 'true' 150 151 - name: configure docker foreign arch support 152 uses: docker/setup-qemu-action@v1 153 if: matrix.arch != 'x86_64' 154 155 - name: Build/Test/Package 156 env: 157 CIBW_ARCHS: all 158 CIBW_BUILD: ${{matrix.spec}}-manylinux_${{matrix.arch}} 159 CIBW_BUILD_VERBOSITY: 1 160 # containerized Linux builds require explicit CIBW_ENVIRONMENT 161 CIBW_ENVIRONMENT: > 162 C_INCLUDE_PATH=libyaml/include 163 LIBRARY_PATH=libyaml/src/.libs 164 LD_LIBRARY_PATH=libyaml/src/.libs 165 PYYAML_FORCE_CYTHON=1 166 PYYAML_FORCE_LIBYAML=1 167 CIBW_TEST_COMMAND: cd {project}; python tests/lib/test_all.py 168 run: | 169 set -eux 170 python3 -V 171 python3 -m pip install -U --user cibuildwheel 172 python3 -m cibuildwheel --platform auto --output-dir dist . 173 174 - name: Upload artifacts 175 uses: actions/upload-artifact@v2 176 with: 177 name: dist 178 path: dist/*.whl 179 if-no-files-found: error 180 181 macos_libyaml: 182 name: libyaml macos ${{matrix.arch}} 183 strategy: 184 matrix: 185 include: 186 - arch: x86_64 187 - arch: arm64 188 runs_on: [self-hosted, macOS, arm64] 189 deployment_target: '11.0' 190 run_wrapper: arch -arm64 bash --noprofile --norc -eo pipefail {0} 191 sdkroot: macosx11.3 192 defaults: 193 run: 194 shell: ${{ matrix.run_wrapper || 'bash --noprofile --norc -eo pipefail {0}' }} 195 runs-on: ${{ matrix.runs_on || 'macos-10.15' }} 196 steps: 197 - name: Check cached libyaml state 198 id: cached_libyaml 199 uses: actions/cache@v2 200 with: 201 path: libyaml 202 key: libyaml_macos_${{matrix.arch}}_${{env.LIBYAML_REF}} 203 204 - name: Checkout PyYAML 205 uses: actions/checkout@v2 206 if: steps.cached_libyaml.outputs.cache-hit != 'true' 207 208 - name: Build libyaml 209 env: 210 MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deployment_target || '10.9' }} 211 SDKROOT: ${{ matrix.sdkroot || 'macosx' }} 212 run: | 213 set -eux 214 brew install automake coreutils m4 215 bash ./packaging/build/libyaml.sh 216 echo "finished artifact arch is $(lipo -archs libyaml/src/.libs/libyaml.a)" 217 if: steps.cached_libyaml.outputs.cache-hit != 'true' 218 219 220 macos_pyyaml: 221 needs: macos_libyaml 222 name: pyyaml ${{ matrix.spec }} 223 runs-on: ${{ matrix.runs_on || 'macos-10.15' }} 224 defaults: 225 run: 226 shell: ${{ matrix.run_wrapper || 'bash --noprofile --norc -eo pipefail {0}' }} 227 strategy: 228 matrix: 229 include: 230 - spec: cp36-macosx_x86_64 231 - spec: cp37-macosx_x86_64 232 - spec: cp38-macosx_x86_64 233 - spec: cp39-macosx_x86_64 234 - spec: cp310-macosx_x86_64 235 236 # build for arm64 under a hacked macOS 12 self-hosted x86_64-on-arm64 runner until arm64 is fully supported 237 # FIXME: ? cp38-macosx_arm64 requires special handling and fails some test_zdist tests under cibw 2.1.2, skip it (so Apple's XCode python3 won't have a wheel) 238 - spec: cp39-macosx_arm64 239 deployment_target: '11.0' 240 runs_on: [self-hosted, macOS, arm64] 241 arch: arm64 242 run_wrapper: arch -arm64 bash --noprofile --norc -eo pipefail {0} 243 sdkroot: macosx11.3 244 245 - spec: cp310-macosx_arm64 246 deployment_target: '11.0' 247 runs_on: [self-hosted, macOS, arm64] 248 arch: arm64 249 run_wrapper: arch -arm64 bash --noprofile --norc -eo pipefail {0} 250 sdkroot: macosx11.3 251 252 steps: 253 - name: Checkout PyYAML 254 uses: actions/checkout@v2 255 256 - name: Get cached libyaml state 257 id: cached_libyaml 258 uses: actions/cache@v2 259 with: 260 path: libyaml 261 key: libyaml_macos_${{ matrix.arch || 'x86_64' }}_${{env.LIBYAML_REF}} 262 263 - name: Ensure libyaml fetched 264 run: exit 1 265 if: steps.cached_libyaml.outputs.cache-hit != 'true' 266 267 - name: Build/Test/Package 268 env: 269 C_INCLUDE_PATH: libyaml/include 270 CIBW_BUILD: ${{matrix.spec}} 271 CIBW_BUILD_VERBOSITY: 1 272 CIBW_TEST_COMMAND: cd {project}; python tests/lib/test_all.py 273 LIBRARY_PATH: libyaml/src/.libs 274 MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deployment_target || '10.9' }} 275 SDKROOT: ${{ matrix.sdkroot || 'macosx' }} 276 run: | 277 python3 -V 278 python3 -m pip install -U --user cibuildwheel 279 python3 -m cibuildwheel --platform auto --output-dir dist . 280 281 - name: Upload artifacts 282 uses: actions/upload-artifact@v2 283 with: 284 name: dist 285 path: dist/*.whl 286 if-no-files-found: error 287 288 windows_libyaml: 289 name: libyaml ${{matrix.platform}} ${{matrix.arch}} 290 runs-on: ${{matrix.platform}} 291 strategy: 292 matrix: 293 include: 294 - platform: windows-2016 295 arch: x64 296 - platform: windows-2016 297 arch: win32 298 steps: 299 - name: Get cached libyaml state 300 id: cached_libyaml 301 uses: actions/cache@v2 302 with: 303 path: libyaml 304 key: libyaml_${{matrix.platform}}_${{matrix.arch}}_${{env.LIBYAML_REF}} 305 306 - name: Build libyaml 307 shell: bash 308 if: steps.cached_libyaml.outputs.cache-hit != 'true' 309 run: | 310 # git spews all over stderr unless we tell it not to 311 export GIT_REDIRECT_STDERR="2>&1" 312 313 if [[ ! -d ./libyaml ]]; then 314 git clone -b ${{ env.LIBYAML_REF }} ${{ env.LIBYAML_REPO }} 2>&1 315 fi 316 317 pushd libyaml 318 git clean -fdx 319 popd 320 321 mkdir libyaml/build 322 323 pushd libyaml/build 324 cmake.exe -G "Visual Studio 15 2017" -A ${{ matrix.arch }} -DYAML_STATIC_LIB_NAME=yaml .. 325 cmake.exe --build . --config Release 326 popd 327 328 329 windows_pyyaml: 330 needs: windows_libyaml 331 name: pyyaml ${{ matrix.platform }} ${{matrix.python_arch}} ${{matrix.spec}} 332 runs-on: ${{matrix.platform}} 333 strategy: 334 matrix: 335 include: 336 - platform: windows-2016 337 build_arch: x64 338 python_arch: x64 339 spec: 3.6 340 - platform: windows-2016 341 build_arch: x64 342 python_arch: x64 343 spec: 3.7 344 - platform: windows-2016 345 build_arch: x64 346 python_arch: x64 347 spec: 3.8 348 - platform: windows-2016 349 build_arch: x64 350 python_arch: x64 351 spec: 3.9 352 - platform: windows-2016 353 build_arch: x64 354 python_arch: x64 355 spec: '3.10' 356 - platform: windows-2016 357 build_arch: win32 358 python_arch: x86 359 spec: 3.6 360 - platform: windows-2016 361 build_arch: win32 362 python_arch: x86 363 spec: 3.7 364 - platform: windows-2016 365 build_arch: win32 366 python_arch: x86 367 spec: 3.8 368 - platform: windows-2016 369 build_arch: win32 370 python_arch: x86 371 spec: 3.9 372 - platform: windows-2016 373 build_arch: win32 374 python_arch: x86 375 spec: '3.10' 376 steps: 377 # autocrlf screws up tests under Windows 378 - name: Set git to use LF 379 run: | 380 git config --global core.autocrlf false 381 git config --global core.eol lf 382 383 - name: Checkout pyyaml 384 uses: actions/checkout@v2 385 386 - name: Get cached libyaml state 387 id: cached_libyaml 388 uses: actions/cache@v2 389 with: 390 path: libyaml 391 key: libyaml_${{matrix.platform}}_${{matrix.build_arch}}_${{env.LIBYAML_REF}} 392 393 - name: Ensure libyaml fetched 394 run: exit 1 395 if: steps.cached_libyaml.outputs.cache-hit != 'true' 396 397 - name: Install python ${{ matrix.spec }} 398 uses: actions/setup-python@v2 399 with: 400 architecture: ${{ matrix.python_arch }} 401 python-version: ${{ matrix.spec }} 402 403 - name: Build/Test/Package 404 env: 405 PYYAML_FORCE_CYTHON: 1 406 PYYAML_FORCE_LIBYAML: 1 407 shell: bash 408 run: | 409 set -eux 410 python -V 411 python -m pip install Cython wheel 412 413 python setup.py \ 414 --with-libyaml build_ext \ 415 -I libyaml/include \ 416 -L libyaml/build/Release \ 417 -D YAML_DECLARE_STATIC \ 418 build bdist_wheel 419 420 # run tests on built wheel 421 python -m pip install dist/*.whl 422 python tests/lib/test_all.py 423 424 - name: Upload artifacts 425 uses: actions/upload-artifact@v2 426 with: 427 name: dist 428 path: dist/*.whl 429 if-no-files-found: error 430... 431