From 45c19eb7cb35d416e6b8ef32aba4c6e6236b13c1 Mon Sep 17 00:00:00 2001 From: David Kale Date: Wed, 13 Nov 2019 11:26:06 -0500 Subject: [PATCH] 150: Support more cpu architectures (#184) * Cross compile for win-x86, linux-arm, linux-arm64 * Build with actions instead * Remove win-x86 * Preserve CURRENT_PLATFORM in dev.sh * build.yaml * Fix formatting. Remove piplines * Use 4 space indent consistently * x32 -> x86 * TEMP: Only test when platform === target runtime Fix arm64 node externals url * win-x86 externals * Temporarily bench rhel * Add RHEL6, skip L0 on arm for now * Add stub for downloading new node externals when they are ready * Remove RHEL6 * Package based on new runtime names * Remove unused rhel from matrix includes * Update release, add packages * RID typo * Cant cross test arm on x64 hosts * New arch is a feature Dont release x86 until we have an e2e test machine * Fix version * Get version from file to avoid exec error during package on x64 host for arm package * Update Release Notes for 2.161.0 (#195) * More cleanup * Update release notes --- .github/workflows/build.yml | 39 +++++--- assets.json | 12 +++ azure-pipelines-release.yml | 86 +++++++++++++--- nonwindows.template.yml | 8 +- releaseNote.md | 25 ++++- src/Directory.Build.props | 9 +- src/Misc/externals.sh | 20 +++- src/Runner.Common/Runner.Common.csproj | 2 +- src/Runner.Common/Util/VarUtil.cs | 2 + src/Runner.Listener/Runner.Listener.csproj | 2 +- .../Runner.PluginHost.csproj | 4 +- src/Runner.Plugins/Runner.Plugins.csproj | 2 +- src/Runner.Sdk/Runner.Sdk.csproj | 2 +- .../ContainerOperationProvider.cs | 3 - src/Runner.Worker/Runner.Worker.csproj | 4 +- src/Sdk/Sdk.csproj | 2 +- src/Test/L0/ConstantGenerationL0.cs | 2 +- src/Test/Test.csproj | 2 +- src/dev.sh | 98 +++++++++---------- src/runnerversion | 2 +- windows.template.yml | 7 +- 21 files changed, 224 insertions(+), 109 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0401e9663..dd06a522c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,34 +1,48 @@ name: Runner CI -on: +on: push: - branches: + branches: - master - releases/* pull_request: - branches: + branches: - '*' jobs: build: strategy: matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] + runtime: [ linux-x64, linux-arm64, linux-arm, win-x64, osx-x64 ] include: - - os: ubuntu-latest + - runtime: linux-x64 + os: ubuntu-latest devScript: ./dev.sh - - os: macOS-latest + + - runtime: linux-arm64 + os: ubuntu-latest devScript: ./dev.sh - - os: windows-latest + + - runtime: linux-arm + os: ubuntu-latest + devScript: ./dev.sh + + - runtime: osx-x64 + os: macOS-latest + devScript: ./dev.sh + + - runtime: win-x64 + os: windows-latest devScript: ./dev + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v1 - + # Build runner layout - name: Build & Layout Release run: | - ${{ matrix.devScript }} layout Release + ${{ matrix.devScript }} layout Release ${{ matrix.runtime }} working-directory: src # Run tests @@ -36,18 +50,19 @@ jobs: run: | ${{ matrix.devScript }} test working-directory: src - + if: matrix.runtime != 'linux-arm64' && matrix.runtime != 'linux-arm' + # Create runner package tar.gz/zip - name: Package Release if: github.event_name != 'pull_request' run: | ${{ matrix.devScript }} package Release working-directory: src - + # Upload runner package tar.gz/zip as artifact - name: Publish Artifact if: github.event_name != 'pull_request' uses: actions/upload-artifact@v1 with: - name: runner-package-${{ matrix.os }} + name: runner-package-${{ matrix.runtime }} path: _package diff --git a/assets.json b/assets.json index a6cfba2f0..138f58f62 100644 --- a/assets.json +++ b/assets.json @@ -16,5 +16,17 @@ "platform": "linux-x64", "version": "", "downloadUrl": "https://githubassets.azureedge.net/runners//actions-runner-linux-x64-.tar.gz" + }, + { + "name": "actions-runner-linux-arm64-.tar.gz", + "platform": "linux-arm64", + "version": "", + "downloadUrl": "https://githubassets.azureedge.net/runners//actions-runner-linux-arm64-.tar.gz" + }, + { + "name": "actions-runner-linux-arm-.tar.gz", + "platform": "linux-arm", + "version": "", + "downloadUrl": "https://githubassets.azureedge.net/runners//actions-runner-linux-arm-.tar.gz" } ] \ No newline at end of file diff --git a/azure-pipelines-release.yml b/azure-pipelines-release.yml index 25ea0aa2a..7e3f06b59 100644 --- a/azure-pipelines-release.yml +++ b/azure-pipelines-release.yml @@ -1,5 +1,5 @@ stages: -- stage: Build +- stage: Build jobs: ################################################################################ - job: build_windows_agent_x64 @@ -11,12 +11,14 @@ stages: # Steps template for windows platform - template: windows.template.yml - + parameters: + targetRuntime: win-x64 + # Package dotnet core windows dependency (VC++ Redistributable) - powershell: | Write-Host "Downloading 'VC++ Redistributable' package." $outDir = Join-Path -Path $env:TMP -ChildPath ([Guid]::NewGuid()) - New-Item -Path $outDir -ItemType directory + New-Item -Path $outDir -ItemType directory $outFile = Join-Path -Path $outDir -ChildPath "ucrt.zip" Invoke-WebRequest -Uri https://vstsagenttools.blob.core.windows.net/tools/ucrt/ucrt_x64.zip -OutFile $outFile Write-Host "Unzipping 'VC++ Redistributable' package to agent layout." @@ -28,13 +30,13 @@ stages: displayName: Package UCRT # Create agent package zip - - script: dev.cmd package Release + - script: dev.cmd package Release win-x64 workingDirectory: src displayName: Package Release # Upload agent package zip as build artifact - task: PublishBuildArtifacts@1 - displayName: Publish Artifact (Windows) + displayName: Publish Artifact (Windows x64) inputs: pathToPublish: _package artifactName: runners @@ -50,22 +52,76 @@ stages: # Steps template for non-windows platform - template: nonwindows.template.yml + parameters: + targetRuntime: linux-x64 # Create agent package zip - - script: ./dev.sh package Release + - script: ./dev.sh package Release linux-x64 workingDirectory: src - displayName: Package Release + displayName: Package Release # Upload agent package zip as build artifact - task: PublishBuildArtifacts@1 - displayName: Publish Artifact (Linux) + displayName: Publish Artifact (Linux x64) inputs: pathToPublish: _package artifactName: runners artifactType: container ################################################################################ - - job: build_osx_agent + - job: build_linux_agent_arm64 + ################################################################################ + displayName: Linux Agent (arm64) + pool: + vmImage: ubuntu-16.04 + steps: + + # Steps template for non-windows platform + - template: nonwindows.template.yml + parameters: + targetRuntime: linux-arm64 + + # Create agent package zip + - script: ./dev.sh package Release linux-arm64 + workingDirectory: src + displayName: Package Release + + # Upload agent package zip as build artifact + - task: PublishBuildArtifacts@1 + displayName: Publish Artifact (Linux ARM64) + inputs: + pathToPublish: _package + artifactName: runners + artifactType: container + + ################################################################################ + - job: build_linux_agent_arm + ################################################################################ + displayName: Linux Agent (arm) + pool: + vmImage: ubuntu-16.04 + steps: + + # Steps template for non-windows platform + - template: nonwindows.template.yml + parameters: + targetRuntime: linux-arm + + # Create agent package zip + - script: ./dev.sh package Release linux-arm + workingDirectory: src + displayName: Package Release + + # Upload agent package zip as build artifact + - task: PublishBuildArtifacts@1 + displayName: Publish Artifact (Linux ARM) + inputs: + pathToPublish: _package + artifactName: runners + artifactType: container + + ################################################################################ + - job: build_osx_agent_x64 ################################################################################ displayName: macOS Agent (x64) pool: @@ -74,15 +130,17 @@ stages: # Steps template for non-windows platform - template: nonwindows.template.yml - + parameters: + targetRuntime: osx-x64 + # Create agent package zip - - script: ./dev.sh package Release + - script: ./dev.sh package Release osx-x64 workingDirectory: src - displayName: Package Release + displayName: Package Release # Upload agent package zip as build artifact - task: PublishBuildArtifacts@1 - displayName: Publish Artifact (OSX) + displayName: Publish Artifact (OSX x64) inputs: pathToPublish: _package artifactName: runners @@ -98,7 +156,7 @@ stages: pool: name: ProductionRMAgents steps: - + # Download all agent packages from all previous phases - task: DownloadBuildArtifacts@0 displayName: Download Agent Packages diff --git a/nonwindows.template.yml b/nonwindows.template.yml index 833bd0500..ac312f78e 100644 --- a/nonwindows.template.yml +++ b/nonwindows.template.yml @@ -1,14 +1,18 @@ +parameters: + targetRuntime: '' + steps: # Build agent layout -- script: ./dev.sh layout Release +- script: ./dev.sh layout Release ${{ parameters.targetRuntime }} workingDirectory: src - displayName: Build & Layout Release + displayName: Build & Layout Release ${{ parameters.targetRuntime }} # Run test - script: ./dev.sh test workingDirectory: src displayName: Test + condition: and(ne('${{ parameters.targetRuntime }}', 'linux-arm64'), ne('${{ parameters.targetRuntime }}', 'linux-arm')) # # Publish test results # - task: PublishTestResults@2 diff --git a/releaseNote.md b/releaseNote.md index 99f31c6ce..dd08471f2 100644 --- a/releaseNote.md +++ b/releaseNote.md @@ -1,11 +1,14 @@ ## Features - - N/A + - Added packages for Linux ARM32 (linux-arm) and Linux ARM64 (linux-arm64) (#184) + - Note that these packages are pre-release status and may not work with all existing actions ## Bugs - - Fixed an issue with Strong Name Validation when running as a service on Windows (#185) + - Fixed a bug where problem matchers were not treating FromPath as a file path (#183) ## Misc - - N/A + - Fixed code warnings in the Runner (#174) + - Fixed code warnings in the Runner tests (#178) + - Added support for building the Runner in Visual Studio (#173) ## Agent Downloads @@ -14,6 +17,8 @@ | Windows x64 | [actions-runner-win-x64-.zip](https://githubassets.azureedge.net/runners//actions-runner-win-x64-.zip) | | macOS | [actions-runner-osx-x64-.tar.gz](https://githubassets.azureedge.net/runners//actions-runner-osx-x64-.tar.gz) | | Linux x64 | [actions-runner-linux-x64-.tar.gz](https://githubassets.azureedge.net/runners//actions-runner-linux-x64-.tar.gz) | +| Linux arm64 | [actions-runner-linux-arm64-.tar.gz](https://githubassets.azureedge.net/runners//actions-runner-linux-arm64-.tar.gz) | +| Linux arm | [actions-runner-linux-arm-.tar.gz](https://githubassets.azureedge.net/runners//actions-runner-linux-arm-.tar.gz) | After Download: @@ -37,3 +42,17 @@ C:\myagent> Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO ~/$ mkdir myagent && cd myagent ~/myagent$ tar xzf ~/Downloads/actions-runner-linux-x64-.tar.gz ``` + +## Linux arm64 + +``` bash +~/$ mkdir myagent && cd myagent +~/myagent$ tar xzf ~/Downloads/actions-runner-linux-arm64-.tar.gz +``` + +## Linux arm + +``` bash +~/$ mkdir myagent && cd myagent +~/myagent$ tar xzf ~/Downloads/actions-runner-linux-arm-.tar.gz +``` \ No newline at end of file diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 0799b4438..5c4a93183 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -16,9 +16,6 @@ $(DefineConstants);OS_LINUX - - $(DefineConstants);OS_RHEL6 - @@ -35,12 +32,12 @@ $(DefineConstants);X64 - - $(DefineConstants);X64 - $(DefineConstants);ARM + + $(DefineConstants);ARM64 + diff --git a/src/Misc/externals.sh b/src/Misc/externals.sh index 0f37cc254..7788d4255 100755 --- a/src/Misc/externals.sh +++ b/src/Misc/externals.sh @@ -123,9 +123,9 @@ function acquireExternalTool() { } # Download the external tools only for Windows. -if [[ "$PACKAGERUNTIME" == "win-x64" ]]; then - acquireExternalTool "$NODE_URL/v${NODE12_VERSION}/win-x64/node.exe" node12/bin - acquireExternalTool "$NODE_URL/v${NODE12_VERSION}/win-x64/node.lib" node12/bin +if [[ "$PACKAGERUNTIME" == "win-x64" || "$PACKAGERUNTIME" == "win-x86" ]]; then + acquireExternalTool "$NODE_URL/v${NODE12_VERSION}/$PACKAGERUNTIME/node.exe" node12/bin + acquireExternalTool "$NODE_URL/v${NODE12_VERSION}/$PACKAGERUNTIME/node.lib" node12/bin if [[ "$PRECACHE" != "" ]]; then acquireExternalTool "https://github.com/microsoft/vswhere/releases/download/2.6.7/vswhere.exe" vswhere fi @@ -136,13 +136,23 @@ if [[ "$PACKAGERUNTIME" == "osx-x64" ]]; then acquireExternalTool "$NODE_URL/v${NODE12_VERSION}/node-v${NODE12_VERSION}-darwin-x64.tar.gz" node12 fix_nested_dir fi -# Download the external tools common across Linux PACKAGERUNTIMEs (excluding OSX). -if [[ "$PACKAGERUNTIME" == "linux-x64" || "$PACKAGERUNTIME" == "rhel.6-x64" ]]; then +# Download the external tools for Linux PACKAGERUNTIMEs. +if [[ "$PACKAGERUNTIME" == "linux-x64" ]]; then acquireExternalTool "$NODE_URL/v${NODE12_VERSION}/node-v${NODE12_VERSION}-linux-x64.tar.gz" node12 fix_nested_dir # TODO: Repath this blob to use a consistent version format (_ vs .) acquireExternalTool "https://vstsagenttools.blob.core.windows.net/tools/nodejs/12_4_0/alpine/node-v${NODE12_VERSION}-alpine.tar.gz" node12_alpine + # acquireExternalTool "https://vstsagenttools.blob.core.windows.net/tools/nodejs/12.13.0/alpine/x64/node-v${NODE12_VERSION}-alpine-x64.tar.gz" node12_alpine +fi + +if [[ "$PACKAGERUNTIME" == "linux-arm64" ]]; then + acquireExternalTool "$NODE_URL/v${NODE12_VERSION}/node-v${NODE12_VERSION}-linux-arm64.tar.gz" node12 fix_nested_dir + # TODO: alpine node runtime for arm64(8) + # acquireExternalTool "https://vstsagenttools.blob.core.windows.net/tools/nodejs/12.13.0/alpine/arm64/node-v${NODE12_VERSION}-alpine-arm64.tar.gz" node12_alpine fi if [[ "$PACKAGERUNTIME" == "linux-arm" ]]; then acquireExternalTool "$NODE_URL/v${NODE12_VERSION}/node-v${NODE12_VERSION}-linux-armv7l.tar.gz" node12 fix_nested_dir + # TODO: alpine node runtime for arm32(7) + # Need to set up custom gcc toolchain to cross compile on x64 ubuntu for armv7 (per https://github.com/nodejs/node/blob/master/BUILDING.md) + # acquireExternalTool "https://vstsagenttools.blob.core.windows.net/tools/nodejs/12.13.0/alpine/arm/node-v${NODE12_VERSION}-alpine-arm.tar.gz" node12_alpine fi diff --git a/src/Runner.Common/Runner.Common.csproj b/src/Runner.Common/Runner.Common.csproj index 0ebf38336..38b15a7b2 100644 --- a/src/Runner.Common/Runner.Common.csproj +++ b/src/Runner.Common/Runner.Common.csproj @@ -3,7 +3,7 @@ netcoreapp3.0 Library - win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64 + win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64 true portable-net45+win8 NU1701;NU1603 diff --git a/src/Runner.Common/Util/VarUtil.cs b/src/Runner.Common/Util/VarUtil.cs index 81b8ecb23..b9860e151 100644 --- a/src/Runner.Common/Util/VarUtil.cs +++ b/src/Runner.Common/Util/VarUtil.cs @@ -54,6 +54,8 @@ namespace GitHub.Runner.Common.Util return "X64"; case Constants.Architecture.Arm: return "ARM"; + case Constants.Architecture.Arm64: + return "ARM64"; default: throw new NotSupportedException(); // Should never reach here. } diff --git a/src/Runner.Listener/Runner.Listener.csproj b/src/Runner.Listener/Runner.Listener.csproj index 243e5911f..4d73e2a24 100644 --- a/src/Runner.Listener/Runner.Listener.csproj +++ b/src/Runner.Listener/Runner.Listener.csproj @@ -3,7 +3,7 @@ netcoreapp3.0 Exe - win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64 + win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64 true portable-net45+win8 NU1701;NU1603 diff --git a/src/Runner.PluginHost/Runner.PluginHost.csproj b/src/Runner.PluginHost/Runner.PluginHost.csproj index 6066911f4..e76872ef3 100644 --- a/src/Runner.PluginHost/Runner.PluginHost.csproj +++ b/src/Runner.PluginHost/Runner.PluginHost.csproj @@ -3,13 +3,13 @@ netcoreapp3.0 Exe - win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64 + win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64 true portable-net45+win8 NU1701;NU1603 $(Version) true - true + true diff --git a/src/Runner.Plugins/Runner.Plugins.csproj b/src/Runner.Plugins/Runner.Plugins.csproj index da5d92f9b..e9560a28b 100644 --- a/src/Runner.Plugins/Runner.Plugins.csproj +++ b/src/Runner.Plugins/Runner.Plugins.csproj @@ -3,7 +3,7 @@ netcoreapp3.0 Library - win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64 + win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64 true portable-net45+win8 NU1701;NU1603 diff --git a/src/Runner.Sdk/Runner.Sdk.csproj b/src/Runner.Sdk/Runner.Sdk.csproj index ba5caa935..4d4bbbe52 100644 --- a/src/Runner.Sdk/Runner.Sdk.csproj +++ b/src/Runner.Sdk/Runner.Sdk.csproj @@ -3,7 +3,7 @@ netcoreapp3.0 Library - win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64 + win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64 true portable-net45+win8 NU1701;NU1603 diff --git a/src/Runner.Worker/ContainerOperationProvider.cs b/src/Runner.Worker/ContainerOperationProvider.cs index 9085dcb0a..a1646e7ed 100644 --- a/src/Runner.Worker/ContainerOperationProvider.cs +++ b/src/Runner.Worker/ContainerOperationProvider.cs @@ -57,9 +57,6 @@ namespace GitHub.Runner.Worker { throw new NotSupportedException("Container feature is not supported when runner is already running inside container."); } -#elif OS_RHEL6 - // Red Hat and CentOS 6 do not support the container feature - throw new NotSupportedException("Runner does not support the container feature on Red Hat Enterprise Linux 6 or CentOS 6."); #else var initProcessCgroup = File.ReadLines("/proc/1/cgroup"); if (initProcessCgroup.Any(x => x.IndexOf(":/docker/", StringComparison.OrdinalIgnoreCase) >= 0)) diff --git a/src/Runner.Worker/Runner.Worker.csproj b/src/Runner.Worker/Runner.Worker.csproj index 1b25f492a..5e4e5216b 100644 --- a/src/Runner.Worker/Runner.Worker.csproj +++ b/src/Runner.Worker/Runner.Worker.csproj @@ -3,13 +3,13 @@ netcoreapp3.0 Exe - win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64 + win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64 true portable-net45+win8 NU1701;NU1603 $(Version) true - true + true diff --git a/src/Sdk/Sdk.csproj b/src/Sdk/Sdk.csproj index e9f110a92..769d4931e 100644 --- a/src/Sdk/Sdk.csproj +++ b/src/Sdk/Sdk.csproj @@ -3,7 +3,7 @@ netcoreapp3.0 Library - win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64 + win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64 true portable-net45+win8 NU1701;NU1603 diff --git a/src/Test/L0/ConstantGenerationL0.cs b/src/Test/L0/ConstantGenerationL0.cs index 7e9fcb0d3..31caa57af 100644 --- a/src/Test/L0/ConstantGenerationL0.cs +++ b/src/Test/L0/ConstantGenerationL0.cs @@ -18,7 +18,7 @@ namespace GitHub.Runner.Common.Tests "win-x86", "linux-x64", "linux-arm", - "rhel.6-x64", + "linux-arm64", "osx-x64" }; diff --git a/src/Test/Test.csproj b/src/Test/Test.csproj index 0b8ec45a3..8f6354852 100644 --- a/src/Test/Test.csproj +++ b/src/Test/Test.csproj @@ -1,7 +1,7 @@  netcoreapp3.0 - win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64 + win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64 true portable-net45+win8 NU1701;NU1603;NU1603;xUnit2013; diff --git a/src/dev.sh b/src/dev.sh index 8e7858ccf..681f9b959 100755 --- a/src/dev.sh +++ b/src/dev.sh @@ -10,6 +10,7 @@ set -e DEV_CMD=$1 DEV_CONFIG=$2 +DEV_TARGET_RUNTIME=$3 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" LAYOUT_DIR="$SCRIPT_DIR/../_layout" @@ -33,64 +34,60 @@ if [[ ($(uname) == "Linux") || ($(uname) == "Darwin") ]]; then fi if [[ "$CURRENT_PLATFORM" == 'windows' ]]; then - RUNTIME_ID='win-x64' - if [[ "$PROCESSOR_ARCHITECTURE" == 'x86' ]]; then - RUNTIME_ID='win-x86' - fi + RUNTIME_ID='win-x64' + if [[ "$PROCESSOR_ARCHITECTURE" == 'x86' ]]; then + RUNTIME_ID='win-x86' + fi elif [[ "$CURRENT_PLATFORM" == 'linux' ]]; then - RUNTIME_ID="linux-x64" - if command -v uname > /dev/null; then - CPU_NAME=$(uname -m) - case $CPU_NAME in - armv7l) RUNTIME_ID="linux-arm";; - aarch64) RUNTIME_ID="linux-arm";; - esac - fi - - if [ -e /etc/redhat-release ]; then - redhatRelease=$( /dev/null; then + CPU_NAME=$(uname -m) + case $CPU_NAME in + armv7l) RUNTIME_ID="linux-arm";; + aarch64) RUNTIME_ID="linux-arm64";; + esac + fi elif [[ "$CURRENT_PLATFORM" == 'darwin' ]]; then - RUNTIME_ID='osx-x64' + RUNTIME_ID='osx-x64' +fi + +if [[ -n "$DEV_TARGET_RUNTIME" ]]; then + RUNTIME_ID="$DEV_TARGET_RUNTIME" fi # Make sure current platform support publish the dotnet runtime # Windows can publish win-x86/x64 -# Linux can publish linux-x64/arm/rhel.6-x64 +# Linux can publish linux-x64/arm/arm64 # OSX can publish osx-x64 if [[ "$CURRENT_PLATFORM" == 'windows' ]]; then - if [[ ("$RUNTIME_ID" != 'win-x86') && ("$RUNTIME_ID" != 'win-x64') ]]; then - echo "Failed: Can't build $RUNTIME_ID package $CURRENT_PLATFORM" >&2 - exit 1 - fi + if [[ ("$RUNTIME_ID" != 'win-x86') && ("$RUNTIME_ID" != 'win-x64') ]]; then + echo "Failed: Can't build $RUNTIME_ID package $CURRENT_PLATFORM" >&2 + exit 1 + fi elif [[ "$CURRENT_PLATFORM" == 'linux' ]]; then - if [[ ("$RUNTIME_ID" != 'linux-x64') && ("$RUNTIME_ID" != 'linux-arm') && ("$RUNTIME_ID" != 'rhel.6-x64') ]]; then - echo "Failed: Can't build $RUNTIME_ID package $CURRENT_PLATFORM" >&2 - exit 1 - fi + if [[ ("$RUNTIME_ID" != 'linux-x64') && ("$RUNTIME_ID" != 'linux-x86') && ("$RUNTIME_ID" != 'linux-arm64') && ("$RUNTIME_ID" != 'linux-arm') ]]; then + echo "Failed: Can't build $RUNTIME_ID package $CURRENT_PLATFORM" >&2 + exit 1 + fi elif [[ "$CURRENT_PLATFORM" == 'darwin' ]]; then - if [[ ("$RUNTIME_ID" != 'osx-x64') ]]; then - echo "Failed: Can't build $RUNTIME_ID package $CURRENT_PLATFORM" >&2 - exit 1 - fi + if [[ ("$RUNTIME_ID" != 'osx-x64') ]]; then + echo "Failed: Can't build $RUNTIME_ID package $CURRENT_PLATFORM" >&2 + exit 1 + fi fi function failed() { - local error=${1:-Undefined error} - echo "Failed: $error" >&2 - popd - exit 1 + local error=${1:-Undefined error} + echo "Failed: $error" >&2 + popd + exit 1 } function warn() { - local error=${1:-Undefined error} - echo "WARNING - FAILED: $error" >&2 + local error=${1:-Undefined error} + echo "WARNING - FAILED: $error" >&2 } function checkRC() { @@ -151,7 +148,8 @@ function package () echo "You must build first. Expecting to find ${LAYOUT_DIR}/bin" fi - runner_ver=$("${LAYOUT_DIR}/bin/Runner.Listener" --version) || failed "version" + # TODO: We are cross-compiling arm on x64 so we cant exec Runner.Listener. Remove after building on native arm host + runner_ver=$("${LAYOUT_DIR}/bin/Runner.Listener" --version) || runner_ver=$(cat runnerversion) || failed "version" runner_pkg_name="actions-runner-${RUNTIME_ID}-${runner_ver}" heading "Packaging ${runner_pkg_name}" @@ -231,15 +229,15 @@ if [[ "$CURRENT_PLATFORM" == 'windows' ]]; then fi case $DEV_CMD in - "build") build;; - "b") build;; - "test") runtest;; - "t") runtest;; - "layout") layout;; - "l") layout;; - "package") package;; - "p") package;; - *) echo "Invalid cmd. Use build(b), test(t), layout(l) or package(p)";; + "build") build;; + "b") build;; + "test") runtest;; + "t") runtest;; + "layout") layout;; + "l") layout;; + "package") package;; + "p") package;; + *) echo "Invalid cmd. Use build(b), test(t), layout(l) or package(p)";; esac popd diff --git a/src/runnerversion b/src/runnerversion index 957ed2e1e..68c57659e 100644 --- a/src/runnerversion +++ b/src/runnerversion @@ -1 +1 @@ -2.160.2 \ No newline at end of file +2.161.0 diff --git a/windows.template.yml b/windows.template.yml index 6e003cc67..aea500107 100644 --- a/windows.template.yml +++ b/windows.template.yml @@ -1,9 +1,12 @@ +parameters: + targetRuntime: '' + steps: # Build agent layout -- script: dev.cmd layout Release +- script: dev.cmd layout Release ${{ parameters.targetRuntime }} workingDirectory: src - displayName: Build & Layout Release + displayName: Build & Layout Release ${{ parameters.targetRuntime }} # Run test - script: dev.cmd test