No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

120 líneas
4.8 KiB

hace 2 años
hace 2 años
  1. name: modified_scripts
  2. on: [pull_request]
  3. jobs:
  4. discover_modified_scripts:
  5. runs-on: ubuntu-latest
  6. outputs:
  7. versions: ${{steps.modified-versions.outputs.versions}}
  8. steps:
  9. - uses: actions/checkout@v2
  10. - run: git fetch origin "$GITHUB_BASE_REF"
  11. - shell: bash
  12. run: >
  13. versions=$(git diff "origin/$GITHUB_BASE_REF" --name-only -z
  14. | perl -ne 'BEGIN {$\="\n";$/="\0";} chomp;
  15. if (/^plugins\/python-build\/share\/python-build\/(?:([^\/]+)|patches\/([^\/]+)\/.*)$/ and -e $& )
  16. { print $1.$2; }' \
  17. | sort -u);
  18. echo -e "versions<<!\\n$versions\\n!" >> $GITHUB_ENV
  19. - id: modified-versions
  20. run: |
  21. echo -n "::set-output name=versions::"
  22. echo "${{ env.versions }}" | jq -R . | jq -sc .
  23. macos_build:
  24. needs: discover_modified_scripts
  25. if: needs.discover_modified_scripts.outputs.versions != '[""]'
  26. strategy:
  27. fail-fast: false
  28. matrix:
  29. python-version: ${{fromJson(needs.discover_modified_scripts.outputs.versions)}}
  30. os: ["macos-11", "macos-12"]
  31. runs-on: ${{ matrix.os }}
  32. steps:
  33. - uses: actions/checkout@v2
  34. - run: |
  35. brew install openssl openssl@1.1 readline sqlite3 xz zlib
  36. - run: |
  37. export PYENV_ROOT="$GITHUB_WORKSPACE"
  38. echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV
  39. echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
  40. - run: |
  41. pyenv install -v ${{ matrix.python-version }}
  42. pyenv global ${{ matrix.python-version }}
  43. # Micropython doesn't support --version
  44. - run: >
  45. if [[ "${{ matrix.python-version }}" == "micropython-"* ]]; then
  46. python -c 'import sys; print(sys.version)'
  47. else
  48. python --version;
  49. python -m pip --version
  50. fi
  51. # Micropython doesn't support sys.executable, os.path, older versions even os
  52. - env:
  53. EXPECTED_PYTHON: ${{ matrix.python-version }}
  54. run: |
  55. if [[ "${{ matrix.python-version }}" == "micropython-"* ]]; then
  56. [[ $(pyenv which python) == "${{ env.PYENV_ROOT }}/versions/${{ matrix.python-version }}/bin/python" ]] || exit 1
  57. python -c 'import sys; assert sys.implementation.name == "micropython"'
  58. else
  59. python -c 'if True:
  60. import os, sys, os.path
  61. correct_dir = os.path.join(
  62. os.environ["PYENV_ROOT"],
  63. "versions",
  64. os.environ["EXPECTED_PYTHON"],
  65. "bin")
  66. assert os.path.dirname(sys.executable) == correct_dir'
  67. fi
  68. # bundled executables in some Anaconda releases cause the post-run step to hang in MacOS
  69. - run: |
  70. pyenv global system
  71. rm -f "$(pyenv root)"/shims/*
  72. ubuntu_build:
  73. needs: discover_modified_scripts
  74. if: needs.discover_modified_scripts.outputs.versions != '[""]'
  75. strategy:
  76. fail-fast: false
  77. matrix:
  78. python-version: ${{fromJson(needs.discover_modified_scripts.outputs.versions)}}
  79. os: ["ubuntu-20.04", "ubuntu-22.04"]
  80. runs-on: ${{ matrix.os }}
  81. steps:
  82. - uses: actions/checkout@v2
  83. - run: |
  84. sudo apt-get update -q; sudo apt-get install -yq make build-essential \
  85. libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \
  86. curl llvm libncurses5-dev libncursesw5-dev \
  87. xz-utils tk-dev libffi-dev liblzma-dev
  88. - run: |
  89. export PYENV_ROOT="$GITHUB_WORKSPACE"
  90. echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV
  91. echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
  92. - run: |
  93. pyenv install -v ${{ matrix.python-version }}
  94. pyenv global ${{ matrix.python-version }}
  95. # Micropython doesn't support --version
  96. - run: >
  97. if [[ "${{ matrix.python-version }}" == "micropython-"* ]]; then
  98. python -c 'import sys; print(sys.version)'
  99. else
  100. python --version;
  101. python -m pip --version
  102. fi
  103. # Micropython doesn't support sys.executable, os.path, older versions even os
  104. - env:
  105. EXPECTED_PYTHON: ${{ matrix.python-version }}
  106. run: |
  107. if [[ "${{ matrix.python-version }}" == "micropython-"* ]]; then
  108. [[ $(pyenv which python) == "${{ env.PYENV_ROOT }}/versions/${{ matrix.python-version }}/bin/python" ]] || exit 1
  109. python -c 'import sys; assert sys.implementation.name == "micropython"'
  110. else
  111. python -c 'if True:
  112. import os, sys, os.path
  113. correct_dir = os.path.join(
  114. os.environ["PYENV_ROOT"],
  115. "versions",
  116. os.environ["EXPECTED_PYTHON"],
  117. "bin")
  118. assert os.path.dirname(sys.executable) == correct_dir'
  119. fi