mirror of
https://github.com/actions/python-versions.git
synced 2025-12-16 15:58:16 +00:00
Compare commits
4 Commits
fix-macos-
...
windows-ar
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d80ea3a25f | ||
|
|
7a302f1496 | ||
|
|
e18dd16151 | ||
|
|
606312b02e |
23
.github/workflows/build-python-packages.yml
vendored
23
.github/workflows/build-python-packages.yml
vendored
@@ -15,7 +15,7 @@ on:
|
|||||||
PLATFORMS:
|
PLATFORMS:
|
||||||
description: 'Platforms for execution in "os" or "os_arch" format (arch is "x64" by default)'
|
description: 'Platforms for execution in "os" or "os_arch" format (arch is "x64" by default)'
|
||||||
required: true
|
required: true
|
||||||
default: 'ubuntu-20.04,ubuntu-22.04,ubuntu-22.04_arm64,ubuntu-24.04,ubuntu-24.04_arm64,macos-12_x64,macos-14_arm64,windows-2019_x64,windows-2019_x86,windows-2019_arm64'
|
default: 'ubuntu-20.04,ubuntu-22.04,ubuntu-22.04_arm64,ubuntu-24.04,macos-11_x64,macos-14_arm64,windows-2019_x64,windows-2019_x86,windows-2019_arm64'
|
||||||
pull_request:
|
pull_request:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'versions-manifest.json'
|
- 'versions-manifest.json'
|
||||||
@@ -39,13 +39,14 @@ jobs:
|
|||||||
- name: Generate execution matrix
|
- name: Generate execution matrix
|
||||||
id: generate-matrix
|
id: generate-matrix
|
||||||
run: |
|
run: |
|
||||||
[String[]]$configurations = "${{ inputs.platforms || 'ubuntu-20.04,ubuntu-22.04,ubuntu-22.04_arm64,ubuntu-24.04,ubuntu-24.04_arm64,macos-12,macos-14_arm64,windows-2019_x64,windows-2019_x86,windows-2019_arm64' }}".Split(",").Trim()
|
[String[]]$configurations = "${{ inputs.platforms || 'ubuntu-20.04,ubuntu-22.04,ubuntu-22.04_arm64,ubuntu-24.04,macos-11,macos-14_arm64,windows-2019_x64,windows-2019_x86,windows-2019_arm64' }}".Split(",").Trim()
|
||||||
$matrix = @()
|
$matrix = @()
|
||||||
|
|
||||||
foreach ($configuration in $configurations) {
|
foreach ($configuration in $configurations) {
|
||||||
$parts = $configuration.Split("_")
|
$parts = $configuration.Split("_")
|
||||||
$os = $parts[0]
|
$os = $parts[0]
|
||||||
$arch = if ($parts[1]) {$parts[1]} else {"x64"}
|
$arch = if ($parts[1]) {$parts[1]} else {"x64"}
|
||||||
|
|
||||||
switch -wildcard ($os) {
|
switch -wildcard ($os) {
|
||||||
"*ubuntu*" { $platform = $os.Replace("ubuntu","linux")}
|
"*ubuntu*" { $platform = $os.Replace("ubuntu","linux")}
|
||||||
"*macos*" { $platform = 'darwin' }
|
"*macos*" { $platform = 'darwin' }
|
||||||
@@ -54,18 +55,15 @@ jobs:
|
|||||||
|
|
||||||
if ($configuration -eq "ubuntu-22.04_arm64") {
|
if ($configuration -eq "ubuntu-22.04_arm64") {
|
||||||
$os = "setup-actions-ubuntu-arm64-2-core"
|
$os = "setup-actions-ubuntu-arm64-2-core"
|
||||||
}
|
}elseif ($configuration -eq "windows-2019_arm64") {
|
||||||
elseif ($configuration -eq "ubuntu-24.04_arm64") {
|
|
||||||
$os = "setup-actions-ubuntu24-arm64-2-core"
|
|
||||||
}
|
|
||||||
elseif ($configuration -eq "windows-2019_arm64") {
|
|
||||||
$os = "setup-actions-windows-arm64-4-core"
|
$os = "setup-actions-windows-arm64-4-core"
|
||||||
}
|
}
|
||||||
|
|
||||||
$matrix += @{
|
$matrix += @{
|
||||||
'platform' = $platform
|
'platform' = $platform
|
||||||
'os' = $os
|
'os' = $os
|
||||||
'arch' = $arch
|
'arch' = $arch
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "matrix=$($matrix | ConvertTo-Json -Compress -AsArray)" >> $env:GITHUB_OUTPUT
|
echo "matrix=$($matrix | ConvertTo-Json -Compress -AsArray)" >> $env:GITHUB_OUTPUT
|
||||||
@@ -80,6 +78,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
ARTIFACT_NAME: python-${{ inputs.VERSION || '3.12.3' }}-${{ matrix.platform }}-${{ matrix.arch }}
|
ARTIFACT_NAME: python-${{ inputs.VERSION || '3.12.3' }}-${{ matrix.platform }}-${{ matrix.arch }}
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Setup Environment on Windows ARM64 Runner
|
- name: Setup Environment on Windows ARM64 Runner
|
||||||
if: matrix.os == 'setup-actions-windows-arm64-4-core'
|
if: matrix.os == 'setup-actions-windows-arm64-4-core'
|
||||||
shell: powershell
|
shell: powershell
|
||||||
@@ -102,18 +101,16 @@ jobs:
|
|||||||
# Install 7-Zip
|
# Install 7-Zip
|
||||||
choco install 7zip -y
|
choco install 7zip -y
|
||||||
echo "C:\ProgramData\chocolatey\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
|
echo "C:\ProgramData\chocolatey\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
|
||||||
|
|
||||||
|
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
|
|
||||||
- name: Build Python ${{ env.VERSION }}
|
- name: Build Python ${{ env.VERSION }}
|
||||||
run: |
|
run: |
|
||||||
./builders/build-python.ps1 -Version $env:VERSION `
|
./builders/build-python.ps1 -Version $env:VERSION `
|
||||||
-Platform ${{ matrix.platform }} -Architecture ${{ matrix.arch }}
|
-Platform ${{ matrix.platform }} -Architecture ${{ matrix.arch }}
|
||||||
|
|
||||||
- name: Publish artifact
|
- name: Publish artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@@ -131,6 +128,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
ARTIFACT_NAME: python-${{ inputs.VERSION || '3.12.3' }}-${{ matrix.platform }}-${{ matrix.arch }}
|
ARTIFACT_NAME: python-${{ inputs.VERSION || '3.12.3' }}-${{ matrix.platform }}-${{ matrix.arch }}
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Setup Environment on Windows ARM64 Runner
|
- name: Setup Environment on Windows ARM64 Runner
|
||||||
if: matrix.os == 'setup-actions-windows-arm64-4-core'
|
if: matrix.os == 'setup-actions-windows-arm64-4-core'
|
||||||
shell: powershell
|
shell: powershell
|
||||||
@@ -173,6 +171,7 @@ jobs:
|
|||||||
name: ${{ env.ARTIFACT_NAME }}
|
name: ${{ env.ARTIFACT_NAME }}
|
||||||
path: ${{ runner.temp }}/${{ env.ARTIFACT_NAME }}
|
path: ${{ runner.temp }}/${{ env.ARTIFACT_NAME }}
|
||||||
|
|
||||||
|
|
||||||
- name: Extract files
|
- name: Extract files
|
||||||
run: |
|
run: |
|
||||||
if ('${{ matrix.platform }}' -eq 'win32') {
|
if ('${{ matrix.platform }}' -eq 'win32') {
|
||||||
@@ -211,7 +210,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
$pythonLocation = which python
|
$pythonLocation = which python
|
||||||
if ('${{ matrix.platform }}' -eq 'darwin') { otool -L $pythonLocation } else { ldd $pythonLocation }
|
if ('${{ matrix.platform }}' -eq 'darwin') { otool -L $pythonLocation } else { ldd $pythonLocation }
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
Install-Module Pester -Force -Scope CurrentUser -SkipPublisherCheck
|
Install-Module Pester -Force -Scope CurrentUser -SkipPublisherCheck
|
||||||
@@ -246,7 +244,6 @@ jobs:
|
|||||||
release_name: ${{ env.VERSION }}
|
release_name: ${{ env.VERSION }}
|
||||||
body: |
|
body: |
|
||||||
Python ${{ env.VERSION }}
|
Python ${{ env.VERSION }}
|
||||||
|
|
||||||
- name: Generate hash for packages
|
- name: Generate hash for packages
|
||||||
run: |
|
run: |
|
||||||
$childItems = Get-Childitem -Path '.'
|
$childItems = Get-Childitem -Path '.'
|
||||||
|
|||||||
3
.github/workflows/codeql-analysis.yml
vendored
3
.github/workflows/codeql-analysis.yml
vendored
@@ -13,5 +13,4 @@ jobs:
|
|||||||
name: CodeQL analysis
|
name: CodeQL analysis
|
||||||
uses: actions/reusable-workflows/.github/workflows/codeql-analysis.yml@main
|
uses: actions/reusable-workflows/.github/workflows/codeql-analysis.yml@main
|
||||||
with:
|
with:
|
||||||
languages: '["python"]'
|
languages: "['python']"
|
||||||
|
|
||||||
@@ -1,169 +0,0 @@
|
|||||||
using module "./python-builder.psm1"
|
|
||||||
|
|
||||||
class NixPythonBuilder : PythonBuilder {
|
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
Base Python builder class for *Nix systems.
|
|
||||||
|
|
||||||
.DESCRIPTION
|
|
||||||
Contains methods that required to build Python artifact for *nix systems. Inherited from base PythonBuilder class.
|
|
||||||
|
|
||||||
.PARAMETER version
|
|
||||||
The version of Python that should be built.
|
|
||||||
|
|
||||||
.PARAMETER Platform
|
|
||||||
The type of platform for which Python should be built.
|
|
||||||
|
|
||||||
.PARAMETER PlatformVersion
|
|
||||||
The version of platform for which Python should be built.
|
|
||||||
|
|
||||||
.PARAMETER InstallationTemplateName
|
|
||||||
The name of template that will be used to create installation script for generated Python artifact.
|
|
||||||
|
|
||||||
.PARAMETER InstallationScriptName
|
|
||||||
The name of installation script that will be generated for Python artifact.
|
|
||||||
|
|
||||||
.PARAMETER OutputArtifactName
|
|
||||||
The name of archive with Python binaries that will be generated as part of Python artifact.
|
|
||||||
|
|
||||||
#>
|
|
||||||
|
|
||||||
[string] $InstallationTemplateName
|
|
||||||
[string] $InstallationScriptName
|
|
||||||
[string] $OutputArtifactName
|
|
||||||
|
|
||||||
NixPythonBuilder(
|
|
||||||
[semver] $version,
|
|
||||||
[string] $architecture,
|
|
||||||
[string] $platform
|
|
||||||
) : Base($version, $architecture, $platform) {
|
|
||||||
$this.InstallationTemplateName = "nix-setup-template.sh"
|
|
||||||
$this.InstallationScriptName = "setup.sh"
|
|
||||||
$this.OutputArtifactName = "python-$Version-$Platform-$Architecture.tar.gz"
|
|
||||||
}
|
|
||||||
|
|
||||||
[uri] GetSourceUri() {
|
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
Get base Python URI and return complete URI for Python sources.
|
|
||||||
#>
|
|
||||||
|
|
||||||
$base = $this.GetBaseUri()
|
|
||||||
$versionName = $this.GetBaseVersion()
|
|
||||||
$nativeVersion = Convert-Version -version $this.Version
|
|
||||||
|
|
||||||
return "${base}/${versionName}/Python-${nativeVersion}.tgz"
|
|
||||||
}
|
|
||||||
|
|
||||||
[string] GetPythonBinary() {
|
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
Return name of Python binary.
|
|
||||||
#>
|
|
||||||
|
|
||||||
if ($this.Version.Major -eq 2) { $pythonBinary = "python" } else { $pythonBinary = "python3" }
|
|
||||||
return $pythonBinary
|
|
||||||
}
|
|
||||||
|
|
||||||
[string] Download() {
|
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
Download Python sources and extract them at temporary work folder. Returns expanded archive location path.
|
|
||||||
#>
|
|
||||||
|
|
||||||
$sourceUri = $this.GetSourceUri()
|
|
||||||
Write-Host "Sources URI: $sourceUri"
|
|
||||||
|
|
||||||
$archiveFilepath = Download-File -Uri $sourceUri -OutputFolder $this.WorkFolderLocation
|
|
||||||
$expandedSourceLocation = Join-Path -Path $this.TempFolderLocation -ChildPath "SourceCode"
|
|
||||||
New-Item -Path $expandedSourceLocation -ItemType Directory
|
|
||||||
|
|
||||||
Extract-TarArchive -ArchivePath $archiveFilepath -OutputDirectory $expandedSourceLocation
|
|
||||||
Write-Debug "Done; Sources location: $expandedSourceLocation"
|
|
||||||
|
|
||||||
return $expandedSourceLocation
|
|
||||||
}
|
|
||||||
|
|
||||||
[void] CreateInstallationScript() {
|
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
Create Python artifact installation script based on template specified in InstallationTemplateName property.
|
|
||||||
#>
|
|
||||||
|
|
||||||
$installationScriptLocation = New-Item -Path $this.WorkFolderLocation -Name $this.InstallationScriptName -ItemType File
|
|
||||||
$installationTemplateLocation = Join-Path -Path $this.InstallationTemplatesLocation -ChildPath $this.InstallationTemplateName
|
|
||||||
|
|
||||||
$installationTemplateContent = Get-Content -Path $installationTemplateLocation -Raw
|
|
||||||
|
|
||||||
$variablesToReplace = @{
|
|
||||||
"{{__VERSION_FULL__}}" = $this.Version;
|
|
||||||
"{{__ARCH__}}" = $this.Architecture;
|
|
||||||
}
|
|
||||||
$variablesToReplace.keys | ForEach-Object { $installationTemplateContent = $installationTemplateContent.Replace($_, $variablesToReplace[$_]) }
|
|
||||||
|
|
||||||
$installationTemplateContent | Out-File -FilePath $installationScriptLocation
|
|
||||||
|
|
||||||
Write-Debug "Done; Installation script location: $installationScriptLocation)"
|
|
||||||
}
|
|
||||||
|
|
||||||
[void] Make() {
|
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
Executes "make" and "make install" commands for configured build sources. Make output will be writen in build_output.txt located in artifact location folder.
|
|
||||||
#>
|
|
||||||
|
|
||||||
Write-Debug "make Python $($this.Version)-$($this.Architecture) $($this.Platform)"
|
|
||||||
$buildOutputLocation = New-Item -Path $this.WorkFolderLocation -Name "build_output.txt" -ItemType File
|
|
||||||
|
|
||||||
Execute-Command -Command "make 2>&1 | tee $buildOutputLocation" -ErrorAction Continue
|
|
||||||
Execute-Command -Command "make install" -ErrorAction Continue
|
|
||||||
|
|
||||||
Write-Debug "Done; Make log location: $buildOutputLocation"
|
|
||||||
}
|
|
||||||
|
|
||||||
[void] CopyBuildResults() {
|
|
||||||
$buildFolder = $this.GetFullPythonToolcacheLocation()
|
|
||||||
Move-Item -Path "$buildFolder/*" -Destination $this.WorkFolderLocation
|
|
||||||
}
|
|
||||||
|
|
||||||
[void] ArchiveArtifact() {
|
|
||||||
$OutputPath = Join-Path $this.ArtifactFolderLocation $this.OutputArtifactName
|
|
||||||
Create-TarArchive -SourceFolder $this.WorkFolderLocation -ArchivePath $OutputPath
|
|
||||||
}
|
|
||||||
|
|
||||||
[void] Build() {
|
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
Build Python artifact from sources.
|
|
||||||
#>
|
|
||||||
|
|
||||||
Write-Host "Prepare Python Hostedtoolcache location..."
|
|
||||||
$this.PreparePythonToolcacheLocation()
|
|
||||||
|
|
||||||
Write-Host "Prepare system environment..."
|
|
||||||
$this.PrepareEnvironment()
|
|
||||||
|
|
||||||
Write-Host "Download Python $($this.Version)[$($this.Architecture)] sources..."
|
|
||||||
$sourcesLocation = $this.Download()
|
|
||||||
|
|
||||||
Push-Location -Path $sourcesLocation
|
|
||||||
Write-Host "Configure for $($this.Platform)..."
|
|
||||||
$this.Configure()
|
|
||||||
|
|
||||||
Write-Host "Make for $($this.Platform)..."
|
|
||||||
$this.Make()
|
|
||||||
Pop-Location
|
|
||||||
|
|
||||||
Write-Host "Generate structure dump"
|
|
||||||
New-ToolStructureDump -ToolPath $this.GetFullPythonToolcacheLocation() -OutputFolder $this.WorkFolderLocation
|
|
||||||
|
|
||||||
Write-Host "Copying build results to destination location"
|
|
||||||
$this.CopyBuildResults()
|
|
||||||
|
|
||||||
Write-Host "Create installation script..."
|
|
||||||
$this.CreateInstallationScript()
|
|
||||||
|
|
||||||
Write-Host "Archive artifact..."
|
|
||||||
$this.ArchiveArtifact()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
using module "./python-builder.psm1"
|
using module "./python-builder.psm1"
|
||||||
|
|
||||||
class WinPythonBuilder : PythonBuilder {
|
class WinPythonBuilder : PythonBuilder {
|
||||||
@@ -64,6 +65,7 @@ class WinPythonBuilder : PythonBuilder {
|
|||||||
$ArchitectureExtension = "-arm64"
|
$ArchitectureExtension = "-arm64"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $ArchitectureExtension
|
return $ArchitectureExtension
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,22 +18,16 @@ BeforeAll {
|
|||||||
$pattern = "$searchStringStart(.*?)$searchStringEnd"
|
$pattern = "$searchStringStart(.*?)$searchStringEnd"
|
||||||
|
|
||||||
$buildContent = Get-Content -Path $buildOutputLocation
|
$buildContent = Get-Content -Path $buildOutputLocation
|
||||||
$splitBuiltOutput = $buildContent -split "\n"
|
$splitBuiltOutput = $buildContent -split "\n";
|
||||||
|
|
||||||
### Search for missing modules that are displayed between the search strings
|
### Search for missing modules that are displayed between the search strings
|
||||||
$regexMatch = [regex]::match($splitBuiltOutput, $pattern)
|
$regexMatch = [regex]::match($SplitBuiltOutput, $Pattern)
|
||||||
if ($regexMatch.Success) {
|
if ($regexMatch.Success)
|
||||||
|
{
|
||||||
$module = $regexMatch.Groups[1].Value.Trim()
|
$module = $regexMatch.Groups[1].Value.Trim()
|
||||||
Write-Host "Failed missing modules:"
|
Write-Host "Failed missing modules:"
|
||||||
Write-Host $module
|
Write-Host $module
|
||||||
try {
|
if ( ($module -eq "_tkinter") -and ( [semver]"$($Version.Major).$($Version.Minor)" -ge [semver]"3.10" -and $Version.PreReleaseLabel ) ) {
|
||||||
$semver = [semver]"$($Version.Major).$($Version.Minor)"
|
|
||||||
} catch {
|
|
||||||
Write-Error "Invalid Semantic Version format: $Version"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($module -eq "_tkinter") -and ($semver -ge [semver]"3.8")) {
|
|
||||||
Write-Host "$module $Version ignored"
|
Write-Host "$module $Version ignored"
|
||||||
} else {
|
} else {
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user