Show package dir on missing files; drop doc checks #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Python Packages | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| workflow_dispatch: | |
| env: | |
| PYTHON_VERSION: 3.12.12 | |
| PYTHON_VERSION_SHORT: 3.12 | |
| PYTHON_DIST_RELEASE: 20260203 | |
| jobs: | |
| # build-darwin: | |
| # name: Build Python for iOS and macOS | |
| # runs-on: macos-15 | |
| # permissions: | |
| # contents: write | |
| # steps: | |
| # - name: Checkout | |
| # uses: actions/checkout@v4 | |
| # - name: Setup Python | |
| # uses: actions/setup-python@v6 | |
| # with: | |
| # python-version: ${{ env.PYTHON_VERSION_SHORT }} | |
| # - name: Show Python version | |
| # run: python --version | |
| # - name: Build Python for iOS and macOS | |
| # working-directory: darwin | |
| # shell: bash | |
| # run: | | |
| # git clone --branch="$PYTHON_VERSION_SHORT" https://github.com/beeware/Python-Apple-support.git | |
| # mkdir -p dist | |
| # pushd Python-Apple-support | |
| # make iOS | |
| # tar -czf ../dist/python-ios-mobile-forge-$PYTHON_VERSION_SHORT.tar.gz install support -C . | |
| # make macOS | |
| # popd | |
| # bash ./package-ios-for-dart.sh Python-Apple-support "$PYTHON_VERSION_SHORT" | |
| # bash ./package-macos-for-dart.sh Python-Apple-support "$PYTHON_VERSION_SHORT" | |
| # - name: Upload Darwin build artifacts | |
| # uses: actions/upload-artifact@v4 | |
| # with: | |
| # name: python-darwin | |
| # path: darwin/dist/python-*.tar.gz | |
| # if-no-files-found: error | |
| # build-android: | |
| # name: Build Python for Android | |
| # runs-on: ubuntu-latest | |
| # permissions: | |
| # contents: write | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - uses: actions/setup-python@v5 | |
| # with: | |
| # python-version: ${{ env.PYTHON_VERSION }} | |
| # - run: python --version | |
| # - working-directory: android | |
| # shell: bash | |
| # run: | | |
| # bash ./build-all.sh "$PYTHON_VERSION" | |
| # mkdir -p dist | |
| # tar -czf dist/python-android-mobile-forge-$PYTHON_VERSION_SHORT.tar.gz install support | |
| # bash ./package-for-dart.sh install "$PYTHON_VERSION" arm64-v8a | |
| # bash ./package-for-dart.sh install "$PYTHON_VERSION" armeabi-v7a | |
| # bash ./package-for-dart.sh install "$PYTHON_VERSION" x86_64 | |
| # - uses: actions/upload-artifact@v4 | |
| # with: | |
| # name: python-android | |
| # path: android/dist/python-android-*.tar.gz | |
| # if-no-files-found: error | |
| # build-linux: | |
| # name: Build Python for Linux | |
| # runs-on: ubuntu-latest | |
| # permissions: | |
| # contents: write | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - working-directory: linux | |
| # shell: bash | |
| # run: | | |
| # bash ./package-for-linux.sh x86_64 "_v2" | |
| # bash ./package-for-linux.sh aarch64 "" | |
| # - uses: actions/upload-artifact@v4 | |
| # with: | |
| # name: python-linux | |
| # path: linux/python-linux-dart-*.tar.gz | |
| # if-no-files-found: error | |
| build-windows: | |
| name: Build Python for Windows | |
| runs-on: windows-2022 | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build CPython from sources and package for Dart | |
| shell: pwsh | |
| run: | | |
| $ErrorActionPreference = "Stop" | |
| $pyVer = "${{ env.PYTHON_VERSION }}" | |
| $pyShort = "${{ env.PYTHON_VERSION_SHORT }}" | |
| $workspace = $env:GITHUB_WORKSPACE | |
| $srcRoot = Join-Path $workspace "windows\build" | |
| $srcArchive = Join-Path $srcRoot "Python-$pyVer.tgz" | |
| $srcDir = Join-Path $srcRoot "Python-$pyVer" | |
| $pcbuildDir = Join-Path $srcDir "PCbuild\amd64" | |
| $packageRoot = Join-Path $workspace "windows\python-windows-for-dart-$pyShort" | |
| $zipPath = Join-Path $workspace "windows\python-windows-for-dart-$pyShort.zip" | |
| New-Item -ItemType Directory -Force -Path $srcRoot | Out-Null | |
| Write-Host "Downloading CPython source $pyVer" | |
| Invoke-WebRequest -Uri "https://www.python.org/ftp/python/$pyVer/Python-$pyVer.tgz" -OutFile $srcArchive | |
| tar -xf $srcArchive -C $srcRoot | |
| Push-Location $srcDir | |
| cmd /c "PCbuild\build.bat -e -p x64 -c Release" | |
| cmd /c "PCbuild\build.bat -e -p x64 -c Debug" | |
| Pop-Location | |
| Remove-Item -Recurse -Force $packageRoot -ErrorAction SilentlyContinue | |
| New-Item -ItemType Directory -Force -Path "$packageRoot\DLLs", "$packageRoot\include", "$packageRoot\Lib", "$packageRoot\libs", "$packageRoot\Scripts" | Out-Null | |
| Copy-Item -Path "$srcDir\Include\*" -Destination "$packageRoot\include" -Recurse -Force | |
| Copy-Item -Path "$srcDir\Lib\*" -Destination "$packageRoot\Lib" -Recurse -Force | |
| # Root binaries and symbols. | |
| foreach ($name in @("LICENSE.txt", "NEWS.txt")) { | |
| $src = Join-Path $srcDir $name | |
| if (Test-Path $src) { | |
| Copy-Item -Path $src -Destination $packageRoot -Force | |
| } | |
| } | |
| $rootFiles = @( | |
| "python3.dll", | |
| "python3_d.dll", | |
| "python312.dll", | |
| "python312_d.dll", | |
| "python312_d.pdb", | |
| "python_d.pdb", | |
| "pythonw_d.pdb" | |
| ) | |
| foreach ($name in $rootFiles) { | |
| $src = Join-Path $pcbuildDir $name | |
| if (Test-Path $src) { | |
| Copy-Item -Path $src -Destination $packageRoot -Force | |
| } | |
| } | |
| foreach ($name in @("vcruntime140.dll", "vcruntime140_1.dll")) { | |
| $fromBuild = Join-Path $pcbuildDir $name | |
| $fromSystem = Join-Path "$env:WINDIR\System32" $name | |
| if (Test-Path $fromBuild) { | |
| Copy-Item -Path $fromBuild -Destination $packageRoot -Force | |
| } elseif (Test-Path $fromSystem) { | |
| Copy-Item -Path $fromSystem -Destination $packageRoot -Force | |
| } | |
| } | |
| # Extension modules and supporting DLLs. | |
| Get-ChildItem -Path $pcbuildDir -Filter "*.pyd" -File | Copy-Item -Destination "$packageRoot\DLLs" -Force | |
| Get-ChildItem -Path $pcbuildDir -Filter "*.dll" -File | | |
| Where-Object { $_.Name -notin @("python3.dll", "python3_d.dll", "python312.dll", "python312_d.dll", "vcruntime140.dll", "vcruntime140_1.dll") } | | |
| Copy-Item -Destination "$packageRoot\DLLs" -Force | |
| Get-ChildItem -Path $pcbuildDir -Filter "*.lib" -File | Copy-Item -Destination "$packageRoot\libs" -Force | |
| # Match existing packaging behavior: bytecode-only stdlib. | |
| py -3 -m compileall -b "$packageRoot\Lib" | |
| Get-ChildItem -Path "$packageRoot\Lib" -Recurse -File -Include *.py,*.typed | Remove-Item -Force | |
| Get-ChildItem -Path "$packageRoot\Lib" -Recurse -Directory -Filter __pycache__ | Remove-Item -Recurse -Force | |
| # Fail fast if required layout entries are missing. | |
| $requiredEntries = @( | |
| "$packageRoot\DLLs", | |
| "$packageRoot\include", | |
| "$packageRoot\Lib", | |
| "$packageRoot\libs", | |
| "$packageRoot\Scripts", | |
| "$packageRoot\python3.dll", | |
| "$packageRoot\python3_d.dll", | |
| "$packageRoot\python312.dll", | |
| "$packageRoot\python312_d.dll", | |
| "$packageRoot\python312_d.pdb", | |
| "$packageRoot\python_d.pdb", | |
| "$packageRoot\pythonw_d.pdb" | |
| ) | |
| foreach ($entry in $requiredEntries) { | |
| if (-not (Test-Path $entry)) { | |
| ls $packageRoot | |
| throw "Missing required package entry: $entry" | |
| } | |
| } | |
| Remove-Item -Force $zipPath -ErrorAction SilentlyContinue | |
| 7z a $zipPath "$packageRoot\*" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-windows | |
| path: windows/python-windows-for-dart-*.zip | |
| if-no-files-found: error | |
| # publish-release: | |
| # name: Publish Release Assets | |
| # runs-on: ubuntu-latest | |
| # needs: | |
| # - build-darwin | |
| # - build-android | |
| # - build-linux | |
| # - build-windows | |
| # permissions: | |
| # contents: write | |
| # steps: | |
| # - name: Download all build artifacts | |
| # uses: actions/download-artifact@v4 | |
| # with: | |
| # pattern: python-* | |
| # path: release-artifacts | |
| # merge-multiple: true | |
| # - name: Publish all artifacts to release | |
| # uses: softprops/action-gh-release@v2 | |
| # with: | |
| # tag_name: v${{ env.PYTHON_VERSION_SHORT }} | |
| # files: release-artifacts/* | |
| # fail_on_unmatched_files: true | |
| # generate_release_notes: false | |
| # draft: false | |
| # prerelease: false |