From f8d125bd6407ee5680803ca4f41cbfe30146ace1 Mon Sep 17 00:00:00 2001 From: gowridurgad <159780674+gowridurgad@users.noreply.github.com> Date: Tue, 25 Jun 2024 10:25:30 +0530 Subject: [PATCH] Update build-tool-packages.yml --- .github/workflows/build-tool-packages.yml | 100 ++++++++++++++-------- 1 file changed, 63 insertions(+), 37 deletions(-) diff --git a/.github/workflows/build-tool-packages.yml b/.github/workflows/build-tool-packages.yml index 277fb51..973bfa1 100644 --- a/.github/workflows/build-tool-packages.yml +++ b/.github/workflows/build-tool-packages.yml @@ -1,4 +1,3 @@ - # This reusable workflow is used by actions/*-versions repositories # It is designed to # - build and test new versions of a tool (Go, Node) @@ -26,19 +25,34 @@ defaults: run: shell: pwsh - +# Fix for windows arm64 7z file issue. More details at https://github.com/nodejs/node/issues/52231 jobs: build: name: Build ${{ inputs.tool-name }} ${{ inputs.tool-version }} [${{ matrix.platform }}] [${{ matrix.architecture }}] - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} env: ARTIFACT_NAME: ${{ inputs.tool-name }}-${{ inputs.tool-version }}-${{ matrix.platform }}-${{ matrix.architecture }} strategy: fail-fast: false matrix: - platform: [linux, darwin, win32] - architecture: [x64, arm64] + include: + - os: ubuntu-latest + platform: linux + architecture: x64 + - os: ubuntu-latest + platform: darwin + architecture: x64 + - os: ubuntu-latest + platform: win32 + architecture: x64 + - os: ubuntu-latest + platform: linux + architecture: arm64 + - os: ubuntu-latest + platform: darwin + architecture: arm64 + steps: - uses: actions/checkout@v4 with: @@ -56,6 +70,39 @@ jobs: name: ${{ env.ARTIFACT_NAME }} path: ${{ runner.temp }}/artifact + build-arm: + name: Build ${{ inputs.tool-name }} ${{ inputs.tool-version }} [${{ matrix.platform }}] [${{ matrix.architecture }}] + runs-on: windows-latest + if: (inputs.tool-name == 'go') || (inputs.tool-name == 'node' && inputs['tool-version'] > '20.0.0') + env: + ARTIFACT_NAME: ${{ inputs.tool-name }}-${{ inputs.tool-version }}-${{ matrix.platform }}-${{ matrix.architecture }} + strategy: + fail-fast: false + matrix: + include: + - os: windows-latest + platform: win32 + architecture: arm64 + + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Build ${{ inputs.tool-name }} ${{ inputs.tool-version }} + run: | + ./builders/build-${{ inputs.tool-name }}.ps1 -Version ${{ inputs.tool-version }} ` + -Platform ${{ matrix.platform }} ` + -Architecture ${{ matrix.architecture }} + + + - name: Publish artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ env.ARTIFACT_NAME }} + path: ${{ runner.temp }}/artifact + test: name: Test ${{ inputs.tool-name }} ${{ inputs.tool-version }} [${{ matrix.platform }}] needs: build @@ -69,50 +116,28 @@ jobs: - os: ubuntu-latest platform: linux arch: x64 - - os: macos-latest - platform: darwin - arch: arm64 - - os: windows-latest - platform: win32 - arch: x64 - os: setup-actions-ubuntu-arm64-2-core platform: linux arch: arm64 - os: macos-13 platform: darwin arch: x64 + - os: macos-latest + platform: darwin + arch: arm64 + - os: windows-latest + platform: win32 + arch: x64 - os: setup-actions-windows-arm64-4-core platform: win32 arch: arm64 - - steps: - - name: Setup Environment on Windows ARM64 Runner - if: matrix.os == 'setup-actions-windows-arm64-4-core' - shell: powershell - run: | - # Install Chocolatey - Set-ExecutionPolicy Bypass -Scope Process -Force - [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 - 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 - # Install PowerShell - choco install powershell-core -y - echo "C:\Program Files\PowerShell\7" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - - # Install Git - choco install git -y - echo "C:\Program Files\Git\cmd" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - - - # Install 7-Zip - choco install 7zip -y - echo "C:\ProgramData\chocolatey\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - + + steps: - uses: actions/checkout@v3 with: - submodules: true - + submodules: true + - name: Fully cleanup the toolcache directory before testing run: ./helpers/clean-toolcache.ps1 -ToolName "${{ inputs.tool-name }}" @@ -169,6 +194,7 @@ jobs: env: VERSION: ${{ inputs.tool-version }} run: | + Install-Module Pester -Force -Scope CurrentUser Import-Module Pester $toolName = (Get-Culture).TextInfo.ToTitleCase("${{ inputs.tool-name }}") Invoke-Pester -Script ./$toolName.Tests.ps1 -EnableExit