Update build-python-packages.yml

This commit is contained in:
aparnajyothi-y
2024-06-19 18:55:04 +05:30
committed by GitHub
parent fd01c577f2
commit cd751e6cc2

View File

@@ -32,33 +32,36 @@ defaults:
jobs: jobs:
generate_matrix: generate_matrix:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }} matrix: ${{ steps.generate-matrix.outputs.matrix }}
steps: steps:
- name: Generate execution matrix - name: Generate execution matrix
id: generate-matrix id: generate-matrix
run: | run: |
[String[]]$configurations = "${{ inputs.platforms || 'ubuntu-20.04,ubuntu-20.04_arm64,ubuntu-22.04,ubuntu-22.04_arm64,ubuntu-24.04,ubuntu-24.04_arm64,macos-11,macos-14_arm64,windows-2019_x64,windows-2019_arm64' }}".Split(",").Trim() [String[]]$configurations = "${{ inputs.platforms || 'ubuntu-20.04,ubuntu-20.04_arm64,ubuntu-22.04,ubuntu-22.04_arm64,ubuntu-24.04,ubuntu-24.04_arm64,macos-11,macos-14_arm64,windows-2019_x64,windows-2019_x86,windows-2019_arm64' }}".Split(",").Trim()
$matrix = @() $matrix = @()
foreach ($configuration in $configurations) {
$parts = $configuration.Split("_") foreach ($configuration in $configurations) {
$os = $parts[0] $parts = $configuration.Split("_")
$arch = if ($parts[1]) {$parts[1]} else {"x64"} $os = $parts[0]
$runner_name = if ($os -eq 'windows-2019' -and $arch -eq 'arm64') {'setup-actions-windows-arm64-4-core'} else {''} $arch = if ($parts[1]) {$parts[1]} else {"x64"}
switch -wildcard ($os) { $runner_name = if ($os -eq 'windows-2019' -and $arch -eq 'arm64') {'setup-actions-windows-arm64-4-core'} else {''}
"*ubuntu*" { $platform = $os.Replace("ubuntu","linux")}
"*macos*" { $platform = 'darwin' } switch -wildcard ($os) {
"*windows*" { $platform = 'win32' } "*ubuntu*" { $platform = $os.Replace("ubuntu","linux")}
"*macos*" { $platform = 'darwin' }
"*windows*" { $platform = 'win32' }
}
$matrix += @{
'platform' = $platform
'os' = $os
'arch' = $arch
'runner_name' = $runner_name
}
} }
$matrix += @{ echo "matrix=$($matrix | ConvertTo-Json -Compress -AsArray)" >> $env:GITHUB_OUTPUT
'platform' = $platform
'os' = $os
'arch' = $arch
'runner_name' = $runner_name
}
}
echo "matrix=$($matrix | ConvertTo-Json -Compress -AsArray)" >> $env:GITHUB_OUTPUT
build_python: build_python:
needs: generate_matrix needs: generate_matrix
strategy: strategy:
@@ -71,7 +74,7 @@ jobs:
steps: steps:
- name: Install Chocolatey - name: Install Chocolatey
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64' && env.RUNNER_NAME == 'setup-actions-windows-arm64-4-core' if: matrix.os == 'windows-2019' && matrix.arch == 'arm64' && matrix.runner_name == 'setup-actions-windows-arm64-4-core'
shell: powershell shell: powershell
run: | run: |
Set-ExecutionPolicy Bypass -Scope Process -Force Set-ExecutionPolicy Bypass -Scope Process -Force
@@ -79,28 +82,32 @@ jobs:
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
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: Install PowerShell - name: Install PowerShell
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64' && env.RUNNER_NAME == 'setup-actions-windows-arm64-4-core' if: matrix.os == 'windows-2019' && matrix.arch == 'arm64' && matrix.runner_name == 'setup-actions-windows-arm64-4-core'
shell: cmd shell: cmd
run: | run: |
choco install powershell-core -y choco install powershell-core -y
- name: Add PowerShell to PATH - name: Add PowerShell to PATH
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64' && env.RUNNER_NAME == 'setup-actions-windows-arm64-4-core' if: matrix.os == 'windows-2019' && matrix.arch == 'arm64' && matrix.runner_name == 'setup-actions-windows-arm64-4-core'
shell: powershell shell: powershell
run: | run: |
echo "C:\Program Files\PowerShell\7" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 echo "C:\Program Files\PowerShell\7" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
- name: Install Git - name: Install Git
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64' && env.RUNNER_NAME == 'setup-actions-windows-arm64-4-core' if: matrix.os == 'windows-2019' && matrix.arch == 'arm64' && matrix.runner_name == 'setup-actions-windows-arm64-4-core'
shell: cmd shell: cmd
run: | run: |
choco install git -y choco install git -y
- name: Add Git to PATH - name: Add Git to PATH
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64' && env.RUNNER_NAME == 'setup-actions-windows-arm64-4-core' if: matrix.os == 'windows-2019' && matrix.arch == 'arm64' && matrix.runner_name == 'setup-actions-windows-arm64-4-core'
shell: powershell shell: powershell
run: | run: |
echo "C:\Program Files\Git\cmd" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 echo "C:\Program Files\Git\cmd" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
- name: Check git version - name: Check git version
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64' && env.RUNNER_NAME == 'setup-actions-windows-arm64-4-core' if: matrix.os == 'windows-2019' && matrix.arch == 'arm64' && matrix.runner_name == 'setup-actions-windows-arm64-4-core'
run: | run: |
git --version git --version
@@ -110,12 +117,13 @@ jobs:
submodules: true submodules: true
- name: Install 7-Zip - name: Install 7-Zip
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64' && env.RUNNER_NAME == 'setup-actions-windows-arm64-4-core' if: matrix.os == 'windows-2019' && matrix.arch == 'arm64' && matrix.runner_name == 'setup-actions-windows-arm64-4-core'
shell: cmd shell: cmd
run: | run: |
choco install 7zip -y choco install 7zip -y
- name: Add 7-Zip to PATH - name: Add 7-Zip to PATH
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64' && env.RUNNER_NAME == 'setup-actions-windows-arm64-4-core' if: matrix.os == 'windows-2019' && matrix.arch == 'arm64' && matrix.runner_name == 'setup-actions-windows-arm64-4-core'
shell: powershell shell: powershell
run: | run: |
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
@@ -142,7 +150,7 @@ jobs:
steps: steps:
- name: Install Chocolatey - name: Install Chocolatey
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64' && env.RUNNER_NAME == 'setup-actions-windows-arm64-4-core' if: matrix.os == 'windows-2019' && matrix.arch == 'arm64' && matrix.runner_name == 'setup-actions-windows-arm64-4-core'
shell: powershell shell: powershell
run: | run: |
Set-ExecutionPolicy Bypass -Scope Process -Force Set-ExecutionPolicy Bypass -Scope Process -Force
@@ -150,28 +158,33 @@ jobs:
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
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: Install PowerShell - name: Install PowerShell
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64' && env.RUNNER_NAME == 'setup-actions-windows-arm64-4-core' if: matrix.os == 'windows-2019' && matrix.arch == 'arm64' && matrix.runner_name == 'setup-actions-windows-arm64-4-core'
shell: cmd shell: cmd
run: | run: |
choco install powershell-core -y choco install powershell-core -y
- name: Add PowerShell to PATH - name: Add PowerShell to PATH
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64' && env.RUNNER_NAME == 'setup-actions-windows-arm64-4-core' if: matrix.os == 'windows-2019' && matrix.arch == 'arm64' && matrix.runner_name == 'setup-actions-windows-arm64-4-core'
shell: powershell shell: powershell
run: | run: |
echo "C:\Program Files\PowerShell\7" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 echo "C:\Program Files\PowerShell\7" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
- name: Install Git - name: Install Git
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64' && env.RUNNER_NAME == 'setup-actions-windows-arm64-4-core' if: matrix.os == 'windows-2019' && matrix.arch == 'arm64' && matrix.runner_name == 'setup-actions-windows-arm64-4-core'
shell: cmd shell: cmd
run: | run: |
choco install git -y choco install git -y
- name: Add Git to PATH - name: Add Git to PATH
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64' && env.RUNNER_NAME == 'setup-actions-windows-arm64-4-core' if: matrix.os == 'windows-2019' && matrix.arch == 'arm64' && matrix.runner_name == 'setup-actions-windows-arm64-4-core'
shell: powershell shell: powershell
run: | run: |
echo "C:\Program Files\Git\cmd" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 echo "C:\Program Files\Git\cmd" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
- name: Check git version - name: Check git version
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64' && env.RUNNER_NAME == 'setup-actions-windows-arm64-4-core' if: matrix.os == 'windows-2019' && matrix.arch == 'arm64' && matrix.runner_name == 'setup-actions-windows-arm64-4-core'
run: | run: |
git --version git --version
- name: Check out repository code - name: Check out repository code
@@ -194,12 +207,14 @@ jobs:
path: ${{ runner.temp }}/${{ env.ARTIFACT_NAME }} path: ${{ runner.temp }}/${{ env.ARTIFACT_NAME }}
- name: Install 7-Zip - name: Install 7-Zip
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64' && env.RUNNER_NAME == 'setup-actions-windows-arm64-4-core' if: matrix.os == 'windows-2019' && matrix.arch == 'arm64' && matrix.runner_name == 'setup-actions-windows-arm64-4-core'
shell: cmd shell: cmd
run: | run: |
choco install 7zip -y choco install 7zip -y
- name: Add 7-Zip to PATH - name: Add 7-Zip to PATH
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64' && env.RUNNER_NAME == 'setup-actions-windows-arm64-4-core' if: matrix.os == 'windows-2019' && matrix.arch == 'arm64' && matrix.runner_name == 'setup-actions-windows-arm64-4-core'
shell: powershell shell: powershell
run: | run: |
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