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: x86_64, spec: cp311 } 126 - { platform: manylinux2014, arch: aarch64, spec: cp36 } 127 - { platform: manylinux2014, arch: aarch64, spec: cp37 } 128 - { platform: manylinux2014, arch: aarch64, spec: cp38 } 129 - { platform: manylinux2014, arch: aarch64, spec: cp39 } 130 - { platform: manylinux2014, arch: aarch64, spec: cp310 } 131 - { platform: manylinux2014, arch: aarch64, spec: cp311 } 132 - { platform: manylinux2014, arch: s390x, spec: cp36 } 133 - { platform: manylinux2014, arch: s390x, spec: cp37 } 134 - { platform: manylinux2014, arch: s390x, spec: cp38 } 135 - { platform: manylinux2014, arch: s390x, spec: cp39 } 136 - { platform: manylinux2014, arch: s390x, spec: cp310 } 137 - { platform: manylinux2014, arch: s390x, spec: cp311 } 138 139 steps: 140 - name: Checkout PyYAML 141 uses: actions/checkout@v2 142 143 - name: Fetch cached libyaml 144 id: cached_libyaml 145 uses: actions/cache@v2 146 with: 147 path: libyaml 148 key: libyaml_${{matrix.platform}}_${{matrix.arch}}_${{env.LIBYAML_REF}} 149 150 - name: Ensure libyaml fetched 151 run: exit 1 152 if: steps.cached_libyaml.outputs.cache-hit != 'true' 153 154 - name: configure docker foreign arch support 155 uses: docker/setup-qemu-action@v1 156 if: matrix.arch != 'x86_64' 157 158 - name: Build/Test/Package 159 env: 160 CIBW_ARCHS: all 161 CIBW_BUILD: ${{matrix.spec}}-manylinux_${{matrix.arch}} 162 CIBW_BUILD_VERBOSITY: 1 163 # containerized Linux builds require explicit CIBW_ENVIRONMENT 164 CIBW_ENVIRONMENT: > 165 C_INCLUDE_PATH=libyaml/include 166 LIBRARY_PATH=libyaml/src/.libs 167 LD_LIBRARY_PATH=libyaml/src/.libs 168 PYYAML_FORCE_CYTHON=1 169 PYYAML_FORCE_LIBYAML=1 170 CIBW_TEST_COMMAND: cd {project}; python tests/lib/test_all.py 171 run: | 172 set -eux 173 python3 -V 174 python3 -m pip install -U --user cibuildwheel 175 python3 -m cibuildwheel --platform auto --output-dir dist . 176 177 - name: Upload artifacts 178 uses: actions/upload-artifact@v2 179 with: 180 name: dist 181 path: dist/*.whl 182 if-no-files-found: error 183 184 macos_libyaml: 185 name: libyaml macos ${{matrix.arch}} 186 strategy: 187 matrix: 188 include: 189 - arch: x86_64 190 - arch: arm64 191 runs_on: [self-hosted, macOS, arm64] 192 deployment_target: '11.0' 193 run_wrapper: arch -arm64 bash --noprofile --norc -eo pipefail {0} 194 sdkroot: macosx11.3 195 defaults: 196 run: 197 shell: ${{ matrix.run_wrapper || 'bash --noprofile --norc -eo pipefail {0}' }} 198 runs-on: ${{ matrix.runs_on || 'macos-11' }} 199 steps: 200 - name: Check cached libyaml state 201 id: cached_libyaml 202 uses: actions/cache@v2 203 with: 204 path: libyaml 205 key: libyaml_macos_${{matrix.arch}}_${{env.LIBYAML_REF}} 206 207 - name: Checkout PyYAML 208 uses: actions/checkout@v2 209 if: steps.cached_libyaml.outputs.cache-hit != 'true' 210 211 - name: Build libyaml 212 env: 213 MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deployment_target || '10.9' }} 214 SDKROOT: ${{ matrix.sdkroot || 'macosx' }} 215 run: | 216 set -eux 217 brew install automake coreutils m4 218 bash ./packaging/build/libyaml.sh 219 echo "finished artifact arch is $(lipo -archs libyaml/src/.libs/libyaml.a)" 220 if: steps.cached_libyaml.outputs.cache-hit != 'true' 221 222 223 macos_pyyaml: 224 needs: macos_libyaml 225 name: pyyaml ${{ matrix.spec }} 226 runs-on: ${{ matrix.runs_on || 'macos-11' }} 227 defaults: 228 run: 229 shell: ${{ matrix.run_wrapper || 'bash --noprofile --norc -eo pipefail {0}' }} 230 strategy: 231 matrix: 232 include: 233 - spec: cp36-macosx_x86_64 234 cibw_version: cibuildwheel==2.11.1 235 - spec: cp37-macosx_x86_64 236 cibw_version: cibuildwheel==2.11.1 237 - spec: cp38-macosx_x86_64 238 cibw_version: cibuildwheel==2.11.1 239 - spec: cp39-macosx_x86_64 240 - spec: cp310-macosx_x86_64 241 - spec: cp311-macosx_x86_64 242 243 # build for arm64 under a hacked macOS 12 self-hosted x86_64-on-arm64 runner until arm64 is fully supported 244 # 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) 245 - spec: cp39-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 - spec: cp310-macosx_arm64 253 deployment_target: '11.0' 254 runs_on: [self-hosted, macOS, arm64] 255 arch: arm64 256 run_wrapper: arch -arm64 bash --noprofile --norc -eo pipefail {0} 257 sdkroot: macosx11.3 258 259 - spec: cp311-macosx_arm64 260 deployment_target: '11.0' 261 runs_on: [self-hosted, macOS, arm64] 262 arch: arm64 263 run_wrapper: arch -arm64 bash --noprofile --norc -eo pipefail {0} 264 sdkroot: macosx11.3 265 266 steps: 267 - name: Checkout PyYAML 268 uses: actions/checkout@v2 269 270 - name: Get cached libyaml state 271 id: cached_libyaml 272 uses: actions/cache@v2 273 with: 274 path: libyaml 275 key: libyaml_macos_${{ matrix.arch || 'x86_64' }}_${{env.LIBYAML_REF}} 276 277 - name: Ensure libyaml fetched 278 run: exit 1 279 if: steps.cached_libyaml.outputs.cache-hit != 'true' 280 281 - name: Build/Test/Package 282 env: 283 C_INCLUDE_PATH: libyaml/include 284 CIBW_BUILD: ${{matrix.spec}} 285 CIBW_BUILD_VERBOSITY: 1 286 CIBW_TEST_COMMAND: cd {project}; python tests/lib/test_all.py 287 LIBRARY_PATH: libyaml/src/.libs 288 MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deployment_target || '10.9' }} 289 SDKROOT: ${{ matrix.sdkroot || 'macosx' }} 290 run: | 291 python3 -V 292 python3 -m pip install -U --user ${{ matrix.cibw_version || 'cibuildwheel' }} 293 python3 -m cibuildwheel --platform auto --output-dir dist . 294 295 - name: Upload artifacts 296 uses: actions/upload-artifact@v2 297 with: 298 name: dist 299 path: dist/*.whl 300 if-no-files-found: error 301 302 windows_libyaml: 303 name: libyaml ${{matrix.platform}} ${{matrix.arch}} 304 runs-on: ${{matrix.platform}} 305 strategy: 306 matrix: 307 include: 308 - platform: windows-2019 309 arch: x64 310 - platform: windows-2019 311 arch: win32 312 steps: 313 - name: Get cached libyaml state 314 id: cached_libyaml 315 uses: actions/cache@v2 316 with: 317 path: libyaml 318 key: libyaml_${{matrix.platform}}_${{matrix.arch}}_${{env.LIBYAML_REF}} 319 320 - name: Build libyaml 321 shell: bash 322 if: steps.cached_libyaml.outputs.cache-hit != 'true' 323 run: | 324 # git spews all over stderr unless we tell it not to 325 export GIT_REDIRECT_STDERR="2>&1" 326 327 if [[ ! -d ./libyaml ]]; then 328 git clone -b ${{ env.LIBYAML_REF }} ${{ env.LIBYAML_REPO }} 2>&1 329 fi 330 331 pushd libyaml 332 git clean -fdx 333 popd 334 335 mkdir libyaml/build 336 337 pushd libyaml/build 338 cmake.exe -G "Visual Studio 16 2019" -A ${{ matrix.arch }} -DYAML_STATIC_LIB_NAME=yaml .. 339 cmake.exe --build . --config Release 340 popd 341 342 343 windows_pyyaml: 344 needs: windows_libyaml 345 name: pyyaml ${{ matrix.platform }} ${{matrix.python_arch}} ${{matrix.spec}} 346 runs-on: ${{matrix.platform}} 347 strategy: 348 matrix: 349 include: 350 - platform: windows-2019 351 build_arch: x64 352 python_arch: x64 353 spec: 3.6 354 - platform: windows-2019 355 build_arch: x64 356 python_arch: x64 357 spec: 3.7 358 - platform: windows-2019 359 build_arch: x64 360 python_arch: x64 361 spec: 3.8 362 - platform: windows-2019 363 build_arch: x64 364 python_arch: x64 365 spec: 3.9 366 - platform: windows-2019 367 build_arch: x64 368 python_arch: x64 369 spec: '3.10' 370 - platform: windows-2019 371 build_arch: x64 372 python_arch: x64 373 spec: '3.11' 374 - platform: windows-2019 375 build_arch: win32 376 python_arch: x86 377 spec: 3.6 378 - platform: windows-2019 379 build_arch: win32 380 python_arch: x86 381 spec: 3.7 382 - platform: windows-2019 383 build_arch: win32 384 python_arch: x86 385 spec: 3.8 386 - platform: windows-2019 387 build_arch: win32 388 python_arch: x86 389 spec: 3.9 390 - platform: windows-2019 391 build_arch: win32 392 python_arch: x86 393 spec: '3.10' 394 - platform: windows-2019 395 build_arch: win32 396 python_arch: x86 397 spec: '3.11' 398 steps: 399 # autocrlf screws up tests under Windows 400 - name: Set git to use LF 401 run: | 402 git config --global core.autocrlf false 403 git config --global core.eol lf 404 405 - name: Checkout pyyaml 406 uses: actions/checkout@v2 407 408 - name: Get cached libyaml state 409 id: cached_libyaml 410 uses: actions/cache@v2 411 with: 412 path: libyaml 413 key: libyaml_${{matrix.platform}}_${{matrix.build_arch}}_${{env.LIBYAML_REF}} 414 415 - name: Ensure libyaml fetched 416 run: exit 1 417 if: steps.cached_libyaml.outputs.cache-hit != 'true' 418 419 - name: Install python ${{ matrix.spec }} 420 uses: actions/setup-python@v2 421 with: 422 architecture: ${{ matrix.python_arch }} 423 python-version: ${{ matrix.spec }} 424 425 - name: Build/Test/Package 426 env: 427 PYYAML_FORCE_CYTHON: 1 428 PYYAML_FORCE_LIBYAML: 1 429 shell: bash 430 run: | 431 set -eux 432 python -V 433 python -m pip install "Cython<3.0" wheel 434 435 python setup.py \ 436 --with-libyaml build_ext \ 437 -I libyaml/include \ 438 -L libyaml/build/Release \ 439 -D YAML_DECLARE_STATIC \ 440 build bdist_wheel 441 442 # run tests on built wheel 443 python -m pip install dist/*.whl 444 python tests/lib/test_all.py 445 446 - name: Upload artifacts 447 uses: actions/upload-artifact@v2 448 with: 449 name: dist 450 path: dist/*.whl 451 if-no-files-found: error 452... 453