From d44c8fd3e732a627b45ae1da200c2b0dc2bd78a8 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Thu, 16 May 2024 22:25:48 -0700 Subject: [PATCH] reenable windows --- .github/workflows/ci.yaml | 336 +++++++++++++++++++------------------- 1 file changed, 168 insertions(+), 168 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e62bc675..a6e53f0e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -57,28 +57,6 @@ jobs: python -m build -s . echo "artifact_name=$(ls ./dist)" >> "$GITHUB_OUTPUT" -# -# -# - 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 -# -# mkdir distout && cd distout -# tar zxvf $(ls ../dist/*.tar.gz) -# python -m build -w ./pyyaml* -# -# # FIXME: smoketest the built wheel -# -# cd .. -# -# # 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@v4 @@ -188,7 +166,7 @@ jobs: - { platform: musllinux_1_1, arch: aarch64, spec: cp310, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } - { platform: musllinux_1_1, arch: aarch64, spec: cp311, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } - { platform: musllinux_1_1, arch: aarch64, spec: cp312, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } - - { platform: musllinux_1_1, arch: aarch64, spec: cp313, cibw_version: "https://github.com/nitzmahone/cibuildwheel/archive/refs/heads/py313_support.zip", omit: ${{ env.skip_slow_jobs }} } + - { platform: musllinux_1_1, arch: aarch64, spec: cp313 } # , omit: ${{ env.skip_slow_jobs }} } linux_pyyaml: @@ -200,8 +178,6 @@ jobs: matrix: ${{ fromJSON(needs.make_linux_pyyaml_matrix.outputs.matrix_json) }} steps: -# - name: Checkout PyYAML -# uses: actions/checkout@v4 - name: fetch sdist artifact id: fetch_sdist uses: actions/download-artifact@v4 @@ -228,11 +204,9 @@ jobs: CIBW_BUILD_VERBOSITY: 1 # containerized Linux builds require explicit CIBW_ENVIRONMENT CIBW_ENVIRONMENT: > - LD_LIBRARY_PATH=libyaml/src/.libs + LD_LIBRARY_PATH=../libyaml/src/.libs PYYAML_FORCE_CYTHON=1 PYYAML_FORCE_LIBYAML=1 - CIBW_CONFIG_SETTINGS: | - pyyaml_build_config={"force":1, "library_dirs": ["libyaml/src/.libs"], "include_dirs": ["libyaml/include"]} CIBW_TEST_COMMAND: cd {project}; pytest CIBW_TEST_REQUIRES: pytest run: | @@ -240,7 +214,17 @@ jobs: python3 -V python3 -m pip install -U --user ${{ matrix.cibw_version || 'cibuildwheel' }} - CIBW_BEFORE_BUILD="cp -r /host$(pwd)/libyaml {project} && ls -l {project}" python3 -m cibuildwheel --platform auto --output-dir ./dist ${{ steps.fetch_sdist.outputs.download-path }}/pyyaml*.tar.gz/pyyaml*.tar.gz + + mkdir pyyaml + + tar zxf ${{ steps.fetch_sdist.outputs.download-path }}/pyyaml*.tar.gz/pyyaml*.tar.gz --strip-components=1 -C pyyaml + + cat << 'EOF' > build_config.toml + [tool.cibuildwheel.config-settings] + pyyaml_build_config='{"force":1, "library_dirs": ["../libyaml/src/.libs"], "include_dirs": ["../libyaml/include"]}' + EOF + + CIBW_BEFORE_BUILD="ls -l {project}" python3 -m cibuildwheel --config-file $(pwd)/build_config.toml --platform auto --output-dir ./dist ./pyyaml echo "artifact_name=$(ls ./dist/)" >> "$GITHUB_OUTPUT" # FIXME: ensure exactly one artifact @@ -381,148 +365,164 @@ jobs: # if-no-files-found: error # if: ${{ ! env.skip_artifact_upload }} # -# windows_libyaml: -# name: libyaml windows ${{ matrix.arch }} -# runs-on: ${{ matrix.platform || 'windows-2022' }} -# strategy: -# matrix: -# include: -# - arch: x64 -# - arch: win32 -# steps: -# - name: Get cached libyaml state -# id: cached_libyaml -# uses: actions/cache@v4 -# with: -# path: libyaml -# key: libyaml_${{ 'windows' }}_${{ matrix.arch }}_${{ env.LIBYAML_REF }} -# -# - name: Build libyaml -# shell: bash -# if: steps.cached_libyaml.outputs.cache-hit != 'true' -# run: | -# # git spews all over stderr unless we tell it not to -# export GIT_REDIRECT_STDERR="2>&1" -# -# if [[ ! -d ./libyaml ]]; then -# git clone -b ${{ env.LIBYAML_REF }} ${{ env.LIBYAML_REPO }} 2>&1 -# fi -# -# pushd libyaml -# git clean -fdx -# popd -# -# mkdir libyaml/build -# -# pushd libyaml/build -# cmake.exe -G "Visual Studio 17 2022" -A ${{ matrix.arch }} -DYAML_STATIC_LIB_NAME=yaml .. -# cmake.exe --build . --config Release -# popd -# -# make_windows_pyyaml_matrix: -# runs-on: ubuntu-22.04 -# outputs: -# matrix_json: ${{ steps.make_matrix.outputs.matrix_json }} -# steps: -# - uses: actions/checkout@v4 -# - name: make a matrix -# id: make_matrix -# uses: ./.github/actions/dynamatrix -# with: -# matrix_yaml: | -# include: -# - spec: cp38-win_amd64 -# # omit: ${{ env.skip_ci_redundant_jobs }} -# -# - spec: cp39-win_amd64 -# omit: ${{ env.skip_ci_redundant_jobs }} -# -# - spec: cp310-win_amd64 -# omit: ${{ env.skip_ci_redundant_jobs }} -# -# - spec: cp311-win_amd64 -# omit: ${{ env.skip_ci_redundant_jobs }} -# -# - spec: cp312-win_amd64 -# omit: ${{ env.skip_ci_redundant_jobs }} -# -# - spec: cp313-win_amd64 -# cibw_version: https://github.com/nitzmahone/cibuildwheel/archive/refs/heads/py313_support.zip -# -# - spec: cp38-win32 -# omit: ${{ env.skip_ci_redundant_jobs }} -# -# - spec: cp39-win32 -# omit: ${{ env.skip_ci_redundant_jobs }} -# -# - spec: cp310-win32 -# omit: ${{ env.skip_ci_redundant_jobs }} -# -# - spec: cp311-win32 -# omit: ${{ env.skip_ci_redundant_jobs }} -# -# - spec: cp312-win32 -# omit: ${{ env.skip_ci_redundant_jobs }} -# -# - spec: cp313-win32 -# cibw_version: https://github.com/nitzmahone/cibuildwheel/archive/refs/heads/py313_support.zip -# # omit: ${{ env.skip_ci_redundant_jobs }} -# -# windows_pyyaml: -# needs: [python_sdist, windows_libyaml, make_windows_pyyaml_matrix] -# name: pyyaml ${{matrix.spec}} -# runs-on: ${{ matrix.runs-on || 'windows-2022' }} -# strategy: -# fail-fast: false -# matrix: ${{ fromJSON(needs.make_windows_pyyaml_matrix.outputs.matrix_json) }} -# steps: -# # autocrlf screws up tests under Windows -# - name: Set git to use LF -# run: | -# git config --global core.autocrlf false -# git config --global core.eol lf + windows_libyaml: + name: libyaml windows ${{ matrix.arch }} + runs-on: ${{ matrix.platform || 'windows-2022' }} + strategy: + matrix: + include: + - arch: x64 + - arch: win32 + steps: + - name: Get cached libyaml state + id: cached_libyaml + uses: actions/cache@v4 + with: + path: libyaml + key: libyaml_${{ 'windows' }}_${{ matrix.arch }}_${{ env.LIBYAML_REF }} + + - name: Build libyaml + shell: bash + if: steps.cached_libyaml.outputs.cache-hit != 'true' + run: | + # git spews all over stderr unless we tell it not to + export GIT_REDIRECT_STDERR="2>&1" + + if [[ ! -d ./libyaml ]]; then + git clone -b ${{ env.LIBYAML_REF }} ${{ env.LIBYAML_REPO }} 2>&1 + fi + + pushd libyaml + git clean -fdx + popd + + mkdir libyaml/build + + pushd libyaml/build + cmake.exe -G "Visual Studio 17 2022" -A ${{ matrix.arch }} -DYAML_STATIC_LIB_NAME=yaml .. + cmake.exe --build . --config Release + popd + + make_windows_pyyaml_matrix: + runs-on: ubuntu-22.04 + outputs: + matrix_json: ${{ steps.make_matrix.outputs.matrix_json }} + steps: + - uses: actions/checkout@v4 + - name: make a matrix + id: make_matrix + uses: ./.github/actions/dynamatrix + with: + matrix_yaml: | + include: + - spec: cp38-win_amd64 + # omit: ${{ env.skip_ci_redundant_jobs }} + + - spec: cp39-win_amd64 + omit: ${{ env.skip_ci_redundant_jobs }} + + - spec: cp310-win_amd64 + omit: ${{ env.skip_ci_redundant_jobs }} + + - spec: cp311-win_amd64 + omit: ${{ env.skip_ci_redundant_jobs }} + + - spec: cp312-win_amd64 + omit: ${{ env.skip_ci_redundant_jobs }} + + - spec: cp313-win_amd64 + cibw_version: https://github.com/nitzmahone/cibuildwheel/archive/refs/heads/py313_support.zip + + - spec: cp38-win32 + omit: ${{ env.skip_ci_redundant_jobs }} + + - spec: cp39-win32 + omit: ${{ env.skip_ci_redundant_jobs }} + + - spec: cp310-win32 + omit: ${{ env.skip_ci_redundant_jobs }} + + - spec: cp311-win32 + omit: ${{ env.skip_ci_redundant_jobs }} + + - spec: cp312-win32 + omit: ${{ env.skip_ci_redundant_jobs }} + + - spec: cp313-win32 + cibw_version: https://github.com/nitzmahone/cibuildwheel/archive/refs/heads/py313_support.zip + # omit: ${{ env.skip_ci_redundant_jobs }} + + windows_pyyaml: + needs: [python_sdist, windows_libyaml, make_windows_pyyaml_matrix] + name: pyyaml ${{matrix.spec}} + runs-on: ${{ matrix.runs-on || 'windows-2022' }} + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.make_windows_pyyaml_matrix.outputs.matrix_json) }} + steps: + # autocrlf screws up tests under Windows + - name: Set git to use LF + run: | + git config --global core.autocrlf false + git config --global core.eol lf # # - name: Checkout pyyaml # uses: actions/checkout@v4 -# -# - name: Get cached libyaml state -# id: cached_libyaml -# uses: actions/cache/restore@v4 -# with: -# path: libyaml -# key: libyaml_${{'windows'}}_${{ contains(matrix.spec, 'win_amd64') && 'x64' || 'win32' }}_${{env.LIBYAML_REF}} -# fail-on-cache-miss: true -# -# - name: Install python -# uses: actions/setup-python@v5 -# with: -# python-version: 3.x -# -# - name: Build/Test/Package -# id: build -# shell: bash -# env: -# CIBW_BUILD: ${{matrix.spec}} -# CIBW_BUILD_VERBOSITY: 1 -# CIBW_TEST_COMMAND: pytest {project}/tests -# CIBW_TEST_REQUIRES: pytest -# CIBW_CONFIG_SETTINGS: | -# pyyaml_build_config='{"include_dirs": ["libyaml/include"], "library_dirs": ["libyaml/build/Release"], "define": [["YAML_DECLARE_STATIC", 1]], "force": 1}' -# run: | -# set -eux -# python -V -# python -m pip install -U --user ${{ matrix.cibw_version || 'cibuildwheel' }} -# python -m cibuildwheel --output-dir dist . -# echo "ARTIFACT_NAME=$(ls ./dist/)" >> "$GITHUB_OUTPUT" -# # FIXME: ensure exactly one artifact -# -# - name: Upload artifacts -# uses: actions/upload-artifact@v4 -# with: -# name: ${{ steps.build.outputs.ARTIFACT_NAME }} -# path: dist/*.whl -# if-no-files-found: error -# if: ${{ ! env.skip_artifact_upload }} + + - name: fetch sdist artifact + id: fetch_sdist + uses: actions/download-artifact@v4 + with: + name: ${{ needs.build_sdist.outputs.artifact_name }} + + - name: Get cached libyaml state + id: cached_libyaml + uses: actions/cache/restore@v4 + with: + path: libyaml + key: libyaml_${{'windows'}}_${{ contains(matrix.spec, 'win_amd64') && 'x64' || 'win32' }}_${{env.LIBYAML_REF}} + fail-on-cache-miss: true + + - name: Install python + uses: actions/setup-python@v5 + with: + python-version: 3.x + + - name: Build/Test/Package + id: build + shell: bash + env: + CIBW_BUILD: ${{matrix.spec}} + CIBW_BUILD_VERBOSITY: 1 + CIBW_TEST_COMMAND: pytest {project}/tests + CIBW_TEST_REQUIRES: pytest + #CIBW_CONFIG_SETTINGS: | + # pyyaml_build_config='{"include_dirs": ["libyaml/include"], "library_dirs": ["libyaml/build/Release"], "define": [["YAML_DECLARE_STATIC", 1]], "force": 1}' + run: | + set -eux + python -V + python -m pip install -U --user ${{ matrix.cibw_version || 'cibuildwheel' }} + mkdir pyyaml + + tar zxf ${{ steps.fetch_sdist.outputs.download-path }}/pyyaml*.tar.gz/pyyaml*.tar.gz --strip-components=1 -C pyyaml + + cat << 'EOF' > build_config.toml + [tool.cibuildwheel.config-settings] + pyyaml_build_config='{"force":1, "include_dirs": ["../libyaml/include"], "library_dirs": ["../libyaml/build/Release"], "define": [["YAML_DECLARE_STATIC", 1]], "force": 1}' + EOF + + CIBW_BEFORE_BUILD="ls -l {project}" python3 -m cibuildwheel --config-file $(pwd)/build_config.toml --platform auto --output-dir ./dist ./pyyaml + + echo "artifact_name=$(ls ./dist/)" >> "$GITHUB_OUTPUT" + # FIXME: ensure exactly one artifact + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.build.outputs.artifact_name }} + path: dist/*.whl + if-no-files-found: error + if: ${{ ! env.skip_artifact_upload }} # FIXME: artifact combine job? #