|
| 1 | +name: Build Python Packages |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - master |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +env: |
| 11 | + PYTHON_VERSION: 3.12.12 |
| 12 | + PYTHON_VERSION_SHORT: '3.12' |
| 13 | + |
| 14 | +jobs: |
| 15 | + build-darwin: |
| 16 | + name: Build Python for iOS and macOS |
| 17 | + runs-on: macos-14 |
| 18 | + permissions: |
| 19 | + contents: write |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Setup Python |
| 26 | + uses: actions/setup-python@v5 |
| 27 | + with: |
| 28 | + python-version: ${{ env.PYTHON_VERSION }} |
| 29 | + |
| 30 | + - name: Show Python version |
| 31 | + run: python --version |
| 32 | + |
| 33 | + - name: Build Python for iOS and macOS |
| 34 | + working-directory: darwin |
| 35 | + run: | |
| 36 | + git clone --branch="$PYTHON_VERSION_SHORT" https://github.com/beeware/Python-Apple-support.git |
| 37 | + mkdir -p dist |
| 38 | +
|
| 39 | + pushd Python-Apple-support |
| 40 | + make iOS |
| 41 | + tar -czf ../dist/python-ios-mobile-forge-$PYTHON_VERSION_SHORT.tar.gz install support -C . |
| 42 | + make macOS |
| 43 | + popd |
| 44 | +
|
| 45 | + ./package-ios-for-dart.sh Python-Apple-support "$PYTHON_VERSION_SHORT" |
| 46 | + ./package-macos-for-dart.sh Python-Apple-support "$PYTHON_VERSION_SHORT" |
| 47 | +
|
| 48 | + - name: Upload Darwin build artifacts |
| 49 | + uses: actions/upload-artifact@v4 |
| 50 | + with: |
| 51 | + name: python-darwin |
| 52 | + path: darwin/dist/python-*.tar.gz |
| 53 | + if-no-files-found: error |
| 54 | + |
| 55 | + build-android: |
| 56 | + name: Build Python for Android |
| 57 | + runs-on: ubuntu-latest |
| 58 | + permissions: |
| 59 | + contents: write |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v4 |
| 62 | + - uses: actions/setup-python@v5 |
| 63 | + with: |
| 64 | + python-version: ${{ env.PYTHON_VERSION }} |
| 65 | + - run: python --version |
| 66 | + - working-directory: android |
| 67 | + run: | |
| 68 | + ./build-all.sh "$PYTHON_VERSION" |
| 69 | + mkdir -p dist |
| 70 | + tar -czf dist/python-android-mobile-forge-$PYTHON_VERSION_SHORT.tar.gz install support |
| 71 | + ./package-for-dart.sh install "$PYTHON_VERSION" arm64-v8a |
| 72 | + ./package-for-dart.sh install "$PYTHON_VERSION" armeabi-v7a |
| 73 | + ./package-for-dart.sh install "$PYTHON_VERSION" x86_64 |
| 74 | + - uses: actions/upload-artifact@v4 |
| 75 | + with: |
| 76 | + name: python-android |
| 77 | + path: android/dist/python-android-*.tar.gz |
| 78 | + if-no-files-found: error |
| 79 | + |
| 80 | + build-linux: |
| 81 | + name: Build Python for Linux |
| 82 | + runs-on: ubuntu-latest |
| 83 | + permissions: |
| 84 | + contents: write |
| 85 | + steps: |
| 86 | + - uses: actions/checkout@v4 |
| 87 | + - working-directory: linux |
| 88 | + run: | |
| 89 | + ./package-for-linux.sh x86_64 "_v2" |
| 90 | + ./package-for-linux.sh aarch64 "" |
| 91 | + - uses: actions/upload-artifact@v4 |
| 92 | + with: |
| 93 | + name: python-linux |
| 94 | + path: linux/python-linux-dart-*.tar.gz |
| 95 | + if-no-files-found: error |
| 96 | + |
| 97 | + build-windows: |
| 98 | + name: Build Python for Windows |
| 99 | + runs-on: windows-2022 |
| 100 | + permissions: |
| 101 | + contents: write |
| 102 | + steps: |
| 103 | + - uses: actions/checkout@v4 |
| 104 | + - name: Show bundled Python |
| 105 | + run: C:\Python312\python --version |
| 106 | + - name: Reinstall requested Python version |
| 107 | + working-directory: windows |
| 108 | + shell: cmd |
| 109 | + run: | |
| 110 | + curl -OL https://www.python.org/ftp/python/3.12.8/python-3.12.8-amd64.exe |
| 111 | + start /wait python-3.12.8-amd64.exe /uninstall /quiet |
| 112 | + curl -OL https://www.python.org/ftp/python/%PYTHON_VERSION%/python-%PYTHON_VERSION%-amd64.exe |
| 113 | + start /wait python-%PYTHON_VERSION%-amd64.exe /quiet |
| 114 | + C:\python312-dist\python -m compileall -b C:\python312-dist\Lib |
| 115 | + 7z a -xr@exclude.txt python-windows-for-dart-%PYTHON_VERSION_SHORT%.zip C:\python312-dist\* |
| 116 | + - uses: actions/upload-artifact@v4 |
| 117 | + with: |
| 118 | + name: python-windows |
| 119 | + path: windows/python-windows-for-dart-*.zip |
| 120 | + if-no-files-found: error |
| 121 | + |
| 122 | +# publish-release: |
| 123 | +# name: Publish Release Assets |
| 124 | +# runs-on: ubuntu-latest |
| 125 | +# needs: |
| 126 | +# - build-darwin |
| 127 | +# - build-android |
| 128 | +# - build-linux |
| 129 | +# - build-windows |
| 130 | +# permissions: |
| 131 | +# contents: write |
| 132 | +# steps: |
| 133 | +# - name: Download all build artifacts |
| 134 | +# uses: actions/download-artifact@v4 |
| 135 | +# with: |
| 136 | +# pattern: python-* |
| 137 | +# path: release-artifacts |
| 138 | +# merge-multiple: true |
| 139 | + |
| 140 | +# - name: Publish all artifacts to release |
| 141 | +# uses: softprops/action-gh-release@v2 |
| 142 | +# with: |
| 143 | +# tag_name: v${{ env.PYTHON_VERSION_SHORT }} |
| 144 | +# files: release-artifacts/* |
| 145 | +# fail_on_unmatched_files: true |
| 146 | +# generate_release_notes: false |
| 147 | +# draft: false |
| 148 | +# prerelease: false |
0 commit comments