From cd751e6cc2e8ea766b643cca337c43b10abb786e Mon Sep 17 00:00:00 2001 From: aparnajyothi-y <147696841+aparnajyothi-y@users.noreply.github.com> Date: Wed, 19 Jun 2024 18:55:04 +0530 Subject: [PATCH] Update build-python-packages.yml --- .github/workflows/build-python-packages.yml | 99 ++++++++++++--------- 1 file changed, 57 insertions(+), 42 deletions(-) diff --git a/.github/workflows/build-python-packages.yml b/.github/workflows/build-python-packages.yml index 26f8c6d..ef86751 100644 --- a/.github/workflows/build-python-packages.yml +++ b/.github/workflows/build-python-packages.yml @@ -32,33 +32,36 @@ defaults: jobs: generate_matrix: - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.generate-matrix.outputs.matrix }} - steps: - - name: Generate execution matrix - id: generate-matrix - 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() - $matrix = @() - foreach ($configuration in $configurations) { - $parts = $configuration.Split("_") - $os = $parts[0] - $arch = if ($parts[1]) {$parts[1]} else {"x64"} - $runner_name = if ($os -eq 'windows-2019' -and $arch -eq 'arm64') {'setup-actions-windows-arm64-4-core'} else {''} - switch -wildcard ($os) { - "*ubuntu*" { $platform = $os.Replace("ubuntu","linux")} - "*macos*" { $platform = 'darwin' } - "*windows*" { $platform = 'win32' } + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.generate-matrix.outputs.matrix }} + steps: + - name: Generate execution matrix + id: generate-matrix + 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_x86,windows-2019_arm64' }}".Split(",").Trim() + $matrix = @() + + foreach ($configuration in $configurations) { + $parts = $configuration.Split("_") + $os = $parts[0] + $arch = if ($parts[1]) {$parts[1]} else {"x64"} + $runner_name = if ($os -eq 'windows-2019' -and $arch -eq 'arm64') {'setup-actions-windows-arm64-4-core'} else {''} + + switch -wildcard ($os) { + "*ubuntu*" { $platform = $os.Replace("ubuntu","linux")} + "*macos*" { $platform = 'darwin' } + "*windows*" { $platform = 'win32' } + } + $matrix += @{ + 'platform' = $platform + 'os' = $os + 'arch' = $arch + 'runner_name' = $runner_name + + } } - $matrix += @{ - 'platform' = $platform - 'os' = $os - 'arch' = $arch - 'runner_name' = $runner_name - } - } - echo "matrix=$($matrix | ConvertTo-Json -Compress -AsArray)" >> $env:GITHUB_OUTPUT + echo "matrix=$($matrix | ConvertTo-Json -Compress -AsArray)" >> $env:GITHUB_OUTPUT build_python: needs: generate_matrix strategy: @@ -71,7 +74,7 @@ jobs: steps: - 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 run: | Set-ExecutionPolicy Bypass -Scope Process -Force @@ -79,28 +82,32 @@ jobs: 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 - 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 run: | choco install powershell-core -y - 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 run: | echo "C:\Program Files\PowerShell\7" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - 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 run: | choco install git -y - 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 run: | echo "C:\Program Files\Git\cmd" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - 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: | git --version @@ -110,12 +117,13 @@ jobs: submodules: true - 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 run: | choco install 7zip -y - 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 run: | echo "C:\ProgramData\chocolatey\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 @@ -142,7 +150,7 @@ jobs: steps: - 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 run: | Set-ExecutionPolicy Bypass -Scope Process -Force @@ -150,28 +158,33 @@ jobs: 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 - 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 run: | choco install powershell-core -y - 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 run: | echo "C:\Program Files\PowerShell\7" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - 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 run: | choco install git -y - 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 run: | echo "C:\Program Files\Git\cmd" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - 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: | git --version - name: Check out repository code @@ -194,12 +207,14 @@ jobs: path: ${{ runner.temp }}/${{ env.ARTIFACT_NAME }} - 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 run: | choco install 7zip -y - 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 run: | echo "C:\ProgramData\chocolatey\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8